I am trying to understand the RDFS inference rules, in particular the rdfs:subClassOf inference. I was hoping a query such as
- Code: Select all
sparql select * where {<class1> rdfs:subClassOf ?superClass};
will return all super classes of <class1>, including both directly asserted and inferred, however, it seems to me only asserted super classes are returned.
Anyone can help me clarify?
Here is what I did:
1. I have this data set, <a> is a subclass of <b>, and <b> is subclass of <c>.
- Code: Select all
@base <http://example.com/test/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<a> rdfs:subClassOf <b> .
<b> rdfs:subClassOf <c> .
<ia> rdf:type <a> .
2. add rule set
- Code: Select all
rdfs_rule_set ('testrules', 'http://example.com/test/');
3. execute this query
- Code: Select all
sparql
define input:inference "testrules"
select * where {<http://example.com/test/a> rdfs:subClassOf ?sup};
4. only <b> is returned, but I think <c> is also an answer as the result of rdfs:subClassOf inference.

