Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1518

InfModel does not contain inferred statements when asserted data is accessed first

    XMLWordPrintableJSON

    Details

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

      Description

      When I create an InfModel (tested on RDFSRuleReasoner, RDFSFBRuleReasoner and OWLMicroReasoner) and I access an asserted statement first, the model does not see inferred statements it previously created. If I access the inferred statements first, everything works fine.

      What's interesting is that when I list all the statements in the model (listStatements().toList()), I can see the relevant statement, but the model ignores it. Demo:

      Model model = ModelFactory.createDefaultModel();
      Resource subject = createResource(SUBJECT);
      Resource typeOne = createResource(TYPE_ONE);
      Resource typeTwo = createResource(TYPE_TWO);
      model.add(typeOne, RDFS.subClassOf, typeTwo);
      model.add(subject, RDF.type, typeOne);
      InfModel infModel = ModelFactory.createInfModel(RDFSRuleReasonerFactory.theInstance().create(null), model);
      assertTrue(infModel.contains(createResource(SUBJECT), RDF.type, typeOne));
      assertTrue(infModel.contains(createResource(SUBJECT), RDF.type, typeTwo));  // This assertion FAILS. But if I switch this line for the one above, it works fine

      Also, if I use unbound subject in the contains call on the last line, it returns true, so it seems that it incorrectly matches the 'subject' Resource.

      The same problem can be reproduces on the listStatements method, when first accessing just the asserted statements (using 'typeOne' as object) and then accessing inferred statements (using 'typeTwo' as object).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kidney Martin Ledvinka
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: