query-f3bde2f7e4e1983ddd276ff7f099a5af
Same results as before, but with museums ordered before objects. SELECT DISTINCT ?result ?resultLabel WHERE { { ?result wdt:P31/wdt:P279 wd:Q33506; wdt:P17 wd:Q40. VALUES ?order { 1 } } UNION { ?museum wdt:P31/wdt:P279 wd:Q33506; wdt:P17 wd:Q40. ?result wdt:P276 ?museum. VALUES ?order { 2 } } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de,en". } } ORDER BY ?order
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
{
{
?result wdt:P31/wdt:P279* wd:Q33506;
wdt:P17 wd:Q40.
VALUES ?order { 1 }
}
UNION
{
?museum wdt:P31/wdt:P279* wd:Q33506;
wdt:P17 wd:Q40.
?result wdt:P276 ?museum.
VALUES ?order { 2 }
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de,en". }
}
ORDER BY ?order
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?museum")
v4("?order")
v2("?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;
v3 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c3
v3 --"wdt:P17"--> c5
v2 --"wdt:P276"--> v3
bind0[/VALUES ?order/]
bind0-->v4
bind00(["2^^xsd:integer"])
bind00 --> bind0
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v2 --"wdt:P17"--> c5
bind1[/VALUES ?order/]
bind1-->v4
bind10(["1^^xsd:integer"])
bind10 --> bind1
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end