I tried to run the following SPARQL query in Sesame:
SELECT ?s ?p
FROM <http://namespace#ABox>
FROM <http://namespace#TBox>
WHERE { ?s ?p <http://namespace#Sensor> }
according: run a sparql query against two graphs?
the following rdf-statements are stored in Sesame:
subject: <http://namespace#Sensor2014>
predicate: <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
object: <http://namespace#TempSensor>
context: <http://namespace#ABox>
subject: <http://namespace#TempSensor>
predicate: <http://www.w3.org/2000/01/rdf-schema#subClassOf>
object: <http://namespace#Sensor>
context: <http://namespace#TBox>
I used the option setIncludeInferred(true) in Java
Only the following statement appears:
subject: <http://namespace#TempSensor>
predicate: <http://www.w3.org/2000/01/rdf-schema#subClassOf>
Actually I expect to get Sensor2014 also as a result.
I think the problem might be the OWLSubClassOfAxiom
Update:
I tried the following queries:
First query:
SELECT ?s ?p WHERE {?s ?p <http://namespace#Sensor>}
result:
subject: <http://namespace#Sensor2015>
predicate: <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
result is the expected one
Second query:
SELECT ?s ?p FROM <http://namespace#TAbox> WHERE {?s ?p <http://namespace#Sensor>}
no results
result is not the expected one
Now both, ABox and TBox, are in the same subgraph. content of subgraph:
subject: <http://namespace#Sensor2015>
predicate: <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
object: <http://namespace#TempSensor>
context: <http://namespace:TAbox>
subject: <http://namespace#TempSensor>
predicate: <http://www.w3.org/2000/01/rdf-schema#subClassOf>
object: <http://namespace#Sensor>
context: <http://namespace:TAbox>
Reasoning is supported - proved in first query. I conclude by trying the queries that as soon as a subgraph is used, reasoning does not work anymore.
FROM <namespace#ABox> FROM <namespace#TBox>looks very suspicious to me. Are you actually using relative URIs as the names of graphs? I'm not even sure whether that's legal. In any case, it seems like it might lead to unpredictable results. If that's not your actual code, then please provide us code that we can use to reproduce the problem. - Joshua Taylor