[Pellet-users] bug listing RDFTypes

Evren Sirin evren at clarkparsia.com
Fri Mar 30 21:11:57 UTC 2007


On 3/30/07 5:02 PM, Benjamin Good wrote:
> Great news, always glad to hear I'm not crazy. 
>
> I tried your fix, but it produced the same result  - see below for new 
> file defining a troublemaking individual.  There are still unnamed 
> restriction classes in the main ontology, could these be causing the 
> problem?
No, what I meant was not to give names to restrictions but create 
owl:Class'es with explicit equivalentClass properties to the 
restrictions. Here is what it should look like:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:daml="http://www.daml.org/2001/03/daml+oil#" >
  <owl:Class rdf:ID="C0">
  <owl:equivalentClass>
    <owl:cardinality 
rdf:datatype="http://www.w3.org/2001/XMLSchema#int">3</owl:cardinality>
    <owl:onProperty 
rdf:resource="http://www.owl-ontologies.com/unnamed.owl#containsDomainIPR009065ORIPR001478"/>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Restriction"/>
    </owl:equivalentClass>
  </owl:Class>
  <owl:Class rdf:ID="C1">
    <owl:equivalentClass>
    <owl:cardinality 
rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1</owl:cardinality>
    <owl:onProperty 
rdf:resource="http://www.owl-ontologies.com/unnamed.owl#containsDomainIPR000998ORIPR003961ORIPR008957ORIPR003595ORIPR007110"/>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Restriction"/>
    </owl:equivalentClass>
  </owl:Class>
  <rdf:Description 
rdf:about="http://www.owl-ontologies.com/unnamed.owl#rand9">
    <rdf:type rdf:resource="#C0"/>
    <rdf:type rdf:resource="#C2"/>
    <rdf:type rdf:resource="#C1"/>
    <rdf:type rdf:resource="#C3"/>
  </rdf:Description>
  <owl:Class rdf:ID="C2">
    <owl:equivalentClass>
    <owl:cardinality 
rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1</owl:cardinality>
    <owl:onProperty 
rdf:resource="http://www.owl-ontologies.com/unnamed.owl#containsDomainIPR000242"/>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Restriction"/>
    </owl:equivalentClass>
  </owl:Class>
  <owl:Class rdf:ID="C3">
    <owl:equivalentClass>
    <owl:cardinality 
rdf:datatype="http://www.w3.org/2001/XMLSchema#int">2</owl:cardinality>
    <owl:onProperty 
rdf:resource="http://www.owl-ontologies.com/unnamed.owl#containsDomainIPR000980"/>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Restriction"/>
    </owl:equivalentClass>
  </owl:Class>
</rdf:RDF>

I've put the code you sent in a loop of 1000 iterations and it worked 
fine with this file.

