void-generator

count_distinct_objects

rq turtle/ttl

Count the number of distinct IRIs used in the object position of triples in graphs

Use at


SELECT
  (COUNT(DISTINCT ?object) AS ?objects)
WHERE {
  GRAPH ?graph {
    ?subject ?predicate ?object .
  }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?graph")
  v3("?object"):::projected 
  v5("?objects")
  v2("?predicate")
  v1("?subject")
  v1 -->v2--> v3
  bind1[/"count(?object)"/]
  v3 --o bind1
  bind1 --as--o v5