query-f1af8ce824b016da26edc93821331ebd
I've altered the filtering, now it correctly filters, but there are duplicate statements. Per nom_stmt it shows all P1411 claims for the item and not only the one connected to nom_stmt.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
SELECT ?item ?itemLabel ?nom ?nomLabel ?nom_stmt ?werk ?werklbl
{
?item wdt:P1411 ?nom .
?item p:P1411 ?nom_stmt
FILTER NOT EXISTS { ?nom_stmt pq:P585 ?x } .
OPTIONAL {?nom_stmt pq:P1686 ?werk . OPTIONAL {?werk rdfs:label ?werklbl filter (lang(?werklbl) = "nl") .} }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "nl,en" .
}
} ORDER BY ASC(?item)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v4("?nom"):::projected
v2("?nom_stmt"):::projected
v6("?werk"):::projected
v5("?werklbl"):::projected
v3("?x")
c8(["bd:serviceParam"]):::iri
c10(["nl,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:qualifier/P585"--> e0v2
e0v1("?nom_stmt"):::projected
e0v2("?x"):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> v3
v2 --"p:qualifier/P585"--> v3
v1 --"p:direct/P1411"--> v4
v1 --"p:P1411"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P1686".-> v6
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."rdfs:label".-> v5
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end