Reputation: 11
in version 3.0.0, since inferred triples are added into an actual graph (not into the default as before), is it somehow possible to export/fetch an actual graph without the inferred triples? Thanks a lot.
Upvotes: 1
Views: 162
Reputation: 22053
Yes, this is possible.
You can retrieve the statements from named graph http://example.org/graph1
in several ways. Showing two alternatives here:
IRI graph1 = valueFactory.createIRI("http://example.org/graph1");
try(RepositoryConnection conn = repository.getConnection()) {
// option 1: getStatements of everything in a named graph, setting
// includeInferred to false
RepositoryResult<Statement> result = conn.getStatement(null, null, null, false, graph1);
// option 2: using export with an RDFHandler (export never includes inferred triples)
RDFHandler collector = new StatementCollector();
conn.export(graph1, collector);
}
The simplest way to do this in the workbench is to use a SPARQL CONSTRUCT query:
construct from <http://example.org/graph1> where { ?s ?p ?o }
Make sure that the "include inferred statements" option is unchecked before hitting 'Execute'. Then on the query result screen, pick your preferred download format, and hit 'Download'.
Upvotes: 0