query-82040998e90c6fb6e64f98c7c525e0be
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 { ?item wdt:P19 ?pob. ?pob wdt:P131* ?parts. wd:Q47588 wdt:P527 ?parts. ?item wdt:P31 wd:Q5. ?item wikibase:statements ?stct. ?item wikibase:sitelinks ?slct. OPTIONAL { ?item wdt:P569 ?dob. BIND(YEAR(?dob) AS ?yob) } OPTIONAL { ?item wdt:P570 ?dod. BIND(YEAR(?dod) AS ?yod) } 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 {
?item wdt:P19 ?pob.
?pob wdt:P131* ?parts.
wd:Q47588 wdt:P527 ?parts.
?item wdt:P31 wd:Q5.
?item wikibase:statements ?stct.
?item wikibase:sitelinks ?slct.
OPTIONAL {
?item wdt:P569 ?dob.
BIND(YEAR(?dob) AS ?yob)
}
OPTIONAL {
?item wdt:P570 ?dod.
BIND(YEAR(?dod) AS ?yod)
}
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("?dob")
v9("?dod")
v2("?item"):::projected
v4("?parts")
v3("?pob")
v11("?rank")
v6("?slct"):::projected
v5("?stct"):::projected
v8("?yob"):::projected
v10("?yod"):::projected
c3(["wd:Q47588"]):::iri
c14(["eu"]):::literal
c12(["bd:serviceParam"]):::iri
c6(["wd:Q5"]):::iri
v2 --"wdt:P19"--> v3
v3 --"wdt:P131"--> v4
c3 --"wdt:P527"--> v4
v2 --"wdt:P31"--> c6
v2 --"wikibase:statements"--> v5
v2 --"wikibase:sitelinks"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P569".-> v7
bind0[/"year-from-dateTime(?dob)"/]
v7 --o bind0
bind0 --as--o v8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P570".-> v9
bind1[/"year-from-dateTime(?dod)"/]
v9 --o bind1
bind1 --as--o v10
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind2[/"?stct + ?slct * '2^^xsd:integer'"/]
v5 --o bind2
v6 --o bind2
bind2 --as--o v11