query-1d95c0fb1e603c74b593aff38779b1e4

rq turtle/ttl

Maintenance query

Bands which musicians (has part of P527) are not members (P463) of this band

SELECT ?band ?bandLabel ?musician ?musicianLabel WHERE { VALUES ?land { wd:Q1005 wd:Q1041 wd:Q912 wd:Q965 wd:Q117 wd:Q945 wd:Q962 wd:Q1008 wd:Q1006 wd:Q1044 wd:Q1007 wd:Q1014 } # Westafrica (changy to whatever country you want) VALUES ?b { wdt:P740 wdt:P495 wdt:P27 } ?band wdt:P31/wdt:P279* wd:Q215380; ?b ?land; wdt:P527 ?musician. MINUS { ?musician wdt:P463 ?band. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

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#>
# Maintenance query
# Bands which musicians (has part of P527) are not members (P463) of this band
SELECT ?band ?bandLabel ?musician ?musicianLabel WHERE {
  VALUES ?land { wd:Q1005 wd:Q1041 wd:Q912 wd:Q965 wd:Q117 wd:Q945 wd:Q962 wd:Q1008 wd:Q1006 wd:Q1044 wd:Q1007 wd:Q1014 }  # Westafrica (changy to whatever country you want)
  VALUES ?b { wdt:P740 wdt:P495 wdt:P27 }
  ?band wdt:P31/wdt:P279* wd:Q215380;
        ?b ?land;
        wdt:P527 ?musician. 
  MINUS { ?musician wdt:P463 ?band. } 
  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; v2("?b") v3("?band"):::projected v1("?land") v4("?musician"):::projected a1((" ")) c7(["bd:serviceParam"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q215380"]):::iri bind0[/VALUES ?land/] bind0-->v1 bind00(["wd:Q1005"]) bind00 --> bind0 bind01(["wd:Q1041"]) bind01 --> bind0 bind02(["wd:Q912"]) bind02 --> bind0 bind03(["wd:Q965"]) bind03 --> bind0 bind04(["wd:Q117"]) bind04 --> bind0 bind05(["wd:Q945"]) bind05 --> bind0 bind06(["wd:Q962"]) bind06 --> bind0 bind07(["wd:Q1008"]) bind07 --> bind0 bind08(["wd:Q1006"]) bind08 --> bind0 bind09(["wd:Q1044"]) bind09 --> bind0 bind010(["wd:Q1007"]) bind010 --> bind0 bind011(["wd:Q1014"]) bind011 --> bind0 bind1[/VALUES ?b/] bind1-->v2 bind10(["wdt:P740"]) bind10 --> bind1 bind11(["wdt:P495"]) bind11 --> bind1 bind12(["wdt:P27"]) bind12 --> bind1 v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v3 -->v2--> v1 v3 --"wdt:P527"--> v4 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v4 --"wdt:P463"--> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end