Count triples in a graph, requires prebound graphs
SELECT
(COUNT(?p) AS ?count)
WHERE {
GRAPH ?graph {
?s ?p ?o
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?count")
v4("?graph")
v3("?o")
v2("?p"):::projected
v1("?s")
v1 -->v2--> v3
bind1[/"count(?p)"/]
v2 --o bind1
bind1 --as--o v5