query-c100af78374e2ccb24194b4b0de408c3
Same results as before, but with museums ordered before objects. SELECT DISTINCT ?result ?resultLabel WHERE { { ?museum wdt:P31/wdt:P279 wd:Q33506; wdt:P17 wd:Q40. } UNION { ?museum wdt:P31/wdt:P279 wd:Q33506; wdt:P17 wd:Q40. ?object wdt:P276 ?museum. } BIND (COALESCE(?object, ?museum) AS ?result) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de,en". } } ORDER BY ?object
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 bd: <http://www.bigdata.com/rdf#>
# Same results as before, but with museums ordered before objects.
SELECT DISTINCT ?result ?resultLabel WHERE
{
{
?museum wdt:P31/wdt:P279* wd:Q33506;
wdt:P17 wd:Q40.
}
UNION
{
?museum wdt:P31/wdt:P279* wd:Q33506;
wdt:P17 wd:Q40.
?object wdt:P276 ?museum.
}
BIND (COALESCE(?object, ?museum) AS ?result)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de,en". }
}
ORDER BY ?object
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?museum")
v1("?object")
v3("?result"):::projected
a1((" "))
a2((" "))
c3(["wd:Q33506"]):::iri
c8(["bd:serviceParam"]):::iri
c5(["wd:Q40"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,de,en"]):::literal
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c3
v2 --"wdt:P17"--> c5
v1 --"wdt:P276"--> v2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v2 --"wdt:P17"--> c5
end
union0r <== or ==> union0l
end
bind0[/"?object?museum"/]
v1 --o bind0
v2 --o bind0
bind0 --as--o v3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end