Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Reasoners
    • Labels:
      None

      Description

      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)); }

      }

      ------------------------------------------------------------------

        Activity

        Hide
        Dan Leadgy added a comment -

        [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!

        Show
        Dan Leadgy added a comment - [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!

          People

          • Assignee:
            Dave Reynolds
            Reporter:
            Ian Dickinson
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development