I am using JenaBeans to access an existing owl model containing an
instance (of Well) that imports a schema model (containing the Well
class). I open the instance model, but when I use the RDF2Bean reader
to load Well instances, it throws an exception. It is finding the
correct instance (of Well), but it says that it cannot bind or coerce
to the class (Well). I am sure this is just a configuration issue.
Any ideas?
Exception in thread "main" thewebsemantic.NotBoundException:
http://www.objectreservoir.com/owl/2010/04/14/BP/SampleWell#SampleWell
exists but is not bound to or able to coerce as class
com.or.orka.jena_reference.Well
at thewebsemantic.RDF2Bean.javaclass(RDF2Bean.java:528)
at thewebsemantic.RDF2Bean.newInstance(RDF2Bean.java:496)
at thewebsemantic.RDF2Bean.applyProperties(RDF2Bean.java:436)
at thewebsemantic.RDF2Bean.testCycle(RDF2Bean.java:397)
at thewebsemantic.RDF2Bean.toObject(RDF2Bean.java:393)
at thewebsemantic.RDF2Bean.loadIndividuals(RDF2Bean.java:178)
at thewebsemantic.RDF2Bean.loadAll(RDF2Bean.java:172)
at thewebsemantic.RDF2Bean.load(RDF2Bean.java:156)
at thewebsemantic.RDF2Bean.load(RDF2Bean.java:123)
at
com.or.orka.jena_reference.WorkspaceManager.main(WorkspaceManager.java:
55)
Here is the Well Class. I am not mapping to all the properties of
Well as this is a feasibility test and well has about 30 properties.
Could that be the issue?
@Namespace("
http://www.objectreservoir.com/owl/2010/02/22/well#")
public class Well {
String name;
String API;
@Id
URI uri;
public Well(URI uri) {
this.uri = uri;
}
public String getAPI() {
return API;
}
public void setAPI(String API) {
this.API = API;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public URI getUri() {
return uri;
}
public void setUri(URI uri) {
this.uri = uri;
}
}
Here is how I am accessing the model. The SampleWell model imports
the Well model
OntModel ontModel =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
ontModel.getDocumentManager().getFileManager().setLocationMapper(mgr.localMapper.getLocationMapper());
ontModel.read("
http://www.objectreservoir.com/owl/2010/04/14/
BP/SampleWell");
RDF2Bean reader = new RDF2Bean(ontModel);
Collection<Well> wells = reader.load(Well.class);
for (Well well : wells) {
System.out.println("2) Well name is " +
well.name);
System.out.println("2) Well API is " + well.API);
}