From 7774283905ec199f8ee9a6b9ff0d98423c70de53 Mon Sep 17 00:00:00 2001 From: Elena Poelman Date: Tue, 14 Feb 2023 12:57:32 +0100 Subject: [PATCH] update LDES dispatch query to take contact info into account --- config/ldes-delta-pusher/dispatch.ts | 42 ++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/config/ldes-delta-pusher/dispatch.ts b/config/ldes-delta-pusher/dispatch.ts index ba852e3..42feb68 100644 --- a/config/ldes-delta-pusher/dispatch.ts +++ b/config/ldes-delta-pusher/dispatch.ts @@ -7,14 +7,40 @@ export default async function dispatch(changesets: Changeset[]) { const subjects = new Set(changeset.inserts.map((insert) => insert.subject.value)); for (const subject of subjects) { const { results: { bindings } } = await query(` - PREFIX org: - CONSTRUCT { - ${sparqlEscapeUri(subject)} a org:Organization; - ?p ?o. - } - WHERE { - ${sparqlEscapeUri(subject)} a org:Organization; - ?p ?o. + PREFIX skos: + PREFIX code: + PREFIX org: + PREFIX adms: + + CONSTRUCT { + ?organization a org:Organization; + adms:identifier ?identifier; + org:hasPrimarySite ?site. + ?site org:siteAddress ?siteAddress. + ?siteAddress ?p ?o. + } WHERE { + { + VALUES ?organization { ${sparqlEscapeUri(subject)} } + ?organization a org:Organization; + adms:identifier ?identifier; + org:hasPrimarySite ?site. + ?site org:siteAddress ?siteAddress. + ?siteAddress ?p ?o. + } UNION { + VALUES ?site { ${sparqlEscapeUri(subject)} } + ?organization a org:Organization; + adms:identifier ?identifier; + org:hasPrimarySite ?site. + ?site org:siteAddress ?siteAddress. + ?siteAddress ?p ?o. + } UNION { + VALUES ?siteAddress { ${sparqlEscapeUri(subject)} } + ?organization a org:Organization; + adms:identifier ?identifier; + org:hasPrimarySite ?site. + ?site org:siteAddress ?siteAddress. + ?siteAddress ?p ?o. + } } `); if(bindings.length){