[Pellet-users] OWL API - URL error
sjtirtha
sjtirtha at gmail.com
Wed May 16 16:58:37 UTC 2007
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/20070516/a5ddcb1c/attachment.htm
More information about the Pellet-users
mailing list