// 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;
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.