query-7e4888716a2597b374a0285703323237
humain né-e ou mort-e dans la Canton de Vaud
SELECT ?humain ?humainLabel ?lieuNaissanceLabel ?lieuMortLabel ?occ
WITH { SELECT ?humain (group_concat(?occupLabel;separator=", ") as ?occ) WHERE
{
?humain wdt:P31 wd:Q5.
optional {?humain wdt:P106 ?occup.
?occup rdfs:label ?occupLabel. filter(lang(?occupLabel)="fr")}
{?humain wdt:P19 ?lieuNaissance.
?lieuNaissance wdt:P131 wd:Q12771.}
UNION
{?humain wdt:P20 ?lieuMort.
?lieuMort wdt:P131 wd:Q12771.}
} group by ?humain } as %i
WHERE {include %i
OPTIONAL {?humain wdt:P19 ?lieuNaissance.}
OPTIONAL {?humain wdt:P20 ?lieuMort.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
} ORDER BY ?humainLabel
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#humain né-e ou mort-e dans la Canton de Vaud
SELECT ?humain ?humainLabel ?lieuNaissanceLabel ?lieuMortLabel ?occ
WHERE { { SELECT ?humain (group_concat(?occupLabel;separator=", ") as ?occ) WHERE
{
?humain wdt:P31 wd:Q5.
optional {?humain wdt:P106 ?occup.
?occup rdfs:label ?occupLabel. filter(lang(?occupLabel)="fr")}
{?humain wdt:P19 ?lieuNaissance.
?lieuNaissance wdt:P131 wd:Q12771.}
UNION
{?humain wdt:P20 ?lieuMort.
?lieuMort wdt:P131 wd:Q12771.}
} group by ?humain } OPTIONAL {?humain wdt:P19 ?lieuNaissance.}
OPTIONAL {?humain wdt:P20 ?lieuMort.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
} ORDER BY ?humainLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?humain"):::projected
v1("?humainLabel"):::projected
v6("?lieuMort")
v5("?lieuNaissance")
v7("?occ"):::projected
v4("?occup")
v2("?occupLabel")
c8(["wd:Q12771"]):::iri
c11(["bd:serviceParam"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,fr"]):::literal
c3(["wd:Q5"]):::iri
v3 --"wdt:P31"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P106".-> v4
v4 --"rdfs:label"--> v2
end
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P20"--> v6
v6 --"wdt:P131"--> c8
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P19"--> v5
v5 --"wdt:P131"--> c8
end
union0r <== or ==> union0l
end
bind1[/"?occupLabel"/]
v2 --o bind1
bind1 --as--o v7
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P19".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P20".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end