diff --git a/src/sparql/tree.ts b/src/sparql/tree.ts index 5c12524a2e31e712370c1771c8749fab2fdf9240..0fe89a24cfe23c1b0f7b6d135bb0190fa8af2393 100644 --- a/src/sparql/tree.ts +++ b/src/sparql/tree.ts @@ -59,21 +59,24 @@ export const getTreeNodesFromParentNodeURI = async (parentNodeUri: string, auth? return await executeSparqlConstruct<OcTreeNode>( ` - CONSTRUCT { + CONSTRUCT { + <${parentNodeUri}> ?p ?o. + ?node ?p2 ?o2. + ?node oct:graph ?g. + } + WHERE { + { + VALUES ?p { dcat:catalog dcat:dataset dcat:distribution dct:title dct:identifier rdf:type } <${parentNodeUri}> ?p ?o. - ?node ?p2 ?o2. - ?node oct:graph ?g. - } - WHERE { - VALUES ?p { dcat:catalog dcat:dataset dcat:distribution dct:title dct:identifier rdf:type } - VALUES ?p2 { dcat:catalog dcat:dataset dcat:distribution dct:title dct:identifier rdf:type } - <${parentNodeUri}> ?p ?o. - <${parentNodeUri}> (dcat:catalog|dcat:dataset|dcat:distribution){0,1} ?node. - ?node ?p2 ?o2 + } UNION { + VALUES ?p2 { dcat:catalog dcat:dataset dcat:distribution dct:title dct:identifier rdf:type } + <${parentNodeUri}> (dcat:catalog|dcat:dataset|dcat:distribution){0,1} ?node. + ?node ?p2 ?o2 . GRAPH ?g { - ?node dct:identifier ?id + ?node dct:identifier ?id } } + } `, { context,