Cheers,
Evren
>
> thanks for your help - and for keeping Pellet public
> -Ben
>
>
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>     xmlns:owl="http://www.w3.org/2002/07/owl#"
>     xmlns:daml="http://www.daml.org/2001/03/daml+oil#"
>     xmlns:j.0="http://www.owl-ontologies.com/unnamed.owl#" > 
>   <rdf:Description 
> rdf:about="http://www.owl-ontologies.com/unnamed.owl#rand9GenRcontainsDomainIPR003961ORIPR008957">
>     <owl:cardinality 
> rdf:datatype="http://www.w3.org/2001/XMLSchema#int">2</owl:cardinality>
>     <owl:onProperty 
> rdf:resource="http://www.owl-ontologies.com/unnamed.owl#containsDomainIPR003961ORIPR008957"/>
>     <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Restriction"/>
>   </rdf:Description>
>   <rdf:Description 
> rdf:about="http://www.owl-ontologies.com/unnamed.owl#rand9GenRcontainsDomainIPR001071">
>     <owl:cardinality 
> rdf:datatype="http://www.w3.org/2001/XMLSchema#int">3</owl:cardinality>
>     <owl:onProperty 
> rdf:resource="http://www.owl-ontologies.com/unnamed.owl#containsDomainIPR001071"/>
>     <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Restriction"/>
>   </rdf:Description>
>   <rdf:Description 
> rdf:about="http://www.owl-ontologies.com/unnamed.owl#rand9">
>     <rdf:type 
> rdf:resource="http://www.owl-ontologies.com/unnamed.owl#rand9GenRcontainsDomainIPR001071"/>
>     <rdf:type 
> rdf:resource="http://www.owl-ontologies.com/unnamed.owl#rand9GenRcontainsDomainIPR003961ORIPR008957"/>
>   </rdf:Description>
> </rdf:RDF>
>
>
>  
>
>
> On Mar 30, 2007, at 1:30 PM, Evren Sirin wrote:
>
>> On 3/30/07 2:59 PM, Benjamin Good wrote:
>>> Dear Pellet people,
>>>
>>>   I've noticed what appears to me to be a bug in Pellet1.4 (latest 
>>> from svn).
>>>
>>>  Using the files attached and the code below, I ~sometimes  get a 
>>> NullPointerException from the jena method ListRDFTypes .  The fun 
>>> part is that if I run exactly the same test program repeatedly, 
>>> sometimes it works and sometimes it throws the exception.
>> Yes, this is a bug and it depends on which order the statements are 
>> added to the KB. The internal hash tables change the order so that is 
>> why the code sometimes works.
>>
>> I will fix this bug but meanwhile you can get rid of the problem by 
>> editing the OWL file. The problem would go away if the individual in 
>> exceptions-listing-types.owl had rdf:type values that are only named 
>> classes, i.e. [x rdf:type C], [C equivalentClass ...restriction...].
>>
>> Regards,
>> Evren
>>>
>>>  Any advice appreciated
>>>
>>> -Ben
>>>
>>>  
>>>
>>>
>>> package org.icapture.ontology.evaluation;
>>>
>>> import org.mindswap.pellet.jena.PelletReasonerFactory;
>>>
>>> import com.hp.hpl.jena.ontology.Individual;
>>> import com.hp.hpl.jena.ontology.OntModel;
>>> import com.hp.hpl.jena.ontology.OntModelSpec;
>>> import com.hp.hpl.jena.rdf.model.ModelFactory;
>>> import com.hp.hpl.jena.rdf.model.Resource;
>>> import com.hp.hpl.jena.util.iterator.ExtendedIterator;
>>>
>>> public class BugCheck {
>>>
>>> /**
>>> * @param args
>>> */
>>> public static void main(String[] args) {
>>>
>>> OntModelSpec init = new OntModelSpec(PelletReasonerFactory.THE_SPEC);
>>> OntModel m = ModelFactory.createOntologyModel(init);
>>>
>>>
>>> m.read("file:ontologies/phosphabase-no-QCRS-Ben2.owl");
>>> m.read("file:ontologies/exception-listing-types.owl");
>>>
>>> Individual classified = 
>>> m.getIndividual("http://www.owl-ontologies.com/unnamed.owl#rand9");
>>> //add all the type info to the original Ind
>>> try{
>>> ExtendedIterator r = classified.listRDFTypes(true);
>>> }catch(NullPointerException e){
>>> e.printStackTrace();
>>> }
>>>
>>>
>>> }
>>>
>>> }
>>>
>>> java.lang.NullPointerException
>>> at org.mindswap.pellet.Individual.isRedundantMin(Individual.java:406)
>>> at org.mindswap.pellet.Individual.addType(Individual.java:273)
>>> at org.mindswap.pellet.Individual.addType(Individual.java:262)
>>> at org.mindswap.pellet.ABox.addType(ABox.java:1633)
>>> at org.mindswap.pellet.KnowledgeBase.addType(KnowledgeBase.java:401)
>>> at org.mindswap.pellet.jena.OWLLoader.processTypes(OWLLoader.java:1182)
>>> at org.mindswap.pellet.jena.OWLLoader.load(OWLLoader.java:1985)
>>> at org.mindswap.pellet.jena.OWLReasoner.load(OWLReasoner.java:180)
>>> at 
>>> org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:248)
>>> at 
>>> org.mindswap.pellet.jena.PelletInfGraph.findWithContinuation(PelletInfGraph.java:198)
>>> at 
>>> com.hp.hpl.jena.reasoner.BaseInfGraph.graphBaseFind(BaseInfGraph.java:344)
>>> at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:246)
>>> at 
>>> com.hp.hpl.jena.rdf.model.impl.ModelCom.listStatements(ModelCom.java:379)
>>> at 
>>> com.hp.hpl.jena.rdf.model.impl.ModelCom.listStatements(ModelCom.java:384)
>>> at 
>>> com.hp.hpl.jena.ontology.impl.OntResourceImpl.listDirectPropertyValues(OntResourceImpl.java:1452)
>>> at 
>>> com.hp.hpl.jena.ontology.impl.OntResourceImpl.listRDFTypes(OntResourceImpl.java:796)
>>> at org.icapture.ontology.evaluation.BugCheck.main(BugCheck.java:28)
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Pellet-users mailing list
>>> Pellet-users at lists.owldl.com <mailto:Pellet-users at lists.owldl.com>
>>> http://lists.owldl.com/mailman/listinfo/pellet-users
>>> _______________________________________________
>>>
>>> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
>>
>



More information about the Pellet-users mailing list