Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] Exception in inference api

Soha Said sohaelshafey at yahoo.com
Wed Oct 13 15:09:40 PDT 2010


the trace is
java.lang.NullPointerException
        at org.semanticweb.HermiT.hierarchy.InstanceManager.getTypes(Unknown 
Source)
        at org.semanticweb.HermiT.Reasoner.getTypes(Unknown Source)
        at 
org.semanticweb.owlapi.util.InferredClassAssertionAxiomGenerator.addAxioms(InferredClassAssertionAxiomGenerator.java:46)

        at 
org.semanticweb.owlapi.util.InferredClassAssertionAxiomGenerator.addAxioms(InferredClassAssertionAxiomGenerator.java:42)

        at 
org.semanticweb.owlapi.util.InferredEntityAxiomGenerator.createAxioms(InferredEntityAxiomGenerator.java:49)

        at 
org.semanticweb.owlapi.util.InferredOntologyGenerator.fillOntology(InferredOntologyGenerator.java:111)

        at prototype.PrototypeFrame.InferredInstances(PrototypeFrame.java:898)
        at 
prototype.PrototypeFrame.BtnInferenceActionPerformed(PrototypeFrame.java:203)
        at prototype.PrototypeFrame.access$200(PrototypeFrame.java:36)
        at prototype.PrototypeFrame$4.actionPerformed(PrototypeFrame.java:98)
        at 
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at 
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at 
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at 
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at 
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)

        at java.awt.Component.processMouseEvent(Component.java:6263)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
        at java.awt.Component.processEvent(Component.java:6028)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at 
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
        at java.awt.Container.dispatchEventImpl(Container.java:2085)
        at java.awt.Window.dispatchEventImpl(Window.java:2478)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at 
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)

        at 
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

-------------------------------------------------------------------------
You still did not send the stack trace for your exception.  An example 
of a stack trace for an exception would be something like this:

    java.lang.ClassCastException:
    uk.ac.manchester.cs.owl.owlapi.OWLObjectAllValuesFromImpl cannot be cast
      to org.semanticweb.owlapi.model.OWLClass
      
atuk.ac.manchester.cs.owl.owlapi.OWLClassImpl.compareObjectOfSameType(OWLClassImpl.java:434)

      
at uk.ac.manchester.cs.owl.owlapi.OWLObjectImpl.compareTo(OWLObjectImpl.java:167)

      at 
uk.ac.manchester.cs.owl.owlapi.OWLObjectImpl.compareTo(OWLObjectImpl.java:41)
      at java.util.TreeMap.put(TreeMap.java:562)
      at java.util.TreeSet.add(TreeSet.java:255)
      
at uk.ac.manchester.cs.owl.owlapi.OWLClassImpl.getSuperClasses(OWLClassImpl.java:206)

      


Each line in such a trace provides some additional information for a 
developer to analyze.

I would say that the API is working because I have modified some code in 
Protege 4 recently that looks very much like what you are writing.  The 
code invoked by Protege 4.1 by File->Export Inferred Hierarchy is very 
similar to yours.

-Timothy


On 10/12/2010 09:28 AM, Soha Said wrote:
> Hello,
> I trace the error and I find the error in this line:
> InferredGenerator.add(new InferredClassAssertionAxiomGenerator());
> when I replced with this line:
> InferredGenerator.add(new InferredPropertyAssertionGenerator());
> it worked without error, but when I open the protege, the object 
> properties are not saved correctly.
> for example, each individual will have its object properties and 
> linked to the other individuals by TopObjectProperty like individual x 
> and y, and x has TopObjectProperty is y and vise versa.
> when i classify from the protege interface, it inferred the properties 
> correctly, but using api i think there is some problem.
>
> On 10/10/2010 07:06 AM, Soha Said wrote:
> > I used protege 4.1 beta build 209 api, and I have a problem in
> > inference api.
> > This is the snapshot of code that I used to get inferencing:
> > OWLOntologyManager 
> ontologymanager=OWLManager.createOWLOntologyManager();
> >            OWLOntology
> > ontology=ontologymanager.loadOntology(IRI.create(OwlUri));
> >            OWLDataFactory factory=ontologymanager.getOWLDataFactory();
> >            OWLReasonerFactory reasonerfactory= new
> > Reasoner.ReasonerFactory();
> >            OWLReasoner
> > owlreasoner=reasonerfactory.createNonBufferingReasoner(ontology);
> >
> > owlreasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
> >
> > List<InferredAxiomGenerator<? extends OWLAxiom>> InferredGenerator =
> > new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
> >            InferredGenerator.add(new
> > InferredClassAssertionAxiomGenerator());
> >            InferredOntologyGenerator ontologygenerator=new
> > InferredOntologyGenerator(owlreasoner,InferredGenerator);
> >            ontologygenerator.fillOntology(ontologymanager,ontology);
> >            ontologymanager.saveOntology(ontology,IRI.create(OwlUri));
> > but I have an exception in this line:
> > ontologygenerator.fillOntology(ontologymanager,ontology);
> > this exception says: java.lang.NullPointerException
> >  I don't know what i should do and what is wrong.
> > Thanks in advance
> > Soha Said
> >


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101013/92378869/attachment.html>


More information about the protege-discussion mailing list