private Model explainTriple(final Triple triple) { final Graph explanation = explain(triple); return explanation == null ? null : ModelFactory.createModelForGraph(explanation); }
@Override public void testExplanations(final OWLAxiom axiom, final int max, final Set<Set<OWLAxiom>> expectedExplanations) throws Exception { Triple triple = null; if (axiom != null) { final Graph graph = convertOntology(singletonList(axiom), true); // We can only explain single triple inference through Jena. Instead of making // this a failure we just tune the tests where single triples are explained. // OWLAPI implementation should run all tests. // assertTrue( "Multiple triples not supported", graph.size() == 1 ); assumeTrue(graph.size() == 1); triple = graph.find(Triple.ANY).next(); } final Graph actual = triple == null ? _openllet.explainInconsistency().getGraph() : _openllet.explain(triple); assertNotNull("Triple " + triple + "cannot be explained", actual); final boolean success = testExplanationWithJena(triple, actual, expectedExplanations); assertTrue("Error in explanation, see the _logger file for details", success); }
private Model explainTriple(final Triple triple) { final Graph explanation = explain(triple); return explanation == null ? null : ModelFactory.createModelForGraph(explanation); }
private Model explainTriple(final Triple triple) { final Graph explanation = explain(triple); return explanation == null ? null : ModelFactory.createModelForGraph(explanation); }
/** * Test for ticket #478 */ @Test public void testJenaUpdates() { final Resource A = ResourceFactory.createResource("A"); final Resource B = ResourceFactory.createResource("B"); final Resource C = ResourceFactory.createResource("C"); final Resource i = ResourceFactory.createResource("i"); final OntModel model = ModelFactory.createOntologyModel(openllet.jena.PelletReasonerFactory.THE_SPEC); model.add(i, RDF.type, A); model.add(A, RDFS.subClassOf, B); model.prepare(); Model actual = ((PelletInfGraph) model.getGraph()).explain(i, RDF.type, B); Model expected = model.getRawModel(); assertEquals(expected.listStatements().toSet(), actual.listStatements().toSet()); model.add(B, RDFS.subClassOf, C); model.prepare(); actual = ((PelletInfGraph) model.getGraph()).explain(i, RDF.type, C); expected = model.getRawModel(); assertEquals(expected.listStatements().toSet(), actual.listStatements().toSet()); }