query-b73359bc50fc203fb8b86c648d0b7412

rq turtle/ttl

Query about property domainHi there, I am trying to build kind a strange Query about an arbitrary property, e.g. P610 (highest point) for my bachelor thesis. For this property I would like to get all classes (?class) where an instance having this property P610 exists. (?s wdt:P610 ?o . ?s wdt:P31/wdt:P279* ?class .) But together with all classes ?class I would like to get the count of existing instances having P610 and the total amount of instances belonging to ?class. So far I just got the classes together with the quantity of existing entities having P610. Query:

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?class (COUNT(?s) AS ?count)
WHERE {
  ?s wdt:P610 ?o .
  ?s wdt:P31/wdt:P279* ?class
}
GROUP BY ?class

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?class"):::projected v4("?count") v2("?o") v1("?s"):::projected a1((" ")) v1 --"wdt:P610"--> v2 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> v3 bind1[/"count(?s)"/] v1 --o bind1 bind1 --as--o v4