Updated Branches: refs/heads/develop c7cb76dfc -> b3d6d78f0
added test for listing justifications in full reasoning, since in practice there seem to be problems; test shows nothing, though Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/b3d6d78f Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/b3d6d78f Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/b3d6d78f Branch: refs/heads/develop Commit: b3d6d78f0ce955ee92b49e3195e600b81e983ff0 Parents: c7cb76d Author: Sebastian Schaffert <[email protected]> Authored: Thu May 23 11:35:04 2013 +0200 Committer: Sebastian Schaffert <[email protected]> Committed: Thu May 23 11:35:04 2013 +0200 ---------------------------------------------------------------------- .../reasoner/test/engine/ReasoningEngineTest.java | 26 ++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/b3d6d78f/libraries/kiwi/kiwi-reasoner/src/test/java/org/apache/marmotta/kiwi/reasoner/test/engine/ReasoningEngineTest.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-reasoner/src/test/java/org/apache/marmotta/kiwi/reasoner/test/engine/ReasoningEngineTest.java b/libraries/kiwi/kiwi-reasoner/src/test/java/org/apache/marmotta/kiwi/reasoner/test/engine/ReasoningEngineTest.java index af6bc81..9d1e50b 100644 --- a/libraries/kiwi/kiwi-reasoner/src/test/java/org/apache/marmotta/kiwi/reasoner/test/engine/ReasoningEngineTest.java +++ b/libraries/kiwi/kiwi-reasoner/src/test/java/org/apache/marmotta/kiwi/reasoner/test/engine/ReasoningEngineTest.java @@ -17,6 +17,7 @@ */ package org.apache.marmotta.kiwi.reasoner.test.engine; +import info.aduna.iteration.CloseableIteration; import info.aduna.iteration.Iterations; import org.apache.marmotta.kiwi.model.rdf.KiWiTriple; import org.apache.marmotta.kiwi.persistence.KiWiDialect; @@ -51,16 +52,19 @@ import org.openrdf.model.Statement; import org.openrdf.model.URI; import org.openrdf.repository.Repository; import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.RepositoryResult; import org.openrdf.repository.sail.SailRepository; import org.openrdf.rio.RDFFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.sql.SQLException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import static org.hamcrest.Matchers.hasItem; +import static org.junit.Assert.fail; /** * This test verifies the functionality of the KiWi Reasonong Engine. Based on a small sample program, it will test @@ -72,7 +76,7 @@ import static org.hamcrest.Matchers.hasItem; * <ul> * <li>PostgreSQL: * <ul> - * <li>postgresql.url, e.g. jdbc:postgresql://localhost:5433/kiwitest?prepareThreshold=3</li> + * <li>c</li> * <li>postgresql.user (default: lmf)</li> * <li>postgresql.pass (default: lmf)</li> * </ul> @@ -469,6 +473,26 @@ public class ReasoningEngineTest { Assert.assertTrue("expected inferred triple not found", con.hasStatement(b,t,d,true)); Assert.assertTrue("expected inferred triple not found", con.hasStatement(b,s,a,true)); + + // we also expect that there are justifications for all inferred triples + Resource[][] patterns = new Resource[][] { + new Resource[] { a, t, c }, + new Resource[] { b, t, d }, + new Resource[] { b, s, a } + }; + + + RepositoryResult<Statement> result = con.getStatements(null,null,null,true, con.getValueFactory().createURI(store.getInferredContext())); + if(result.hasNext()) { + while (result.hasNext()) { + Statement stmt1 = result.next(); + + CloseableIteration<Justification, SQLException> justs1 = rcon.listJustificationsForTriple((KiWiTriple) stmt1); + Assert.assertTrue(justs1.hasNext()); + } + } else { + fail("no inferred statements found"); + } con.commit(); } finally { con.close();
