From 5a318a99fed2946e1d820edf7531e6d9c4bfe7c1 Mon Sep 17 00:00:00 2001 From: Boris De Vloed Date: Wed, 2 Feb 2022 14:59:02 +0100 Subject: [PATCH] add contact types (#88) * add contact types * move migration to 2022 directory Co-authored-by: Nordine Bittich --- .../20220202120000-primary-contacts.sparql | 22 +++++++++++++++++ .../20220203100000-secondary-contacts.sparql | 24 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 config/migrations/2022/20220202120000-primary-contacts.sparql create mode 100644 config/migrations/2022/20220203100000-secondary-contacts.sparql diff --git a/config/migrations/2022/20220202120000-primary-contacts.sparql b/config/migrations/2022/20220202120000-primary-contacts.sparql new file mode 100644 index 0000000..89c771d --- /dev/null +++ b/config/migrations/2022/20220202120000-primary-contacts.sparql @@ -0,0 +1,22 @@ +# cf 20220110100000-secondary-contacts.sparql for context. +# In case it's not a secondary contactpoint (a contactpoint without an address if multiple contact points exist for one entity/mandataris) +PREFIX locn: +PREFIX schema: +PREFIX rdf: +PREFIX rdfs: +INSERT { + GRAPH { + ?contactPoint + schema:contactType "Primary" + } +} +WHERE { + GRAPH { + ?contactPoint + a schema:ContactPoint. + FILTER NOT EXISTS { + ?contactPoint + schema:contactType "Secondary" + } + } +} \ No newline at end of file diff --git a/config/migrations/2022/20220203100000-secondary-contacts.sparql b/config/migrations/2022/20220203100000-secondary-contacts.sparql new file mode 100644 index 0000000..d6db186 --- /dev/null +++ b/config/migrations/2022/20220203100000-secondary-contacts.sparql @@ -0,0 +1,24 @@ +PREFIX locn: +PREFIX schema: +PREFIX rdf: +PREFIX rdfs: +INSERT { + GRAPH { + ?secondary + schema:contactType "Secondary" + } +} +WHERE { + GRAPH { + ?primary + a schema:ContactPoint; + locn:address ?a1; + schema:telephone ?t1. + ?mandataris schema:contactPoint ?primary, ?secondary. + ?secondary + schema:telephone ?t2. + FILTER NOT EXISTS { + ?secondary locn:address ?a2. + } + } +} \ No newline at end of file