George News
2017-03-10 09:51:41 UTC
Hi,
I have the following properties defined in my ontology:
<owl:ObjectProperty rdf:about="http://mydomain.com#by">
<rdfs:domain rdf:resource="http://mydomain.com#data"/>
<owl:inverseOf rdf:resource="http://mydomain.com#made"/>
<rdfs:range rdf:resource="http://mydomain.com#node"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="http://mydomain.com#made">
<owl:inverseOf rdf:resource="http://mydomain.com#by"/>
<rdfs:domain rdf:resource="http://mydomain.com#node"/>
<rdfs:range rdf:resource="http://mydomain.com#data"/>
</owl:ObjectProperty>
And I have registered multiple entity data and nodes using a JSON-LD document similar to the one below:
{
"@context": {
"my": "http://mydomain.com#"
},
"@graph": [
{
"@id": "_:b81",
"@type": "my:data",
"my:by": {
"@id": "Node1"
},
},
{
"@id": "Node1",
"@type": "my:node",
}
]
}
I'm using:
OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
And this is the model I'm injecting to the QueryExecution, etc.
Then I try to run SPARQL sentences on the TDB, but I'm facing issues with the inference. If I run
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX my: <http://mydomain.com#>
SELECT ?d ?n
WHERE {
?n rdf:type/rdfs:subClassOf my:node .
?d my:by ?n .
}
I'm getting results, but if I run
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX my: <http://mydomain.com#>
SELECT ?d ?n
WHERE {
?n rdf:type/rdfs:subClassOf my:node .
?n my:made ?d .
}
I don't get any. The inference model should be infering that made is the inverse of and I should be getting the same results, shouldn't I? Or should I create a InfModel base on the desired reasoner and then inject it to the QueryExecution? From my understanding the first option should be working.
Thanks for your help.
Jorge
I have the following properties defined in my ontology:
<owl:ObjectProperty rdf:about="http://mydomain.com#by">
<rdfs:domain rdf:resource="http://mydomain.com#data"/>
<owl:inverseOf rdf:resource="http://mydomain.com#made"/>
<rdfs:range rdf:resource="http://mydomain.com#node"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="http://mydomain.com#made">
<owl:inverseOf rdf:resource="http://mydomain.com#by"/>
<rdfs:domain rdf:resource="http://mydomain.com#node"/>
<rdfs:range rdf:resource="http://mydomain.com#data"/>
</owl:ObjectProperty>
And I have registered multiple entity data and nodes using a JSON-LD document similar to the one below:
{
"@context": {
"my": "http://mydomain.com#"
},
"@graph": [
{
"@id": "_:b81",
"@type": "my:data",
"my:by": {
"@id": "Node1"
},
},
{
"@id": "Node1",
"@type": "my:node",
}
]
}
I'm using:
OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
And this is the model I'm injecting to the QueryExecution, etc.
Then I try to run SPARQL sentences on the TDB, but I'm facing issues with the inference. If I run
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX my: <http://mydomain.com#>
SELECT ?d ?n
WHERE {
?n rdf:type/rdfs:subClassOf my:node .
?d my:by ?n .
}
I'm getting results, but if I run
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX my: <http://mydomain.com#>
SELECT ?d ?n
WHERE {
?n rdf:type/rdfs:subClassOf my:node .
?n my:made ?d .
}
I don't get any. The inference model should be infering that made is the inverse of and I should be getting the same results, shouldn't I? Or should I create a InfModel base on the desired reasoner and then inject it to the QueryExecution? From my understanding the first option should be working.
Thanks for your help.
Jorge