query-dd1a1e4a443be7bf873026ab8e5a5dce
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 schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?personaLabel ?genderLabel ?occupazioneLabel (YEAR(?dob) AS ?anno) ?pobLabel ?coord ?articolo WHERE {
{
SELECT DISTINCT ?persona ?dob WHERE {
?persona wdt:P1412 wd:Q652; # All records with Italian as spoken language
wdt:P27 wd:Q38; # with Italian citizenship
wdt:P31 wd:Q5. # that are human
FILTER EXISTS { ?persona wdt:P569 ?data_nascita. } # that have a date of birth field
FILTER NOT EXISTS { ?persona wdt:P570 ?data_morte. } # that don"t have a date of death field
# that has at least a sitelink in Wikipedia of any language
?articolo schema:about ?persona.
FILTER (SUBSTR(str(?articolo), 16, 5) = "pedia").
# only people with age minus that 110 (in order to avoid results with undefined or inconsistent birth year)
?persona wdt:P569 ?dob. # fetch date of birth data value
BIND(YEAR(now()) - YEAR(?dob) as ?age)
FILTER(?age <= 110)
}
}
?persona wdt:P21 ?gender; # fetch gender data value
wdt:P106 ?occupazione; # fetch occupation data value
wdt:P19 ?pob . # fetch place of birth data value
?pob wdt:P625 ?coord . # specify place of birth coordinates
# with element label in Italian or in English
SERVICE wikibase:label { bd:serviceParam wikibase:language "it,en". }
} ORDER BY ?personaLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?age")
v12("?anno")
v3("?articolo"):::projected
v11("?coord"):::projected
v5("?data_morte")
v6("?data_nascita")
v7("?dob"):::projected
v8("?gender")
v9("?occupazione")
v4("?persona")
v1("?personaLabel"):::projected
v10("?pob")
c10(["wd:Q38"]):::iri
c8(["wd:Q652"]):::iri
c19(["bd:serviceParam"]):::iri
c21(["it,en"]):::literal
c12(["wd:Q5"]):::iri
f0[["?age <= '110^^xsd:integer'"]]
f0 --> v8
f1[["substring(str(?articolo),'16^^xsd:integer','5^^xsd:integer') = 'pedia'"]]
f1 --> v3
f2[["not "]]
subgraph f2e0["Exists Clause"]
e0v1 --"wdt:P570"--> e0v2
e0v2("?data_morte"):::projected
e0v1("?persona"):::projected
end
f2--EXISTS--> f2e0
f2 --> v4
f2 --> c5
f2 --> v5
v4 --"wdt:P570"--> v5
f3[[" "]]
subgraph f3e1["Exists Clause"]
e1v1 --"wdt:P569"--> e1v2
e1v2("?data_nascita"):::projected
e1v1("?persona"):::projected
end
f3--EXISTS--> f3e1
f3 --> v4
f3 --> c6
f3 --> v6
v4 --"wdt:P569"--> v6
v4 --"wdt:P1412"--> c8
v4 --"wdt:P27"--> c10
v4 --"wdt:P31"--> c12
v3 --"schema:about"--> v4
v4 --"wdt:P569"--> v7
bind4[/"year-from-dateTime(NOW()) - year-from-dateTime(?dob)"/]
v7 --o bind4
bind4 --as--o v8
v4 --"wdt:P21"--> v8
v4 --"wdt:P106"--> v9
v4 --"wdt:P19"--> v10
v10 --"wdt:P625"--> v11
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c19 --"wikibase:language"--> c21
end
bind5[/"year-from-dateTime(?dob)"/]
v7 --o bind5
bind5 --as--o v12