query-9feb556eb419d778b57d564a3c6d6c72
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 bd: <http://www.bigdata.com/rdf#>
#TEMPLATE={ "template": "Composers of ?city and their compositions by tonality", "variables": { "?city": { "query": "SELECT ?id WHERE { ?composition wdt:P86 ?composer; wdt:P826 ?tonality. ?composer wdt:P19|wdt:P20|wdt:P551 ?id. } GROUP BY ?id ?idLabel ORDER BY DESC(COUNT(DISTINCT ?composer))" } } }
#defaultView:Tree
SELECT ?composer ?composerLabel ?composerImage ?tonality ?tonalityLabel ?composition ?compositionLabel WHERE {
BIND(wd:Q1741 AS ?city)
?composer wdt:P31 wd:Q5;
wdt:P19|wdt:P20|wdt:P551 ?city.
OPTIONAL { ?composer wdt:P18 ?composerImage. }
?composition wdt:P86 ?composer;
wdt:P826 ?tonality.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de-at,de". }
}
ORDER BY ?composerLabel ?tonalityLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?city")
v4("?composer"):::projected
v5("?composerImage"):::projected
v1("?composerLabel"):::projected
v6("?composition"):::projected
v7("?tonality"):::projected
v2("?tonalityLabel"):::projected
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,de-at,de"]):::literal
c2(["wd:Q5"]):::iri
bind0[/"'wd:Q1741'"/]
bind0 --as--o v3
v4 --"wdt:P31"--> c2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P551"--> v3
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P20"--> v3
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P19"--> v3
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P18".-> v5
end
v6 --"wdt:P86"--> v4
v6 --"wdt:P826"--> v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end