[Pellet-users] exception when I add a second individual

Fani eserral at dsic.upv.es
Thu Jul 17 16:30:25 UTC 2008


Hi All,
I'm  using Pellet-1.5 and OWLAPI in order to add individuals to an ontology with this swrl rule : currentPosition(?x, ?y)  ?  mobility(?y, ?z) ->WhereCanGo(?x, ?z). This rule find out where a person can go.
I don't have problems when I add a Person individual and add to the ontology the inferred axioms, but when I add another Person individual the following exception is produced: 

17-jul-2008 18:10:10 org.coode.owl.rdfxml.parser.OWLRDFConsumer endModel
INFO: Total number of triples: 86

17-jul-2008 18:10:10 org.coode.owl.rdfxml.parser.OWLRDFConsumer endModel

INFO: Loaded http://www.oomethod.com/pervml.owl

Exception in thread "main" java.lang.NullPointerException
at org.mindswap.pellet.ABox.getObjectPropertyValues(ABox.java:1264)
at 
org.mindswap.pellet.KnowledgeBase.getObjectPropertyValues(KnowledgeBase.java:3149)
at 
org.mindswap.pellet.owlapi.Reasoner.getRelatedIndividuals(Reasoner.java:682)
at 
org.mindswap.pellet.owlapi.Reasoner.getObjectPropertyRelationships(Reasoner.java:527)
at 
org.semanticweb.owl.util.InferredPropertyAssertionGenerator.addAxioms(InferredPropertyAssertionGenerator.java:44)
at 
org.semanticweb.owl.util.InferredPropertyAssertionGenerator.addAxioms(InferredPropertyAssertionGenerator.java:39)
at 
org.semanticweb.owl.util.InferredEntityAxiomGenerator.createAxioms(InferredEntityAxiomGenerator.java:51)
at 
org.semanticweb.owl.util.InferredOntologyGenerator.fillOntology(InferredOntologyGenerator.java:120)
at 
axiomsInference.EjecucionReglas_inicial.executeRules(EjecucionReglas_inicial.java:145)
at 
axiomsInference.EjecucionReglas_inicial.main(EjecucionReglas_inicial.java:56)


Can Anyone help me?
I've attached my first ontology (ontology_location_person.owl) and the 
ontology that I've obtained when I've added the first individual 
(ontology_with_an_individual_added.owl).

Thanks in advance.

Regards,
Fani

The code that I use to add the person individual and add the inferred 
axioms is the following:
    ...
    // Now create the new individual assertion axiom
            OWLIndividual 
newInd=factory.getOWLIndividual(URI.create("http://www.oomethod.com/pervml.owl#pepe"));
            OWLDescription 
person=factory.getOWLClass(URI.create("http://www.oomethod.com/pervml.owl#Person"));
            OWLClassAssertionAxiom  assertion = 
factory.getOWLClassAssertionAxiom(newInd, person);
         // Finally, add the axiom to our ontology and save
           AddAxiom addAxiomChange = new AddAxiom(ontology, assertion);
          
        // Now instanciate an object property from the new individual 
and add the axiom to our ontology
           OWLObjectProperty currentPosition= 
factory.getOWLObjectProperty(URI.create("http://www.oomethod.com/pervml.owl#currentPosition"));
           OWLIndividual 
kitchen=factory.getOWLIndividual(URI.create("http://www.oomethod.com/pervml.owl#Kitchen"));
          
           OWLObjectPropertyAssertionAxiom  assertion2= 
factory.getOWLObjectPropertyAssertionAxiom(newInd, currentPosition, 
kitchen);
           AddAxiom addAxiomChange2 = new AddAxiom(ontology, assertion2);
          
        // Now instanciate the name from the new individual and add the 
axiom to our ontology
           OWLDataProperty name= 
factory.getOWLDataProperty(URI.create("http://www.oomethod.com/pervml.owl#name"));
           OWLDataType strin= 
factory.getOWLDataType(URI.create("http://www.w3.org/2001/XMLSchema#string"));
           OWLConstant cons=factory.getOWLTypedConstant("pepe", strin); 
//El string indica el tipo de la constante
          
           OWLDataPropertyAssertionAxiom  assertion3= 
factory.getOWLDataPropertyAssertionAxiom(newInd, name, cons);
           AddAxiom addAxiomChange3 = new AddAxiom(ontology, assertion3);
         
         
           manager.applyChange(addAxiomChange);
           manager.applyChange(addAxiomChange2);
           manager.applyChange(addAxiomChange3);
           reasoner.refresh();
           reasoner.classify();
          
           ///INFERRED AXIOMS
           try {
              
                List gens = new ArrayList();
              
                gens.add(new InferredClassAssertionAxiomGenerator());
                gens.add(new InferredPropertyAssertionGenerator());
                OWLOntology infOnt = 
manager.createOntology(URI.create(ontology.getURI() + "_inferred"));

                InferredOntologyGenerator iog = new 
InferredOntologyGenerator(reasoner, gens);
                iog.fillOntology(manager, ontology); //HERE THE 
EXCEPTION IS PRODUCED
           
                 manager.saveOntology(ontology, 
URI.create(absolutePath);        
            }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ontology_location_person.owl
Type: text/xml
Size: 7447 bytes
Desc: not available
Url : http://lists.owldl.com/pipermail/pellet-users/attachments/20080717/5e6acee8/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ontology_with_an_individual_added.owl
Type: text/xml
Size: 8565 bytes
Desc: not available
Url : http://lists.owldl.com/pipermail/pellet-users/attachments/20080717/5e6acee8/attachment-0003.bin 


More information about the Pellet-users mailing list