jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/2] jena git commit: Deterministic testcase for JENA-1260
Date Wed, 16 Nov 2016 22:06:01 GMT
Repository: jena
Updated Branches:
  refs/heads/master 0ced905fb -> d033b3d5b


Deterministic testcase for JENA-1260


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/05fffa6c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/05fffa6c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/05fffa6c

Branch: refs/heads/master
Commit: 05fffa6ce38a7c946352f05b8515691f1afc1684
Parents: 0ced905
Author: der <dave@epimorphics.com>
Authored: Wed Nov 16 14:37:52 2016 +0000
Committer: der <dave@epimorphics.com>
Committed: Wed Nov 16 15:55:26 2016 +0000

----------------------------------------------------------------------
 .../jena/reasoner/test/TestReasoners.java       | 67 ++++++++++++++++----
 1 file changed, 56 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/05fffa6c/jena-core/src/test/java/org/apache/jena/reasoner/test/TestReasoners.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/reasoner/test/TestReasoners.java b/jena-core/src/test/java/org/apache/jena/reasoner/test/TestReasoners.java
index 7e544b7..96119fd 100644
--- a/jena-core/src/test/java/org/apache/jena/reasoner/test/TestReasoners.java
+++ b/jena-core/src/test/java/org/apache/jena/reasoner/test/TestReasoners.java
@@ -18,26 +18,46 @@
 
 package org.apache.jena.reasoner.test;
 
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.jena.graph.* ;
-import org.apache.jena.ontology.* ;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.reasoner.* ;
+import org.apache.jena.graph.Factory;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.ontology.OntClass;
+import org.apache.jena.ontology.OntModel;
+import org.apache.jena.ontology.OntModelSpec;
+import org.apache.jena.rdf.model.InfModel;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.rdf.model.NodeIterator;
+import org.apache.jena.rdf.model.Property;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.ResIterator;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.rdf.model.ResourceFactory;
+import org.apache.jena.rdf.model.StmtIterator;
+import org.apache.jena.reasoner.InfGraph;
+import org.apache.jena.reasoner.Reasoner;
+import org.apache.jena.reasoner.ReasonerFactory;
+import org.apache.jena.reasoner.ReasonerRegistry;
 import org.apache.jena.reasoner.rulesys.RDFSRuleReasonerFactory ;
-import org.apache.jena.reasoner.transitiveReasoner.* ;
+import org.apache.jena.reasoner.transitiveReasoner.TransitiveReasoner;
+import org.apache.jena.reasoner.transitiveReasoner.TransitiveReasonerFactory;
 import org.apache.jena.util.FileManager ;
 import org.apache.jena.util.PrintUtil ;
-import org.apache.jena.vocabulary.* ;
+import org.apache.jena.vocabulary.RDF;
+import org.apache.jena.vocabulary.RDFS;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
 
 /**
- * Outline unit tests for initial experimental reasoners
+ * Test cases for transitive reasoner (includes some early RDFS reasoner checks)
  */
 public class TestReasoners extends TestCase {
     
@@ -222,7 +242,6 @@ public class TestReasoners extends TestCase {
         Node q = NodeFactory.createURI("q");
         Node sC = RDFS.subClassOf.asNode();
         Node sP = RDFS.subPropertyOf.asNode();
-        Node ty = RDF.type.asNode();
         data.add( new Triple(c2, sC, c3));
         data.add( new Triple(c1, p, c2));
         Reasoner reasoner = rf.create(null);
@@ -333,6 +352,32 @@ public class TestReasoners extends TestCase {
     }
     
     /**
+     * Test that two transitive engines are independent.
+     * See JENA-1260
+     */
+    public void testTransitiveEngineSeparation() throws InterruptedException {
+        String NS = "http://example.com/test#";
+
+        Property sp = ResourceFactory.createProperty(NS, "sp");
+        Property  p = ResourceFactory.createProperty(NS, "p");
+        Property  s = ResourceFactory.createProperty(NS, "s");
+        Resource  q = ResourceFactory.createProperty(NS, "q");
+        Reasoner reasoner = ReasonerRegistry.getTransitiveReasoner();
+        
+        InfModel simple = ModelFactory.createInfModel(reasoner, ModelFactory.createDefaultModel());
+        simple.add(s, sp, p);
+        assertFalse( simple.contains(s, RDFS.subPropertyOf, p) );
+        
+        InfModel withSP = ModelFactory.createInfModel(reasoner, ModelFactory.createDefaultModel());
+        withSP.add(sp, RDFS.subPropertyOf, RDFS.subPropertyOf);
+        withSP.add(s, sp, p);
+        assertTrue( withSP.contains(s, RDFS.subPropertyOf, p) );
+
+        simple.add(q, sp, p);
+        assertFalse( simple.contains(q, RDFS.subPropertyOf, p) );
+    }
+        
+    /**
      * Test rebind operation for the RDFS reasoner
      */
     public void testRDFSRebind() {


Mime
View raw message