Hello everyone,
In the past, I was able to execute inference engine to retrieve transitive
values like the following:
// model intialisation
Model typesModel = ModelFactory.createDefaultModel();
typesModel.read(inStream, "RDF");
//function to run inference:
public void applyInference(Model model) throws FileNotFoundException{
Model modelTemp = model;
Reasoner reasoner = ReasonerRegistry.getOWLMicroReasoner();
reasoner = reasoner.bindSchema(ev6Model);
InfModel infmodel = ModelFactory.createInfModel(reasoner, model);
Model modelTemp2 = ModelFactory.createDefaultModel();
Property prop21 = ev6Model.getProperty(ns+"#parentsType");
for (StmtIterator sti = infmodel.listStatements(null, prop21, (RDFNode)
null);
sti.hasNext(); ) {
Statement stmt = sti.nextStatement();
modelTemp2.add(stmt);
}
modelTemp.add(modelTemp2);
}
Actually, I'm working on a other project which deal with OntModel like the
following:
public static OntModel readOntology(File ontoFile) throws
FileNotFoundException
{
Model myModel = null;
FileInputStream inStream = new FileInputStream(ontoFile);
myModel = ModelFactory.createDefaultModel();
myModel.read(inStream, "");
OntModel sourceModel =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, myModel);
return sourceModel;
}
I have 2 transitive properties in my model. When I make a call to the
function which deal with inference, the transitive values are not returned.
Here is how my inference engine is initialized:
Reasoner reasoner = ReasonerRegistry.getTransitiveReasoner();
reasoner = reasoner.bindSchema(srcModel);
InfModel infmodel = ModelFactory.createInfModel(reasoner, kbModel);
I have tried several way to make it works, but I din't figure out yet:
- Modify the inference engine intialization with Model instead of OntModel
- Modify the specification with OntModelSpec.OWL_DL_MEM_RULE_INF instead
of OntModelSpec.OWL_MEM
- Modify the reasonner from getTransitiveReasonner to getOwlMicro
I have been using Jena 2.7 and jena 2.6.3.
Do you have any ideas about what I'm doing wrong?
Regards,
Brice