Search Mailing List Archives
[protege-discussion] Exception in inference api
Timothy Redmond
tredmond at stanford.edu
Tue Oct 12 16:15:30 PDT 2010
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
at uk.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
> >
>
>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101012/8d8647e1/attachment.html>
More information about the protege-discussion
mailing list