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