This article provides a simple example of how to use inference rules to map owl:unionOf and owl:intersectionOf class descriptions into rdfs:subClassOf relationships.
The example below shows a SPARQL query that has rules to:
(1) Interpret the RDF collection notation to assign membership.
(2) Create RDFS subclass relationships based on the OWL union and intersection descriptions.
(3) Generates some sample data to demonstrate the first two rules.
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> prefix x: <http://www.example.org/> rulebase ( # (1) some rdf collection rules construct {?l rdfs:member ?i} where {?l rdf:first ?i} construct {?l rdfs:member ?i} where {?l rdf:rest ?r. ?r rdfs:member ?i} # (2) owl to rdfs subclass rules construct {?s rdfs:subClassOf ?c} where {?s owl:intersectionOf ?l. ?l rdfs:member ?c} construct {?c rdfs:subClassOf ?u} where {?u owl:unionOf ?l. ?l rdfs:member ?c} # (3) some sample data construct {x:HumanBeing owl:unionOf (x:Man x:Woman)} construct {x:TallMan owl:intersectionOf (x:Man x:TallThing)} ) select ?sub ?super where {?sub rdfs:subClassOf ?super}
The SELECT query then produces a list of classes with their corresponding base class. When the query is executed it produces the following results:
<http://www.example.org/Man> <http://www.example.org/HumanBeing>
<http://www.example.org/TallMan> <http://www.example.org/Man>
<http://www.example.org/TallMan> <http://www.example.org/TallThing>
<http://www.example.org/Woman> <http://www.example.org/HumanBeing>
Note, the RDFS subclass rules are not recursive and just show the immediate base class.
0 comments:
Post a Comment