query-7be7e462232142b8d6930290ef78043a

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (GROUP_CONCAT(DISTINCT ?placeLabel; separator=", ") AS ?places) WHERE {
   {
  SELECT DISTINCT ?item ?birthPlace ?country {
    ?item wdt:P106 wd:Q4964182. # restrict to philosophers
    ?item wdt:P19 ?birthPlace . # get the birthplace
    ?birthPlace wdt:P131* ?country .
    OPTIONAL { ?country wdt:P131 ?upper } .
    FILTER( !BOUND( ?upper ) ) .
  } LIMIT 1000
}.
  ?birthPlace wdt:P131* ?place .
  ?place wdt:P131* ?country .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
    ?item rdfs:label ?itemLabel .
    ?place rdfs:label ?placeLabel .
  } .
} GROUP BY ?item ?itemLabel ?birthPlace ?country

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?birthPlace") v4("?country") v2("?item"):::projected v6("?itemLabel"):::projected v5("?place") v7("?placeLabel"):::projected v8("?places") v1("?upper") c2(["wd:Q4964182"]):::iri c6(["bd:serviceParam"]):::iri c8(["en"]):::literal f0[["not bound(?upper)"]] f0 --> v1 v2 --"wdt:P106"--> c2 v2 --"wdt:P19"--> v3 v3 --"wdt:P131"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P131".-> v1 end v3 --"wdt:P131"--> v5 v5 --"wdt:P131"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 v2 --"rdfs:label"--> v6 v5 --"rdfs:label"--> v7 end bind2[/"?placeLabel"/] v7 --o bind2 bind2 --as--o v8