query-0a0c7f50f62158b62ff958f5fff3708a
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?person ?personLabel ?personDescription
(GROUP_CONCAT(DISTINCT ?nationality_label ;separator=', ') AS ?nationalities)
WHERE{
{
SELECT DISTINCT ?person ?cnt ?nationality_label WHERE{
?person wdt:P31 wd:Q5 . #eliminates fictional people
?person wdt:P106 wd:Q901; #selects occupation (apparently using wdt:P106/wdt:P279* instead of wdt:106 causes a time-out)
wikibase:sitelinks ?cnt .
OPTIONAL {
?person wdt:P27 ?nationality .
?nationality rdfs:label ?nationality_label FILTER (lang(?nationality_label) = "en") .
}
} ORDER BY DESC(?cnt)
LIMIT 500
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
GROUP BY ?person ?personLabel ?personDescription
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?cnt")
v5("?nationalities")
v4("?nationality")
v2("?nationality_label"):::projected
v3("?person"):::projected
c10(["bd:serviceParam"]):::iri
c5(["wd:Q901"]):::iri
c3(["wd:Q5"]):::iri
c1(["en"]):::literal
v3 --"wdt:P31"--> c3
v3 --"wdt:P106"--> c5
v3 --"wikibase:sitelinks"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P27".-> v4
v4 --"rdfs:label"--> v2
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c1
end
bind1[/"?nationality_label"/]
v2 --o bind1
bind1 --as--o v5