query-8e079623140626be9f667c30fad4d051
Count of items related to places in Odisha (Q22048 )
SELECT ?p ?pLabel (COUNT(DISTINCT ?item) as ?ct) (SAMPLE(?item) as ?sample) (SAMPLE(?itemLabel) as ?sampleLabel)
WITH
{
SELECT ?place { ?place wdt:P131* wd:Q22048 }
} as %inc
WHERE
{
INCLUDE %inc
hint:Query hint:optimizer "None".
?item ?wdt ?place .
?p wikibase:directClaim ?wdt .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?p rdfs:label ?pLabel }
}
GROUP BY ?p ?pLabel
ORDER BY DESC(?ct)
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#>
#Count of items related to places in Odisha (Q22048 )
SELECT ?p ?pLabel (COUNT(DISTINCT ?item) as ?ct) (SAMPLE(?item) as ?sample) (SAMPLE(?itemLabel) as ?sampleLabel)
WHERE
{
{
SELECT ?place { ?place wdt:P131* wd:Q22048 }
}
?item ?wdt ?place .
?p wikibase:directClaim ?wdt .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?p rdfs:label ?pLabel }
}
GROUP BY ?p ?pLabel
ORDER BY DESC(?ct)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?ct")
v3("?item"):::projected
v7("?itemLabel"):::projected
v5("?p"):::projected
v6("?pLabel"):::projected
v2("?place")
v8("?sample")
v9("?sampleLabel")
v4("?wdt")
c5(["bd:serviceParam"]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2(["wd:Q22048"]):::iri
v2 --"wdt:P131"--> c2
v3 -->v4--> v2
v5 --"wikibase:directClaim"--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
v5 --"rdfs:label"--> v6
end
bind3[/"count(?item)"/]
v3 --o bind3
bind3 --as--o v8
bind4[/"sample(?item)"/]
v3 --o bind4
bind4 --as--o v8
bind5[/"sample(?itemLabel)"/]
v7 --o bind5
bind5 --as--o v9