[Pellet-users] OWL API - URL error

sjtirtha sjtirtha at gmail.com
Thu May 17 09:52:02 UTC 2007


It's already solved.
I need to add the OntologyManager into the reasoner.

####################################################################

OWLOntology ontology = manager.loadOntology(URI.*create*(OWL_OBJ));

reasoner.setManager(manager);  // this is just added

reasoner.loadOntologies(ontology);
######################################################################

Steve


On 5/16/07, sjtirtha <sjtirtha at gmail.com> wrote:
>
> Hi,
>
> I'm using now java api to test the swrl features in pellet.
> But I get error on
> OWLClass human = reasoner.getClass(URI.*create*(
> http://www.w3c.org/swrl/family.owl#human));
>
> The error:
>
> Exception in thread "main"
> *java.lang.NullPointerException*
>
> at org.mindswap.pellet.owlapi.Reasoner.getEntity(
> *Reasoner.java:491*)
>
> at org.mindswap.pellet.owlapi.Reasoner.getClass(
> *Reasoner.java:471*)
>
> at test.SWRLTest.main(
> *SWRLTest.java:55*) Do I use the wrong url ? I defined
> http://www.w3c.org/swrl/family.owl#human as xmlns in file:src/family_rules.owl
> .
>
> Code:
>
> ##############################################################################################
>
> String OWL_OBJ = "file:src/family_rules.owl";
>
>  *try* {
>
> System.*out*.println("Reading file " + OWL_OBJ + "...");
>
> Reasoner reasoner = *new* Reasoner();
>
> OWLOntologyManager manager = OWLManager.*createOWLOntologyManager*();
>
> OWLOntology ontology = manager.loadOntology(URI.*create*(OWL_OBJ));
>
> reasoner.loadOntologies(ontology);
>
>  reasoner.getKB().realize();
>
> reasoner.getKB().printClassTree();
>
>  OWLClass human = reasoner.getClass(URI.*create*(
> http://www.w3c.org/swrl/family.owl#human));
>
> OWLObjectProperty hasUncle = reasoner.getObjectProperty(URI.*create*("http://www.w3c.org/swrl/family.owl#hasUncle
> "));
>
> OWLObjectProperty hasAunt = reasoner.getObjectProperty(URI.*create*("http://www.w3c.org/swrl/family.owl#hasAunt
> "));
> ##############################################################################################
>
>
> steve
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.owldl.com/pipermail/pellet-users/attachments/20070517/92bec65f/attachment.htm 


More information about the Pellet-users mailing list