query-184634882b976a5e7fa2b83b76d84672

rq turtle/ttl

Mjgi2000

Use at

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#>
SELECT DISTINCT ?composer ?composerLabel ?Los_Angeles ?New_York
WHERE
{
  VALUES ?residence { wd:Q65 wd:Q60 } # Los Angeles, New York
  ?composer wdt:P31 wd:Q5 . # ?composer is human
  ?composer wdt:P106 / wdt:P279 * wd:Q36834 . # ?composer is composer
  ?composer wdt:P551 / wdt:P131 * ?residence .
  BIND (IF (?residence = wd:Q65, "Los Angeles", "") AS ?Los_Angeles)
  BIND (IF (?residence = wd:Q60, "New York", "") AS ?New_York)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?Los_Angeles"):::projected v4("?New_York"):::projected v2("?composer"):::projected v1("?residence") a1((" ")) a2((" ")) c9(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q36834"]):::iri bind0[/VALUES ?residence/] bind0-->v1 bind00(["wd:Q65"]) bind00 --> bind0 bind01(["wd:Q60"]) bind01 --> bind0 v2 --"wdt:P31"--> c2 v2 --"wdt:P106"--> a1 a1 --"wdt:P279"--> c5 v2 --"wdt:P551"--> a2 a2 --"wdt:P131"--> v1 bind1[/"if(?residence = 'wd:Q65','Los Angeles','')"/] v1 --o bind1 bind1 --as--o v3 bind2[/"if(?residence = 'wd:Q60','New York','')"/] v1 --o bind2 bind2 --as--o v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end