query-6e95306adb6c9d0db5d6b8a4d43f67f9
- Simply , thank you SOOO much! We are very close to get exactly what I'm looking for, and I'm sure that other Wikimedians will love that query. Jklamo, Matěj Suchánek Guys... I changed few this to target creators, artists, etc. But it's getting an heavy query! Now the last thing, is to merge "occupations" and "countries" to avoid redundant items. Anyone can show me how, or pointing another query that use this "function"?
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#>
SELECT ?item ?itemLabel ?genderLabel ?occupationLabel ?countryLabel ?death {
?item wdt:P31 wd:Q5;
wdt:P21 ?gender;
wdt:P106 ?occupation;
wdt:P27 ?country;
wdt:P570 ?death .
VALUES ?occupation { wd:Q483501 wd:Q36834 wd:Q639669 wd:Q753110 wd:Q488205 wd:Q49757 wd:Q4964182 wd:Q1281618 wd:Q36180 wd:Q482980 wd:Q1028181 wd:Q6625963 wd:Q28389 wd:Q1930187 wd:Q33999 wd:Q3282637 wd:Q81096 wd:Q201788 wd:Q18939491 wd:Q486748 wd:Q3658608 wd:Q214917 wd:Q11774202 wd:Q205375 } . #occupation: composer, poet, sculptor, writer, artist, painter
VALUES ?country { wd:Q16 wd:Q142 wd:Q39 wd:Q31 } . #countries: Canada, France, Switzerland, Belgium. Remove this line to get worldwide.
FILTER( YEAR( ?death ) = 1967 ) .
OPTIONAL { ?item wdt:P27 ?country } .
FILTER( BOUND( ?country ) ) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en,ru,el,es,fa" } .
} ORDER BY ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?country")
v3("?death"):::projected
v5("?gender")
v4("?item"):::projected
v1("?itemLabel"):::projected
v7("?occupation")
c11(["fr,en,ru,el,es,fa"]):::literal
c9(["bd:serviceParam"]):::iri
c3(["wd:Q5"]):::iri
f0[["bound(?country)"]]
f0 --> v7
f1[["year-from-dateTime(?death) = '1967^^xsd:integer'"]]
f1 --> v3
v4 --"wdt:P31"--> c3
v4 --"wdt:P21"--> v5
v4 --"wdt:P106"--> v7
v4 --"wdt:P27"--> v7
v4 --"wdt:P570"--> v3
bind2[/VALUES ?occupation/]
bind2-->v7
bind20(["wd:Q483501"])
bind20 --> bind2
bind21(["wd:Q36834"])
bind21 --> bind2
bind22(["wd:Q639669"])
bind22 --> bind2
bind23(["wd:Q753110"])
bind23 --> bind2
bind24(["wd:Q488205"])
bind24 --> bind2
bind25(["wd:Q49757"])
bind25 --> bind2
bind26(["wd:Q4964182"])
bind26 --> bind2
bind27(["wd:Q1281618"])
bind27 --> bind2
bind28(["wd:Q36180"])
bind28 --> bind2
bind29(["wd:Q482980"])
bind29 --> bind2
bind210(["wd:Q1028181"])
bind210 --> bind2
bind211(["wd:Q6625963"])
bind211 --> bind2
bind212(["wd:Q28389"])
bind212 --> bind2
bind213(["wd:Q1930187"])
bind213 --> bind2
bind214(["wd:Q33999"])
bind214 --> bind2
bind215(["wd:Q3282637"])
bind215 --> bind2
bind216(["wd:Q81096"])
bind216 --> bind2
bind217(["wd:Q201788"])
bind217 --> bind2
bind218(["wd:Q18939491"])
bind218 --> bind2
bind219(["wd:Q486748"])
bind219 --> bind2
bind220(["wd:Q3658608"])
bind220 --> bind2
bind221(["wd:Q214917"])
bind221 --> bind2
bind222(["wd:Q11774202"])
bind222 --> bind2
bind223(["wd:Q205375"])
bind223 --> bind2
bind3[/VALUES ?country/]
bind3-->v7
bind30(["wd:Q16"])
bind30 --> bind3
bind31(["wd:Q142"])
bind31 --> bind3
bind32(["wd:Q39"])
bind32 --> bind3
bind33(["wd:Q31"])
bind33 --> bind3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P27".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end