query-11a4c37700d0a3625765457be6da7f16
Categories per mort de llocs de Turquia i nombre d'articles SELECT DISTINCT ?lloc ?llocLabel ?cat ?categoria (COUNT(?persona) AS ?totpers) WHERE { ?persona wdt:P20 ?lloc. ?lloc wdt:P17 wd:Q43. ?art schema:about ?persona. ?art schema:isPartOf https://ca.wikipedia.org/. OPTIONAL { ?lloc wdt:P1465 ?cat. OPTIONAL { ?categoria schema:about ?cat. ?categoria schema:isPartOf https://ca.wikipedia.org/. } } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } } GROUP BY ?lloc ?cat ?llocLabel ?categoria ORDER BY DESC(?totpers) ?llocLabel
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#>
# Categories per mort de llocs de Turquia i nombre d'articles
SELECT DISTINCT ?lloc ?llocLabel ?cat ?categoria (COUNT(?persona) AS ?totpers)
WHERE {
?persona wdt:P20 ?lloc.
?lloc wdt:P17 wd:Q43.
?art schema:about ?persona.
?art schema:isPartOf <https://ca.wikipedia.org/>.
OPTIONAL {
?lloc wdt:P1465 ?cat.
OPTIONAL {
?categoria schema:about ?cat.
?categoria schema:isPartOf <https://ca.wikipedia.org/>.
}
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . }
}
GROUP BY ?lloc ?cat ?llocLabel ?categoria
ORDER BY DESC(?totpers) ?llocLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?art")
v6("?cat"):::projected
v7("?categoria"):::projected
v4("?lloc"):::projected
v2("?llocLabel"):::projected
v3("?persona"):::projected
v8("?totpers")
c9(["bd:serviceParam"]):::iri
c3(["wd:Q43"]):::iri
c6([https://ca.wikipedia.org/]):::iri
c11(["#91;AUTO_LANGUAGE#93;,ca,en,es"]):::literal
v3 --"wdt:P20"--> v4
v4 --"wdt:P17"--> c3
v5 --"schema:about"--> v3
v5 --"schema:isPartOf"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P1465".-> v6
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v7 -."schema:about".-> v6
v7 --"schema:isPartOf"--> c6
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind1[/"count(?persona)"/]
v3 --o bind1
bind1 --as--o v8