query-a21135731cdb58656ef7c2d9888ea4b0
Rank of people born in the Basque Country
LIMIT to 2000 as Listeria can only handle up to 5000
SELECT ?item ?itemLabel ?yob ?yod (?stct + (?slct * 2) AS ?rank) WHERE { { SELECT ?item ?stct ?slct (YEAR(SAMPLE(?dob)) AS ?yob) (YEAR(SAMPLE(?dod)) AS ?yod) WHERE { ?item wdt:P31 wd:Q5; wdt:P19/wdt:P131*/^wdt:P527 wd:Q47588; wikibase:statements ?stct; wikibase:sitelinks ?slct . OPTIONAL { ?item wdt:P569 ?dob } . OPTIONAL { ?item wdt:P570 ?dod } . } GROUP BY ?item ?stct ?slct } . SERVICE wikibase:label { bd:serviceParam wikibase:language "eu" } . } ORDER BY DESC(?rank) ?item LIMIT 2000
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 bd: <http://www.bigdata.com/rdf#>
#Rank of people born in the Basque Country
#LIMIT to 2000 as Listeria can only handle up to 5000
SELECT ?item ?itemLabel ?yob ?yod (?stct + (?slct * 2) AS ?rank) WHERE {
{
SELECT ?item ?stct ?slct (YEAR(SAMPLE(?dob)) AS ?yob) (YEAR(SAMPLE(?dod)) AS ?yod) WHERE {
?item wdt:P31 wd:Q5;
wdt:P19/wdt:P131*/^wdt:P527 wd:Q47588;
wikibase:statements ?stct;
wikibase:sitelinks ?slct .
OPTIONAL { ?item wdt:P569 ?dob } .
OPTIONAL { ?item wdt:P570 ?dod } .
} GROUP BY ?item ?stct ?slct
} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "eu" } .
}
ORDER BY DESC(?rank) ?item
LIMIT 2000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?_anon_42b5416610844a34809f33a099ae9de1107074")
v8("?_anon_42b5416610844a34809f33a099ae9de1107075")
v5("?dob")
v6("?dod")
v2("?item"):::projected
v11("?rank")
v4("?slct"):::projected
v3("?stct"):::projected
v9("?yob"):::projected
v10("?yod"):::projected
a1((" "))
a2((" "))
c5(["wd:Q47588"]):::iri
c14(["eu"]):::literal
c12(["bd:serviceParam"]):::iri
c2(["wd:Q5"]):::iri
v2 --"wdt:P31"--> c2
v2 --"wdt:P19"--> a1
a1 --"wdt:P131"--> a2
c5 --"wdt:P527"--> a2
v2 --"wikibase:statements"--> v3
v2 --"wikibase:sitelinks"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P569".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P570".-> v6
end
bind2[/"sample(?dob)"/]
v5 --o bind2
bind2 --as--o v7
bind3[/"sample(?dod)"/]
v6 --o bind3
bind3 --as--o v8
bind4[/"year-from-dateTime()"/]
null --o bind4
bind4 --as--o v9
bind5[/"year-from-dateTime()"/]
null --o bind5
bind5 --as--o v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind6[/"?stct + ?slct * '2^^xsd:integer'"/]
v3 --o bind6
v4 --o bind6
bind6 --as--o v11