void-generator

count_distinct_bnode_objects_in_a_graph

rq turtle/ttl

Count the number of distinct bnodes used in the object position of triples in a named graph (prebind)

Use at


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