From a65e6d6d0b48a76b8fd14fe25ee0edd18c44bab4 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 13 Aug 2024 15:31:43 +0200 Subject: [PATCH] Fix and test Shape Construct Queries --- src/helpers/queries.js | 82 +++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/helpers/queries.js b/src/helpers/queries.js index adea8a4..b03cb29 100644 --- a/src/helpers/queries.js +++ b/src/helpers/queries.js @@ -14,30 +14,30 @@ function getShapeQuery4Target (targetClassIri) { CONSTRUCT { ?node_s ?node_p ?node_o . ?prop_s ?prop_p ?prop_o . - ?s sh:in ?list . + ?prop_s sh:in ?list . ?elt rdf:rest ?rest . ?elt rdf:first ?val . } WHERE { - GRAPH ?g { { - ?node_s sh:targetClass <${targetClassIri}> . - ?node_s ?node_p ?node_o . - ?prop_s ?prop_p ?prop_o . - FILTER(?prop_p != sh:in) - FILTER(?node_o = ?prop_s) + { + ?node_s sh:targetClass <${targetClassIri}> . + ?node_s ?node_p ?node_o . + ?prop_s ?prop_p ?prop_o . + FILTER(?prop_p != sh:in) + FILTER(?node_o = ?prop_s) + } + UNION + { + ?node_s sh:targetClass <${targetClassIri}> . + ?node_s ?node_p ?node_o . + ?prop_s ?prop_p ?prop_o . + ?prop_s sh:in ?list . + ?list rdf:rest* ?elt . + ?elt rdf:rest ?rest . + ?elt rdf:first ?val . + FILTER(?node_o = ?prop_s) + } } - UNION - { - ?node_s sh:targetClass <${targetClassIri}> . - ?node_s ?node_p ?node_o . - ?prop_s ?prop_p ?prop_o . - ?prop_s sh:in ?list . - ?list rdf:rest* ?elt . - ?elt rdf:rest ?rest . - ?elt rdf:first ?val . - FILTER(?node_o = ?prop_s) - } - } }` } @@ -52,33 +52,33 @@ function getShapeQuery4Instance (instanceIri) { CONSTRUCT { ?node_s ?node_p ?node_o . ?prop_s ?prop_p ?prop_o . - ?node_s ?p ?o . - ?s sh:in ?list . + #?node_s ?p ?o . + ?prop_s sh:in ?list . ?elt rdf:rest ?rest . ?elt rdf:first ?val . } WHERE { - GRAPH ?g { - <${instanceIri}> rdf:type ?class . - ?node_s ?p ?o . { - ?node_s sh:targetClass ?class . - ?node_s ?node_p ?node_o . - ?prop_s ?prop_p ?prop_o . - FILTER(?prop_p != sh:in) - FILTER(?node_o = ?prop_s) + <${instanceIri}> rdf:type ?class . + #?node_s ?p ?o . + { + ?node_s sh:targetClass ?class . + ?node_s ?node_p ?node_o . + ?prop_s ?prop_p ?prop_o . + FILTER(?prop_p != sh:in) + FILTER(?node_o = ?prop_s) + } + UNION + { + ?node_s rdf:type ?class . + ?node_s ?node_p ?node_o . + ?prop_s ?prop_p ?prop_o . + ?prop_s sh:in ?list . + ?list rdf:rest* ?elt . + ?elt rdf:rest ?rest . + ?elt rdf:first ?val . + FILTER(?node_o = ?prop_s) + } } - UNION - { - ?node_s rdf:type ?class . - ?node_s ?node_p ?node_o . - ?prop_s ?prop_p ?prop_o . - ?prop_s sh:in ?list . - ?list rdf:rest* ?elt . - ?elt rdf:rest ?rest . - ?elt rdf:first ?val . - FILTER(?node_o = ?prop_s) - } - } }` }