This content has been marked as final. Show 4 replies
Could you try the following code instead?
Attachment attachment = Attachment.createInstance(
GraphOracleSem graph = new GraphOracleSem(oracle, modelName, attachment);
graph.commitTransaction(); //making sure the rules index is valid
ModelOracleSem oracle_sem_model = new ModelOracleSem(graph);
OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, oracle_sem_model);
There are two changes
1) I moved the first commitTransaction above that createOntologyModel API call.
2) I used ALLOW_QUERY_INCOMPLETE
I am able to run the changed code (using the latest Jena Adaptor).
1) is necessary because that createOntologyModel call will in turn call the graphBaseFind API of GraphOracleSem. However, the entailment was not created. So there was a bit of timing issue in your code.
2) is necessary because model.create(...) will add new triple to the graph which causes the status to be incomplete. So we have to allow that status.
Hope it helps,
So the command "ontModel.createClass(uri)"
a) Causes the sem_model's (i.e. the thing beneath GraphOracleSem) rules index to become incomplete... and
b) Makes a query against sem_model...
which is why you need QueryOptions.ALLOW_QUERY_INCOMPLETE.
So I have a few questions:
1) Why does "ontModel.createClass(uri)" make a query against GraphOracleSem? To my understanding the only thing it's doing is adding the triple "uri rdf:type rdf:Class" to the database. The following code for instance will work with QueryOptions.DEFAULT:
2) If the call "ontModel.createClass(uri)" indeed does make a query against GraphOracleSem, when does this happen? Does it happen before or after the statement "uri rdf:type rdf:Class" is added to the graph?
Hi,1 person found this helpful
All these behaviors are really Jena's own logic.
Here are some details.
When createOntologyModel is invoked, a pattern match query (?s @ow;:imports ?o) is sent to
When createClass() is invoked, at the GraphOracleSem object level, performAdd() is called, followed by
a boolean query to verify that triple is added. Note that the follow up query is done by Jena.
Hope it helps,
Ah, makes perfect sense. Thank you.