GraphServiceExample.ttl
type: Ontology
default namespace: http://extensionsamples.topbraid.org/services/graphserviceexample#
imports: dash

Graph Statistics
type: GraphService
js: // Here we switch to the graph without owl:imports let baseGraph = dataset.withoutImports(graph.dataGraphURI); let localTripleCount = graph.withDataGraph(baseGraph, () => { return graph.triples().length; }) // Construct the response JSON object let response = { localTripleCount: localTripleCount, totalTripleCount: graph.triples().length, } // As usual, the last expression becomes the overall result response;
response content type: application/json
comment: Produces a JSON structure with the number of triples in the graph. You can try this service from the Web Services section on the Reports tab.