query-c8546ab0a1a819fcddbe8de4c7906914
Number of values of a property of each instanceHow to get the number of values of a property of an item? Take for example, I would like to know the number of official website for each instance of a programming language (wdt:P31/wdt:P279*). Somehow the following query is not correct.
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 ?lang (count(?website) as ?count)
WHERE {
?lang wdt:P31/wdt:P279* wd:Q9143.
?lang wdt:P856 ?website.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
GROUP BY ?lang
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?count")
v1("?lang"):::projected
v2("?website"):::projected
a1((" "))
c6(["bd:serviceParam"]):::iri
c3(["wd:Q9143"]):::iri
c8(["en"]):::literal
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v1 --"wdt:P856"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end
bind1[/"count(?website)"/]
v2 --o bind1
bind1 --as--o v3