Search Mailing List Archives
[protege-discussion] Exception in inference api
Soha Said
sohaelshafey at yahoo.com
Wed Oct 13 15:34:15 PDT 2010
Why using inferrence api from java shows me TopObjectProperty and
TopDataProperty to each individual?
and
This is another the trace from protege when I use classify from reasoner menu
Error 2 Logged at Thu Oct 14 00:29:36 EET 2010
NullPointerException: null
org.semanticweb.HermiT.hierarchy.InstanceManager.getTypes(Unknown Source)
org.semanticweb.HermiT.Reasoner.getTypes(Unknown Source)
org.protege.editor.owl.ui.frame.individual.OWLClassAssertionAxiomTypeFrameSection$1.run(OWLClassAssertionAxiomTypeFrameSection.java:73)
org.protege.editor.owl.model.inference.ReasonerPreferences.executeTask(ReasonerPreferences.java:181)
org.protege.editor.owl.ui.frame.individual.OWLClassAssertionAxiomTypeFrameSection.refillInferred(OWLClassAssertionAxiomTypeFrameSection.java:70)
org.protege.editor.owl.ui.frame.AbstractOWLFrameSection.setRootObject(AbstractOWLFrameSection.java:232)
org.protege.editor.owl.ui.frame.AbstractOWLFrame.refill(AbstractOWLFrame.java:94)
org.protege.editor.owl.ui.frame.AbstractOWLFrame.setRootObject(AbstractOWLFrame.java:86)
org.protege.editor.owl.ui.framelist.OWLFrameList.setRootObject(OWLFrameList.java:349)
org.protege.editor.owl.ui.view.individual.OWLIndividualDescriptionViewComponent.updateView(OWLIndividualDescriptionViewComponent.java:41)
org.protege.editor.owl.ui.view.individual.AbstractOWLIndividualViewComponent.updateView(AbstractOWLIndividualViewComponent.java:41)
org.protege.editor.owl.ui.view.individual.AbstractOWLIndividualViewComponent.updateView(AbstractOWLIndividualViewComponent.java:17)
org.protege.editor.owl.ui.view.AbstractOWLSelectionViewComponent.updateViewContentAndHeader(AbstractOWLSelectionViewComponent.java:194)
org.protege.editor.owl.ui.view.AbstractOWLSelectionViewComponent$1.selectionChanged(AbstractOWLSelectionViewComponent.java:72)
org.protege.editor.owl.model.selection.OWLSelectionModelImpl.fireSelectionChanged(OWLSelectionModelImpl.java:192)
org.protege.editor.owl.model.selection.OWLSelectionModelImpl.updateSelectedObject(OWLSelectionModelImpl.java:180)
org.protege.editor.owl.model.selection.OWLSelectionModelImpl.setSelectedObject(OWLSelectionModelImpl.java:168)
org.protege.editor.owl.model.selection.OWLSelectionModelImpl.setSelectedEntity(OWLSelectionModelImpl.java:203)
org.protege.editor.owl.model.OWLWorkspace.verifySelection(OWLWorkspace.java:378)
org.protege.editor.owl.model.OWLWorkspace.handleModelManagerEvent(OWLWorkspace.java:298)
org.protege.editor.owl.model.OWLWorkspace.access$000(OWLWorkspace.java:132)
org.protege.editor.owl.model.OWLWorkspace$1.handleChange(OWLWorkspace.java:221)
org.protege.editor.owl.model.OWLModelManagerImpl.fireEvent(OWLModelManagerImpl.java:763)
org.protege.editor.owl.model.inference.OWLReasonerManagerImpl$2.run(OWLReasonerManagerImpl.java:244)
java.awt.event.InvocationEvent.dispatch(Unknown Source)
java.awt.EventQueue.dispatchEvent(Unknown Source)
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.awt.Dialog$1.run(Unknown Source)
java.awt.Dialog$2.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.awt.Dialog.show(Unknown Source)
java.awt.Component.show(Unknown Source)
java.awt.Component.setVisible(Unknown Source)
org.protege.editor.owl.ui.inference.ReasonerProgressUI$3.run(ReasonerProgressUI.java:156)
java.awt.event.InvocationEvent.dispatch(Unknown Source)
java.awt.EventQueue.dispatchEvent(Unknown Source)
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.run(Unknown Source)
-----------------------------------------------------------------------------------------------------------------------------
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/20c45835/attachment.html>
More information about the protege-discussion
mailing list