From 1624bf84fc5cbd55cc29ab7eeca5d22bb7c77093 Mon Sep 17 00:00:00 2001 From: Nordine Bittich <3816305+nbittich@users.noreply.github.com> Date: Fri, 10 Mar 2023 09:15:08 +0100 Subject: [PATCH] fix privacy graph (#253) --- .../20230228132614-move-privacy-data.sparql | 128 -------- .../20230308112614-move-privacy-data.sparql | 293 ++++++++++++++++++ .../20230308112615-move-privacy-data-2.sparql | 77 +++++ 3 files changed, 370 insertions(+), 128 deletions(-) delete mode 100644 config/migrations/2023/20230228112800-hard-split/20230228132614-move-privacy-data.sparql create mode 100644 config/migrations/2023/20230308112614-move-privacy-data.sparql create mode 100644 config/migrations/2023/20230308112615-move-privacy-data-2.sparql diff --git a/config/migrations/2023/20230228112800-hard-split/20230228132614-move-privacy-data.sparql b/config/migrations/2023/20230228112800-hard-split/20230228132614-move-privacy-data.sparql deleted file mode 100644 index ea64b74..0000000 --- a/config/migrations/2023/20230228112800-hard-split/20230228132614-move-privacy-data.sparql +++ /dev/null @@ -1,128 +0,0 @@ -PREFIX xsd: -PREFIX mu: -PREFIX persoon: -PREFIX ext: -PREFIX person: -PREFIX session: -PREFIX foaf: -PREFIX besluit: - - - - -insert { - -GRAPH { - ?person persoon:heeftGeboorte ?heeftGeboorte. - ?heeftGeboorte ?p ?o. - ?person persoon:registratie ?registration. - ?registration ?identificator. - ?identificator ?x ?y. - ?registration ?t ?j. - ?person persoon:geslacht ?geslacht. - ?person persoon:heeftNationaliteit ?nationaliteit. - - -} - -} - where { - GRAPH { - optional { - ?person persoon:heeftGeboorte ?heeftGeboorte. - ?heeftGeboorte ?p ?o. - } - optional { - ?person persoon:registratie ?registration. - ?registration ?identificator. - ?identificator ?x ?y. - ?registration ?t ?j. - } - optional { - ?person persoon:geslacht ?geslacht. - } - optional { - ?person persoon:heeftNationaliteit ?nationaliteit. - } - - filter (exists - { - graph { - ?mandatories ?person. - } - } - - || exists { - graph { - ?ministers ?person. - } - }) - - - - } - - - } - - ; - - - - - -insert { - -GRAPH { - ?person persoon:heeftGeboorte ?heeftGeboorte. - ?heeftGeboorte ?p ?o. - ?person persoon:registratie ?registration. - ?registration ?identificator. - ?identificator ?x ?y. - ?registration ?t ?j. - ?person persoon:geslacht ?geslacht. - ?person persoon:heeftNationaliteit ?nationaliteit. - - -} - -} - where { - GRAPH { - optional { - ?person persoon:heeftGeboorte ?heeftGeboorte. - ?heeftGeboorte ?p ?o. - } - optional { - ?person persoon:registratie ?registration. - ?registration ?identificator. - ?identificator ?x ?y. - ?registration ?t ?j. - } - optional { - ?person persoon:geslacht ?geslacht. - } - optional { - ?person persoon:heeftNationaliteit ?nationaliteit. - } - - filter (exists - { - graph { - ?mandatories ?person. - } - } - - || exists { - graph { - ?ministers ?person. - } - }) - - - - } - - - } - diff --git a/config/migrations/2023/20230308112614-move-privacy-data.sparql b/config/migrations/2023/20230308112614-move-privacy-data.sparql new file mode 100644 index 0000000..33dfbd4 --- /dev/null +++ b/config/migrations/2023/20230308112614-move-privacy-data.sparql @@ -0,0 +1,293 @@ +PREFIX xsd: +PREFIX mu: +PREFIX persoon: +PREFIX ext: +PREFIX person: +PREFIX session: +PREFIX foaf: +PREFIX besluit: + +DELETE { + GRAPH { + ?person persoon:heeftGeboorte ?heeftGeboorte. + ?heeftGeboorte ?p ?o. + } +} +INSERT { +GRAPH { + ?person persoon:heeftGeboorte ?heeftGeboorte. + ?heeftGeboorte ?p ?o. + + } +} +WHERE { + GRAPH { + ?person persoon:heeftGeboorte ?heeftGeboorte. + ?heeftGeboorte ?p ?o. + + filter (exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} +; + +DELETE { + GRAPH { + ?person persoon:heeftGeboorte ?heeftGeboorte. + ?heeftGeboorte ?p ?o. + } +} +INSERT { +GRAPH { + ?person persoon:heeftGeboorte ?heeftGeboorte. + ?heeftGeboorte ?p ?o. + + } +} +WHERE { + GRAPH { + ?person persoon:heeftGeboorte ?heeftGeboorte. + ?heeftGeboorte ?p ?o. + + filter (exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} +; + +# geslacht + +DELETE { + GRAPH { + ?person persoon:geslacht ?geslacht. + } +} +INSERT { +GRAPH { + ?person persoon:geslacht ?geslacht. + + + } +} +WHERE { + GRAPH { + ?person persoon:geslacht ?geslacht. + + + filter (exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} +; +DELETE { + GRAPH { + ?person persoon:geslacht ?geslacht. + } +} +INSERT { +GRAPH { + ?person persoon:geslacht ?geslacht. + + } +} +WHERE { + GRAPH { + + ?person persoon:geslacht ?geslacht. + + filter (exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} +; + +# nationaliteit +DELETE { + GRAPH { + ?person persoon:heeftNationaliteit ?nationaliteit. + } +} +INSERT { +GRAPH { + ?person persoon:heeftNationaliteit ?nationaliteit. + } +} +WHERE { + GRAPH { + ?person persoon:heeftNationaliteit ?nationaliteit. + + filter (exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} +; +DELETE { + GRAPH { + ?person persoon:heeftNationaliteit ?nationaliteit. + } +} +INSERT { +GRAPH { + ?person persoon:heeftNationaliteit ?nationaliteit. + } +} +WHERE { + GRAPH { + + ?person persoon:heeftNationaliteit ?nationaliteit. + + filter (exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} +; + + +# registration +DELETE { + GRAPH { + ?person persoon:registratie ?registration. + ?registration ?identificator. + ?identificator ?x ?y. + ?registration ?t ?j. + + } +} +INSERT { +GRAPH { + ?person persoon:registratie ?registration. + ?registration ?identificator. + ?identificator ?x ?y. + ?registration ?t ?j. + } +} +WHERE { + GRAPH { + ?person persoon:registratie ?registration. + ?registration ?identificator. + ?identificator ?x ?y. + optional { ?registration ?t ?j. } + + filter (exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} +; +DELETE { + GRAPH { + ?person persoon:registratie ?registration. + ?registration ?identificator. + ?identificator ?x ?y. + ?registration ?t ?j. + + } +} +INSERT { +GRAPH { + ?person persoon:registratie ?registration. + ?registration ?identificator. + ?identificator ?x ?y. + ?registration ?t ?j. + } +} +WHERE { + GRAPH { + ?person persoon:registratie ?registration. + ?registration ?identificator. + ?identificator ?x ?y. + optional {?registration ?t ?j.} + + filter (exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} + + diff --git a/config/migrations/2023/20230308112615-move-privacy-data-2.sparql b/config/migrations/2023/20230308112615-move-privacy-data-2.sparql new file mode 100644 index 0000000..fcf234f --- /dev/null +++ b/config/migrations/2023/20230308112615-move-privacy-data-2.sparql @@ -0,0 +1,77 @@ +PREFIX xsd: +PREFIX mu: +PREFIX persoon: +PREFIX ext: +PREFIX person: +PREFIX session: +PREFIX foaf: +PREFIX besluit: + +DELETE { + GRAPH { + ?s ?p ?o + } +} +INSERT { +GRAPH { + ?s ?p ?o + } +} +WHERE { + GRAPH { + ?s a ?type; ?person; ?p ?o. + filter ( +(?type = || ?type = ) +&& + + exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} + +; + +DELETE { + GRAPH { + ?s ?p ?o + } +} +INSERT { +GRAPH { + ?s ?p ?o + } +} +WHERE { + GRAPH { + ?s a ?type; ?person; ?p ?o. + filter ( +(?type = || ?type = ) +&& + + exists + { + graph { + ?mandatories ?person. + } + } + + || exists { + graph { + ?ministers ?person. + } + }) + + } +} +