Open jakubklimek opened 3 years ago
The label query does not use the "GRAPH" pattern. Therefore, publisher labels are searched for in cartesian products of many named graphs - the publisher name is present in each dataset graph in out endpoints. https://github.com/linkedpipes/dcat-ap-viewer/blob/5aab9c1233a914a369dabf6504265e0a834346f0/server/sparql-provider/sparql-query.js#L425
Therefore, we need to add option to enclose the WHERE clause in GRAPH {} like this:
PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX dcterms: <http://purl.org/dc/terms/> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> CONSTRUCT { <https://data.gov.cz/zdroj/ovm/MinFin> ?predicate ?object } WHERE { GRAPH ?g { <https://data.gov.cz/zdroj/ovm/MinFin> ?predicate ?object . OPTIONAL { <https://data.gov.cz/zdroj/ovm/MinFin> ?predicate ?label_primary . FILTER(LANG(?label_primary) = "cs") } OPTIONAL { <https://data.gov.cz/zdroj/ovm/MinFin> ?predicate ?label_secondary . FILTER(LANG(?label_secondary) = "en") } } BIND( COALESCE(?label_primary, ?label_secondary) as ?label ) VALUES ( ?predicate ) { ( foaf:name ) ( skos:prefLabel ) ( dcterms:title ) ( rdfs:label ) } }
The createLabelSparql method now utilize GRAPH to enclose the content of the query in case of datasetPerGraph set to true.
createLabelSparql
GRAPH
datasetPerGraph
The label query does not use the "GRAPH" pattern. Therefore, publisher labels are searched for in cartesian products of many named graphs - the publisher name is present in each dataset graph in out endpoints. https://github.com/linkedpipes/dcat-ap-viewer/blob/5aab9c1233a914a369dabf6504265e0a834346f0/server/sparql-provider/sparql-query.js#L425
Therefore, we need to add option to enclose the WHERE clause in GRAPH {} like this: