I am trying to write an inference rule using OWL.
Given the following:
Statements:
@prefix : <http://example.com/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:Document rdf:type owl:Class .
:Category rdf:type owl:Class .
:documentHasCategory rdf:type owl:ObjectProperty ;
rdfs:domain :Document ;
rdfs:range :Category .
:hasSubCategory rdf:type owl:ObjectProperty ;
rdfs:domain :Category ;
rdfs:range :Category .
:category1 rdf:type :Category ;
rdfs:label "Law" ;
:hasSubCategory :category2 .
:category2 rdf:type :Category ;
rdfs:label "Contract Law".
:doc1 rdf:type :Document ;
:documentHasCategory :category2 .
How should I write an inference statement to add the category of "Law" to the document? I tried:
:inferredCategory rdf:type owl:ObjectProperty ;
rdfs:domain :Document ;
rdfs:range :Category ;
owl:propertyChainAxiom ( :documentHasCategory :hasSubCategory ) .
But I'm not seeing any inferred statements (I'm using GraphDB).
Is owl:propertyChainAxiom
the correct way to approach this?
Have I got my turtle syntax wrong?
I wasn't respecting the direction of the hasSubCategory
predicate, so nothing actually matches the propertyChain rule.
Defining the inference like this works just fine:
:hasParentCategory rdf:type owl:ObjectProperty ;
owl:inverseOf :hasChildCategory .
:documentHasInferredCategory rdf:type owl:ObjectProperty ;
rdfs:domain :Document ;
rdfs:range :Category ;
owl:propertyChainAxiom ( :documentHasCategory :hasParentCategory ) .