Count the number of distinct IRIs used in the object position of triples in graphs
SELECT
(COUNT(DISTINCT ?s) AS ?subjects)
(COUNT(DISTINCT ?o) AS ?objects)
WHERE {
GRAPH ?graph {
?s ?p ?o .
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?graph")
v3("?o"):::projected
v6("?objects")
v2("?p")
v1("?s"):::projected
v5("?subjects")
v1 -->v2--> v3
bind2[/"count(?s)"/]
v1 --o bind2
bind2 --as--o v5
bind3[/"count(?o)"/]
v3 --o bind3
bind3 --as--o v6