void-generator

count_distinct_iri_subjects

rq turtle/ttl

Count the number of distinct IRIs used in the subject position of triples in the default graph

Use at


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