Count the number of distinct bnodes used in the object position of triples in per named graph
SELECT
?graph (COUNT(DISTINCT ?subject) AS ?subjects)
WHERE {
GRAPH ?graph {
?subject ?predicate ?object .
FILTER(isBlank(?subject))
}
} GROUP BY ?graph
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?graph"):::projected
v3("?object")
v2("?predicate")
v1("?subject"):::projected
v5("?subjects")
f0[["isBlank(?subject)"]]
f0 --> v1
v1 -->v2--> v3
bind2[/"count(?subject)"/]
v1 --o bind2
bind2 --as--o v5