query-c81aac34a9a4bee48de685cff22a3d7f
of the two sets of colours. There are, for the example lighthous, three colours and the product thus consists of nine (3×3) rows of which three have an unbound ?qual. See the following query:en:Cartesian product what you get is the ?colour2 and ?colour: When you ask both for Tagishsimon@
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 ?colourLabel ?colour2Label ?qualLabel WHERE {
VALUES ?value {wd:Q40125473} FILTER(?item=?value)
# ?item wdt:P462 ?colour . #compare the results with this line commented and not commented
?item p:P462 ?mem . #item has a colour
?mem ps:P462 ?colour2 .
OPTIONAL { ?mem pq:P518 ?qual . } # colour has a P518 qualifier
# FILTER(!BOUND(?qual)) # qualifier is null
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,sv". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?colour2")
v1("?item"):::projected
v3("?mem")
v5("?qual")
v3("?value")
c5(["bd:serviceParam"]):::iri
c7(["en,sv"]):::literal
f0[["?item = ?value"]]
f0 --> v1
f0 --> v3
bind1[/VALUES ?value/]
bind1-->v3
bind10(["wd:Q40125473"])
bind10 --> bind1
v1 --"p:P462"--> v3
v3 --"p:statement/P462"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P518".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end