Martin Ledvinka created JENA-1518:
-------------------------------------

             Summary: InfModel does not contain inferred statements when 
asserted data is accessed first
                 Key: JENA-1518
                 URL: https://issues.apache.org/jira/browse/JENA-1518
             Project: Apache Jena
          Issue Type: Bug
          Components: Core
    Affects Versions: Jena 3.6.0
            Reporter: Martin Ledvinka


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).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to