SnapshotStorageConnectorWithInference extends SnapshotStorageConnector implements InferredStorageConnector { @Override public List<Statement> findWithInference(Resource subject, Property property, RDFNode value, String context) { ensureTransactionalState(); if (context != null) { return storage.getNamedGraph(context).listStatements(subject, property, value).toList(); } else { return storage.getDefaultGraph().listStatements(subject, property, value).toList(); } } SnapshotStorageConnectorWithInference(AbstractStorageConnector centralConnector,
                                          Map<String, String> reasonerConfig); @Override List<Statement> find(Resource subject, Property property, RDFNode value, String context); @Override boolean contains(Resource subject, Property property, RDFNode value, String context); @Override List<Statement> findWithInference(Resource subject, Property property, RDFNode value, String context); @Override boolean containsWithInference(Resource subject, Property property, RDFNode value, String context); @Override boolean isConsistent(String context);  }
@Test public void findWithInferenceReturnsStatementsIncludingInferredKnowledge() throws Exception { generateTestData(null); connector.begin(); final Collection<Statement> result = connector.findWithInference(createResource(SUBJECT), RDF.type, null, null); assertEquals(2, result.size()); assertTrue(result.stream().anyMatch(s -> s.getObject().equals(createResource(TYPE_TWO)))); }
@Test public void findWithInferenceInContextReturnsStatementsIncludingInferredKnowledge() throws Exception { generateTestData(NAMED_GRAPH); connector.begin(); final Collection<Statement> result = connector.findWithInference(createResource(SUBJECT), RDF.type, null, NAMED_GRAPH); assertEquals(2, result.size()); assertTrue(result.stream().anyMatch(s -> s.getObject().equals(createResource(TYPE_TWO)))); }