MaoZerhouni
MaoZerhouni

Reputation: 81

Reasoning doesn't recognize subClassOf

in stardog studio, I have created a basic database. and added the following rdf data.

When I query this database with a reasoning "on", I don't find expected results.

I expect Alice, Charlie to be recognized as http://example.org/Person. When activating reasoning, everything is recognised as owl:Thing, and no inference is made about Alice being a Person

`<?xml version="1.0"?>
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:ex="http://example.org/">

<!-- Classes -->
<rdf:Description rdf:about="http://example.org/Person">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
    <rdfs:label>Person</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/Student">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
    <rdfs:subClassOf rdf:resource="http://example.org/Person"/>
    <rdfs:label>Student</rdfs:label>
</rdf:Description>
<!-- Instances -->
<rdf:Description rdf:about="http://example.org/Alice">
    <rdf:type rdf:resource="http://example.org/Student"/>
    <rdfs:label>Alice</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/Charlie">
    <rdf:type rdf:resource="http://example.org/Person"/>
    <rdfs:label>Charlie</rdfs:label>
</rdf:Description>
</rdf:RDF>`

Query

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 PREFIX ex: <http://example.org/>
 SELECT ?individual ?class
 WHERE {
 ?individual rdf:type ?class .
 }

Upvotes: 3

Views: 57

Answers (2)

MaoZerhouni
MaoZerhouni

Reputation: 81

I also posted the question in Stardog community forum. Here is the solution:

If you added the data to the default graph, this means that both your data (A-Box) and your schema (T-Box) are in the default graph. Therefore, you need to set the schema graphs option (reasoning.schema.graphs) of your database to the default graph (tag:stardog:api:context:default). You can do so in the Properties tab of your database

In general you can add your schema/ontology to any named graph as long as the named graph is included in the reasoning.schema.graphs reasoning will work.

Best regards,

Lars

Upvotes: 2

MaoZerhouni
MaoZerhouni

Reputation: 81

I think I found the reason. It seems that Stardog Studio separate between assertions and models. For reasoning, it only uses the relationships that are used in models, not databases.

When I add the classes in Models, reasoning produce the expected result.

Upvotes: 3

Related Questions