From 54f1d8932c88ae8eeb648646a47651a654249297 Mon Sep 17 00:00:00 2001 From: Laurent Deketelaere Date: Wed, 27 Mar 2024 09:52:28 +0100 Subject: [PATCH] Add `remove-stale-jobs.sparql-template` migration --- config/migrations-sample/README.md | 1 + .../remove-stale-jobs.sparql-template | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 config/migrations-sample/remove-stale-jobs.sparql-template diff --git a/config/migrations-sample/README.md b/config/migrations-sample/README.md index e506f8b..c5aa12e 100644 --- a/config/migrations-sample/README.md +++ b/config/migrations-sample/README.md @@ -11,4 +11,5 @@ In addition, these files can function as templates or provide inspiration for fu ## Template files - `pseudonimyze-data.sparql-template` - the file that contains the sparql for pseudonymizing data in the triplestore. It should run every time the db is "refreshed" with a copy from PROD. +- `remove-stale-jobs.sparql-template` - removing `busy` and `scheduled` jobs. - `remove-type-in-producer-graph.sparql-template` - the migration to handle the occasional sync issue between OP and Loket. diff --git a/config/migrations-sample/remove-stale-jobs.sparql-template b/config/migrations-sample/remove-stale-jobs.sparql-template new file mode 100644 index 0000000..a0120a4 --- /dev/null +++ b/config/migrations-sample/remove-stale-jobs.sparql-template @@ -0,0 +1,25 @@ +PREFIX mu: +PREFIX task: +PREFIX dct: +PREFIX prov: +PREFIX nie: +PREFIX ext: +PREFIX oslc: +PREFIX cogs: +PREFIX adms: + +DELETE { + GRAPH ?g { + ?jobUri a . + ?jobUri adms:status ?status. + ?jobUri ?p ?o + } +} +WHERE { + GRAPH ?g { + ?jobUri a . + ?jobUri adms:status ?status. + ?jobUri ?p ?o + FILTER(?status IN (, )) + } +}