query-a65474e1941e8d9a31efdf3da01b7daa
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (count(?colour) as ?count) WHERE {
?item wdt:P31 wd:Q39715 . #instance of lighthouse
?item wdt:P17 wd:Q34 . #country of Sweden
?item wdt:P462 ?colour . #must have a colour
OPTIONAL {?item p:P462 ?mem . #item has a colour
?mem ps:P462 ?colour2; pq:P518 ?qual . } # colour has a P518 qualifier
FILTER(!BOUND(?qual)) # qualifier is null
SERVICE wikibase:label { bd:serviceParam wikibase:language "se,en,fr,nl,de,it,es". }
}
group by ?item ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?colour"):::projected
v5("?colour2")
v6("?count")
v2("?item"):::projected
v4("?mem")
v1("?qual")
c10(["bd:serviceParam"]):::iri
c2(["wd:Q39715"]):::iri
c12(["se,en,fr,nl,de,it,es"]):::literal
c4(["wd:Q34"]):::iri
f0[["not bound(?qual)"]]
f0 --> v1
v2 --"p:direct/P31"--> c2
v2 --"p:direct/P17"--> c4
v2 --"p:direct/P462"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:P462".-> v4
v4 --"p:statement/P462"--> v5
v4 --"p:qualifier/P518"--> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
bind2[/"count(?colour)"/]
v3 --o bind2
bind2 --as--o v6