On 19/02/14 03:20, Guilherme Maranhão wrote:
Hello guys,

Those are the steps I am using to instantiate an OntClass object:

// modelMem is an OntModel object.
1 - Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
2 - reasoner = reasoner.bindSchema(modelMem);
3 - OntModelSpec ontModelSpec = OntModelSpec.OWL_DL_MEM_RULE_INF;
4 - ontModelSpec.setReasoner(reasoner);
5 - OntModel ontModel = ModelFactory.createOntologyModel(ontModelSpec,
modelMem);
6 - OntClass stage3Hypertension = ontModel.getOntClass("
http://www.semanticweb.org/ontologies/2013/1/Ontology1361391792831.owl#Stage3Hypertension
");

This is not your underlying problem but you have bound modelMem in twice - you have bound it to the reasoner and then applied that back to the same model. It would be better to just have:

OntModelSpec ontModelSpec = OntModelSpec.OWL_DL_MEM_RULE_INF;
OntModel ontModel = ModelFactory.createOntologyModel(ontModelSpec, modelMem);

Though in fact I would recommend OWL_MEM_MICRO_RULE_INF as the best default.

After line 2, the console prompt shows a lot of warning messages, like this:

Fev 19, 2014 12:15:56 AM
org.mindswap.pellet.jena.graph.query.GraphQueryHandler findTriple
Warning: No query handler found for
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.w3.org/1999/02/22-rdf-syntax-ns#Property

Those are messages from Pellet. Your above code does not include Pellet so either this isn't the code you are running or your "modelMem" in the above is actually Pellet-backed model.

If the latter then you have a rule reasoner running over a rule reasoner running over Pellet. Don't know why that would cause outright failures but certainly not a useful thing to do.

To get help with Pellet you would need to ask the Pellet folks, Pellet is not part of Jena.

Dave

Reply via email to