[Pellet-users] com.hp.hpl.jena.ontology.ConversionException

Michael Grove mike at clarkparsia.com
Sat Sep 1 15:29:10 UTC 2007


ConversionException's are generally thrown when statements required  
to make the conversion are missing from the knowledge base.  The as 
(...) requires a suitable conversion to case a RDFNode as another  
object.  In this case, it's likely that you're missing the assertion  
in your KB that Artifact is rdf:type owl:Class.  Jena's polymorphic  
framework generally requires statements like that to cast RDFNode's  
to an OntClass object.  Without your ontology to look at, I can't say  
for sure, but in the past when I've had this type of error, missing  
rdf:type statements was my problem.

For more information on Jena's polymorphic framework: http:// 
jena.sourceforge.net/enh-node-howto.html

Cheers,

Mike

On Sep 1, 2007, at 10:38 AM, Can Kayali wrote:

> Hi all,
>
> I tried to get a class from a reasoner and met this error:
>
> "Exception in thread "main"  
> com.hp.hpl.jena.ontology.ConversionException:
> Cannot convert node http://127.0.0.1/ontology/ 
> simplified_sumo.owl#Artifact
> to OntClass: it does not have rdf:type owl:Class or equivalent
> "
>
> I used other ontologies and the error remains.
>
> My relevant source code is:
>
> URI u1 =
> java.net.URI.create("http://127.0.0.1/ontology/ 
> simplified_sumo.owl#Artifact")
> OntClass c1 = reasoner.getClass(u1);
>
> where reasoner is a Pellet Reasoner and  getClass is defined as:
>
> public OntClass getClass(URI uri) throws URISyntaxException,
> ConceptNotFoundException {
> if (uri==null)
> throw new URISyntaxException("URI was not initialized correctly  
> ","URI was
> not initialized correctly ");
> return (OntClass)getRDFNode(uri).as(OntClass.class);}
>
>
>
> The whole error stack is:
>
> Exception in thread "main"  
> com.hp.hpl.jena.ontology.ConversionException:
> Cannot convert node http://127.0.0.1/ontology/ 
> simplified_sumo.owl#Artifact
> to OntClass: it does not have rdf:type owl:Class or equivalent
> at com.hp.hpl.jena.ontology.impl.OntClassImpl$1.wrap 
> (OntClassImpl.java:80)
> at com.hp.hpl.jena.enhanced.EnhNode.convertTo(EnhNode.java:113)
> at com.hp.hpl.jena.enhanced.Polymorphic.asInternal(Polymorphic.java: 
> 65)
> at com.hp.hpl.jena.enhanced.EnhNode.viewAs(EnhNode.java:64)
> at com.hp.hpl.jena.enhanced.EnhNode.as(EnhNode.java:69)
> at owlsmx.reasoning.PelletReasoner.getClass(PelletReasoner.java:237)
> at owlsmx.Deneme.conceptDegree(Deneme.java:325)
> at owlsmx.Deneme.main(Deneme.java:719)
>
>
> Thanks in advance,
>
> Can
>
>
> _______________________________________________
> Pellet-users mailing list
> Pellet-users at lists.owldl.com
> http://lists.owldl.com/mailman/listinfo/pellet-users
> _______________________________________________
>
> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/



More information about the Pellet-users mailing list