query-0ea6b06d27c740737faa839ad35ae7cf
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?s ?desc ?dob ?dobvalue WHERE {
?s wdt:P31 wd:Q5. # must be human
?s p:P569/psv:P569 [wikibase:timePrecision ?precision; wikibase:timeValue ?birth] .
?s p:P569/ps:P569 ?dobvalue .
bind(if(?precision=11,?birth,if(?precision=10,concat(month(?birth)," ",year(?birth)),if(?precision<9,concat(STR(?birth),' precision=',STR(?precision)),year(?birth)))) as ?dob)
?s wdt:P19 ?place. # must have a place of birth
?place (wdt:P131*/wdt:P706*) wd:Q5705. # place of birth must be located within or on Catelonia
MINUS { ?s wdt:P570 _:b5. } # must be alive - no date of death
?s rdfs:label ?desc. # must have a label ...
FILTER((LANG(?desc)) = "ca") # label must be in Catalan
?article schema:about ?s. # must have a sitelink
?article schema:inLanguage "ca". # sitelink must be (by inference) to the Catalan wikipedia
FILTER((?birth > "1898-01-01"^^xsd:dat) && (?birth < "1918-01-01"^^xsd:dat)|| ?precision<9 )
}
GROUP BY ?s ?desc ?dob ?dobvalue # right now the group by serves no purpose whatsoever - there are to aggregates in the select
ORDER BY ?dobvalue
# LIMIT 100 # obvs, only give me 100 results
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?article")
v2("?birth")
v4("?desc"):::projected
v6("?dob"):::projected
v1("?dobvalue"):::projected
v7("?place")
v3("?precision")
v5("?s"):::projected
a5((" "))
a2((" "))
a1((" "))
a3((" "))
a4((" "))
c15(["wd:Q5705"]):::iri
c6(["wd:Q5"]):::iri
c4(["ca"]):::literal
f0[["(?birth > s1898-01-01^^<http://www.w3.org/2001/XMLSchema#dat>'?birth < s1918-01-01^^<http://www.w3.org/2001/XMLSchema#dat>' || ?precision < '9^^xsd:integer')"]]
f0 --> v2
f0 --> v3
f1[["?desc = 'ca'"]]
f1 --> v4
v5 --"p:direct/P31"--> c6
a1 --"wikibase:timePrecision"--> v3
a1 --"wikibase:timeValue"--> v2
v5 --"p:P569"--> a2
a2 --"p:statement/value/P569"--> a1
v5 --"p:P569"--> a3
a3 --"p:statement/P569"--> v1
bind2[/"if(?precision = '11^^xsd:integer',?birth,if(?precision = '10^^xsd:integer',concat(month-from-dateTime(?birth),' ',year-from-dateTime(?birth)),if(?precision < '9^^xsd:integer',concat(str(?birth),' precision=',str(?precision)),year-from-dateTime(?birth))))"/]
v3 --o bind2
v2 --o bind2
bind2 --as--o v6
v5 --"p:direct/P19"--> v7
v7 --"p:direct/P131"--> a4
a4 --"p:direct/P706"--> c15
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v5 --"p:direct/P570"--> a5
end
v5 --"rdfs:label"--> v4
v8 --"schema:about"--> v5
v8 --"schema:inLanguage"--> c4