[
https://issues.apache.org/jira/browse/JENA-61?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025872#comment-13025872
]
Dan Leadgy commented on JENA-61:
--------------------------------
[rdfs6: (?p rdfs:subPropertyOf ?q), notEqual(?p,?q) -> [ (?a ?q ?b) <- (?a ?p
?b)] ]
[equality1: (?X owl:sameAs ?Y), notEqual(?X,?Y) -> [(?X ?P ?V) <- (?Y ?P ?V)]
[(?V ?P ?X) <- (?V ?P ?Y)] ]
Looking at the OWL mini rules that Jena applies, I think the issue could be
caused because rdfs:subPropertyOf is defined as a hybrid rule and the
owl:sameAs is only fired when querying the model(at the time backward rules get
fired).
Because owl:sameAs is defined also as a hybrid rule, it's forward definition
(?X owl:sameAs ?Y) doesn't see the results of the subPropertyOf backward
rule(which would assert that {r owl:sameAs r1}), hence the rule for owl:sameAs
never gets fired.
To overcome this issue, I think that making the inference twice would solve any
similar issues. For this, we could configure another OWLMini inferencer over
the existing OWLMini inferencer:
this.infM =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MINI_RULE_INF,
this.baseM);
this.infM =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MINI_RULE_INF, this.infM);
This looks like a very hackish solution, but it seems to make the test case
work successfully.
However, I believe there has to be a way to make this work without creating
another inference model on top of the existing inference model. Looking forward
for any suggestions.
Thank you!
> Expected result not entailed
> ----------------------------
>
> Key: JENA-61
> URL: https://issues.apache.org/jira/browse/JENA-61
> Project: Jena
> Issue Type: Bug
> Components: Reasoners
> Reporter: Ian Dickinson
> Assignee: Dave Reynolds
>
> From a question on Stack Overflow [1]. The expected entailment `:r
> :my_property :a_value` is not asserted in the inference model. As far as I
> can see, the OP is correct that this result should be entailed.
> [1] http://stackoverflow.com/questions/5803610/jena-recursive-reasoning-issue
> Complete test case:
> ------------------------------------------------------------------
> package example;
> import static org.junit.Assert.assertTrue;
> import org.junit.Test;
> import com.hp.hpl.jena.ontology.*;
> import com.hp.hpl.jena.rdf.model.ModelFactory;
> import com.hp.hpl.jena.vocabulary.OWL;
> public class InfTest
> {
> OntModel baseM, infM;
> @Test
> public void test1() {
> this.baseM = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
> // also fails with MICRO_RULE_INF
> this.infM =
> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MINI_RULE_INF,
> this.baseM);
> OntResource r = baseM.createOntResource("http://example.com/r");
> OntResource r1 = baseM.createOntResource("http://example.com/r1");
> OntProperty myProperty =
> baseM.createOntProperty("http://example.com#my_property");
> OntResource v = baseM.createOntResource("http://example.com#a_value");
> OntProperty mySameAs =
> baseM.createOntProperty("http://example.com#mySameAs");
> baseM.add(mySameAs, OWL.equivalentProperty, OWL.sameAs);
> r1.addProperty(myProperty, v);
> r.addProperty(mySameAs, r1);
> infM.rebind();
> //infM.writeAll( System.out, "Turtle", null );
> assertTrue(infM.contains(r, myProperty, v));
> }
> }
> ------------------------------------------------------------------
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira