query-da647db1c50bd4a7830d60d518978fe3

rq turtle/ttl

All singer and bands originated from Africa SELECT DISTINCT ?musicians ?musiciansLabel ?landLabel ?geb ?img

# get all singer and bands WITH { SELECT ?musicians WHERE { { ?musicians wdt:P31 wd:Q5; wdt:P106 wd:Q177220. } UNION { ?musicians wdt:P31/wdt:P279* wd:Q215380. } } } AS %m

# take the ones, which are born or started in africa WITH {
SELECT ?musicians ?land ?geb WHERE { INCLUDE %m VALUES ?t { wdt:P571 wdt:P569 } VALUES ?p { wdt:P19 wdt:P740 } ?musicians ?t ?geb. ?musicians ?p [ wdt:P17 ?land ].
?land wdt:P30 wd:Q15. }
} AS %results

WHERE { INCLUDE %results. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr". } } LIMIT 3000

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#>
# All singer and bands originated from Africa
SELECT DISTINCT ?musicians ?musiciansLabel ?landLabel ?geb ?img

  # get all singer and bands

  # take the ones, which are born or started in africa

  WHERE {
     {   
       SELECT ?musicians ?land ?geb WHERE {
           { 
    SELECT ?musicians WHERE {
      { ?musicians wdt:P31 wd:Q5; 
                   wdt:P106 wd:Q177220.
      }
       UNION
      { ?musicians wdt:P31/wdt:P279* wd:Q215380. }
    }
  }          VALUES ?t { wdt:P571 wdt:P569 }
          VALUES ?p { wdt:P19 wdt:P740 }
          ?musicians ?t ?geb.
          ?musicians ?p [ wdt:P17 ?land ].  
          ?land wdt:P30 wd:Q15.
        }    
  }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr". }
 }
LIMIT 3000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?geb"):::projected v5("?land") v1("?musicians"):::projected v3("?p") v2("?t") a1((" ")) a2((" ")) c13(["#91;AUTO_LANGUAGE#93;,en,fr"]):::literal c9(["wd:Q15"]):::iri c6(["wd:Q215380"]):::iri c11(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c4(["wd:Q177220"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c6 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c2 v1 --"wdt:P106"--> c4 end union0r <== or ==> union0l end bind0[/VALUES ?t/] bind0-->v2 bind00(["wdt:P571"]) bind00 --> bind0 bind01(["wdt:P569"]) bind01 --> bind0 bind1[/VALUES ?p/] bind1-->v3 bind10(["wdt:P19"]) bind10 --> bind1 bind11(["wdt:P740"]) bind11 --> bind1 v1 -->v2--> v4 a2 --"wdt:P17"--> v5 v1 -->v3--> a2 v5 --"wdt:P30"--> c9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end