jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r1179547 - in /incubator/jena/Jena2/jena/trunk/src: main/java/com/hp/hpl/jena/ontology/impl/OntResourceImpl.java test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java
Date Thu, 06 Oct 2011 09:24:22 GMT
Author: ijd
Date: Thu Oct  6 09:24:21 2011
New Revision: 1179547

URL: http://svn.apache.org/viewvc?rev=1179547&view=rev
Log:
JENA-3 Fix for problem of built-in resources appearing as results when doing OntModel.listIndividuals()
on an empty model with RDFS rule inferencing turned on

Modified:
    incubator/jena/Jena2/jena/trunk/src/main/java/com/hp/hpl/jena/ontology/impl/OntResourceImpl.java
    incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java

Modified: incubator/jena/Jena2/jena/trunk/src/main/java/com/hp/hpl/jena/ontology/impl/OntResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/src/main/java/com/hp/hpl/jena/ontology/impl/OntResourceImpl.java?rev=1179547&r1=1179546&r2=1179547&view=diff
==============================================================================
--- incubator/jena/Jena2/jena/trunk/src/main/java/com/hp/hpl/jena/ontology/impl/OntResourceImpl.java
(original)
+++ incubator/jena/Jena2/jena/trunk/src/main/java/com/hp/hpl/jena/ontology/impl/OntResourceImpl.java
Thu Oct  6 09:24:21 2011
@@ -1158,7 +1158,7 @@ public class OntResourceImpl
     public boolean isIndividual() {
         OntModel m = (getModel() instanceof OntModel) ? (OntModel) getModel() : null;
 
-        // can we use the reasoner's native abilities to do the isntance test?
+        // can we use the reasoner's native abilities to do the instance test?
         boolean useInf = false;
         useInf = m.getProfile().THING() != null &&
                  m.getReasoner() != null &&
@@ -1180,7 +1180,13 @@ public class OntResourceImpl
                         // if the type itself is OWL.Class or similar, we should ignore it
... this may
                         // arise in cases where the user has materialised results of inference
and is then
                         // accessing them from a plain model
-                        if (rType.equals( getProfile().CLASS() )) {
+                        // JENA-3: we also ignore if the type is rdfs:Resource or similar,
since it's not informative
+                        if (rType.equals( getProfile().CLASS() ) ||
+                            rType.equals( RDFS.Resource ) ||
+                            rType.equals( RDF.Property ) ||
+                            rType.equals( RDFS.Datatype ) ||
+                            rType.equals( RDF.List ))
+                        {
                             continue;
                         }
 

Modified: incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java?rev=1179547&r1=1179546&r2=1179547&view=diff
==============================================================================
--- incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java
(original)
+++ incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java
Thu Oct  6 09:24:21 2011
@@ -416,6 +416,17 @@ public class TestListSyntaxCategories
                 return r instanceof Individual;
             }
         },
+        new DoListTest( "empty OWL+RDFS rule list individuals (bug report JENA-3)",  null,
 OntModelSpec.RDFS_MEM_RDFS_INF,  0, new String[] {} )
+        {
+            @Override
+            public Iterator< ? extends Resource> doList( OntModel m ) {
+                return m.listIndividuals();
+            }
+            @Override
+            public boolean test( Resource r ) {
+                return r instanceof Individual;
+            }
+        },
         new DoListTest( "DAML list individuals",  "file:testing/ontology/daml/list-syntax/test.rdf",
 OntModelSpec.DAML_MEM_RULE_INF,  6,
                         new String[] {NS+"A0", NS+"A1", NS+"C0", NS+"a1", NS+"a2", NS+"a0"}
)
         {



Mime
View raw message