I have an RDF graph and I want to count how many times the skos:broader object property is actually used. Is there a simple (and ideally efficient) SPARQL query I can use for that?
Asked
Active
Viewed 807 times
-1
-
5And what did you try? Did you look at aggregate functions in SPARQL? The obvious query would be `SELECT (COUNT(*) as ?cnt) {?s skos:broader ?o }` , but I don't know what you haven't be able to write this simple query by yourself. Efficiency is limited by the triple store, clearly a `pso` index could be used + counting – UninformedUser Jun 24 '18 at 14:43
-
Thank you, that does indeed answer my question! To be honest, I was writing a much more complex `COUNT` query that did not run efficiently and missed the obvious one. – Janothan Jun 25 '18 at 08:14
-
Does this answer your question? [SPARQL query and distinct count](https://stackoverflow.com/questions/1223472/sparql-query-and-distinct-count) – logi-kal Dec 12 '22 at 14:35
1 Answers
1
Trivially simple answer:
SELECT (COUNT(*) as ?cnt)
WHERE { ?s skos:broader ?o }

TallTed
- 9,069
- 2
- 22
- 37