RDFSPlus Inferencing
AnzoGraph DB includes an inference engine that can create new relationships based on the vocabularies or ontologies in the existing data.
The following example from the W3C Semantic Web Inference documentation illustrates the inference concept:
A data set might include the relationship Flipper isA Dolphin
. An ontology might declare that "every Dolphin is also a Mammal." An inference program that understands the notion of "X is also Y" adds the statement Flipper isA Mammal
to the set of relationships even though it was not specified in the original data.
When AnzoGraph DB creates inferences, it scans the specified graph for any of the RDFSplus and supported OWL 2 RL ontologies and generates new triples according to the W3C OWL 2 RL rules, or rules specified with the optional WITH RULES clause. This topic provides instructions for generating inferences with AnzoGraph DB and describes the supported inference vocabularies.
Generating Inferences
AnzoGraph DB generates inferences as a batch command. Run the following command to generate inferences from one or more existing graphs:
CREATE INFERENCES FROM source_graph1 [ source_graph2 ... ] INTO GRAPH target_graph [ WITH RULES 'list_of_rules' ]
Where list_of_rules in the optional WITH RULES clause is any of the following arguments. Specify multiple options in a commaseparated list:
all

Run all rules. 
rdfsplus

Run only the RDFSplus rules. 
rule list  List specific rules to run. For a list of available rule names, see Inference Rule Reference below. 
rulename

Specify a hyphen () in front of a rule name to exclude that rule. For example, scmsvf2 excludes the scmsvf2 rule. 
For example, the following WITH RULES clause runs all of the inference rules except prpfp and prpifp:
... WITH RULES 'all,prpfp,prpifp'
When you run the CREATE INFERENCES command, AnzoGraph DB runs rules for each of the RDFSplus ontologies that it finds in the source graphs, or rules specified with the optional WITH RULES clause, and inserts the inferred triples into the specified target graph.
Certain inference rules are coupled. Specifying either of the rules in the pair automatically runs the coupled rule. The list below describes the paired rules:
 scmdom1 and scmrng1
 scmdom2 and scmrng2
 prpinv1 and prpinv2
In addition, running scmeqc1 and caxsco also runs caxeqc1 and caxeqc2. And running scmeqp1 and prpspo1 also runs prpeqp1 and prpeqp2.
Inference Rule Reference
The tables below describe the RDFSplus rules as well as the additional subset of OWL 2 RL rules that AnzoGraph DB supports.
RDFSPlus Rules
The tables below define the RDFSplus inference rules.
Semantics of Class Axioms
Because caxeqc1 and caxeqc2 (described in the table below) are implied rules that are coupled with scmeqc1 and caxsco, including caxeqc1 or caxeqc2 in the WITH RULES clause will result in an invalid inference rule name
error. To run the caxeqc1 and caxeqc2 rules, specify scmeqc1 and caxsco (scmeqc1,caxsco) in the WITH RULES clause.
Rule  Description  IF  THEN 

caxeqc1  Two classes are synonymous.  T(?c1, owl:equivalentClass, ?c2)
T(?x, rdf:type, ?c1) 
T(?x, rdf:type, ?c2) 
caxeqc2  Two classes are synonymous.  T(?c1, owl:equivalentClass, ?c2) T(?x, rdf:type, ?c2) 
T(?x, rdf:type, ?c1) 
caxsco  Members of a subclass are also members of the superclass.  T(?c1, rdfs:subClassOf, ?c2) T(?x, rdf:type, ?c1) 
T(?x, rdf:type, ?c2) 
Semantics of Axioms about Properties
Because prpeqp1 and prpeqp2 (described in the table below) are implied rules that are coupled with scmeqp1 and prpspo1, including prpeqp1 or prpeqp2 in the WITH RULES clause will result in an invalid inference rule name
error. To run the prpeqp1 and prpeqp2 rules, specify scmeqp1 and prpspo1 (scmeqp1,prpspo1) in the WITH RULES clause.
Rule  Description  IF  THEN 

prpdom  Infer the subject's type from the predicate's domain.  T(?p, rdfs:domain, ?c) T(?x, ?p, ?y) 
T(?x, rdf:type, ?c) 
prpeqp1  Two properties are synonymous.  T(?p1, owl:equivalentProperty, ?p2) T(?x, ?p1, ?y) 
T(?x, ?p2, ?y) 
prpeqp2  Two properties are synonymous.  T(?p1, owl:equivalentProperty, ?p2)
T(?x, ?p2, ?y) 
T(?x, ?p1, ?y) 
prpfp  If predicate p is a functional property, then a subject can be related to only one specific object by p.  T(?p, rdf:type, owl:FunctionalProperty) T(?x, ?p, ?y1) T(?x, ?p, ?y2) 
T(?y1, owl:sameAs, ?y2) 
prpifp  If predicate p is an inverse functional property, then a specific object can be related to only one subject by p.  T(?p, rdf:type, owl:InverseFunctionalProperty) T(?x1, ?p, ?y) T(?x2, ?p, ?y) 
T(?x1, owl:sameAs, ?x2) 
prpinv1  Two properties are the inverse of each other.  T(?p1, owl:inverseOf, ?p2)
T(?x, ?p1, ?y) 
T(?y, ?p2, ?x) 
prpinv2  Two properties are the inverse of each other.  T(?p1, owl:inverseOf, ?p2) T(?x, ?p2, ?y) 
T(?y, ?p1, ?x) 
prprng  Infer the object's type from the predicate's range.  T(?p, rdfs:range, ?c) T(?x, ?p, ?y) 
T(?y, rdf:type, ?c) 
prpspo1  Relationships that are described by a subproperty also hold for the superproperty.  T(?p1, rdfs:subPropertyOf, ?p2) T(?x, ?p1, ?y) 
T(?x, ?p2, ?y) 
prpsymp  The inverse is true for a property.  T(?p, rdf:type, owl:SymmetricProperty) T(?x, ?p, ?y) 
T(?y, ?p, ?x) 
prptrp  Chains of relationships collapse into a single relationship.  T(?p, rdf:type, owl:TransitiveProperty) T(?x, ?p, ?y) T(?y, ?p, ?z) 
T(?x, ?p, ?z) 
Semantics of Schema Vocabulary
Rule  Description  IF  THEN 

scmcls  Every class is its own subclass and equivalent class, and it is a subclass of owl:Thing.  T(?c, rdf:type, owl:Class)  T(?c, rdfs:subClassOf, ?c) T(?c, owl:equivalentClass, ?c) T(?c, rdfs:subClassOf, owl:Thing) T(owl:Nothing, rdfs:subClassOf, ?c) 
scmdom1  A property with domain c also has domain c's superclasses.  T(?p, rdfs:domain, ?c1) T(?c1, rdfs:subClassOf, ?c2) 
T(?p, rdfs:domain, ?c2) 
scmdom2  A subproperty inherits the domains of the superproperties.  T(?p2, rdfs:domain, ?c) T(?p1, rdfs:subPropertyOf, ?p2) 
T(?p1, rdfs:domain, ?c) 
scmeqc1  Equivalent classes are subclasses of each other.  T(?c1, owl:equivalentClass, ?c2)  T(?c1, rdfs:subClassOf, ?c2) T(?c2, rdfs:subClassOf, ?c1) 
scmeqc2  If two classes are subclasses, they are also equivalent classes.  T(?c1, rdfs:subClassOf, ?c2) T(?c2, rdfs:subClassOf, ?c1) 
T(?c1, owl:equivalentClass, ?c2) 
scmeqp1  Equivalent properties are subproperties of each other.  T(?p1, owl:equivalentProperty, ?p2)  T(?p1, rdfs:subPropertyOf, ?p2) T(?p2, rdfs:subPropertyOf, ?p1) 
scmeqp2  If two properties are subproperties, they are also equivalent properties.  T(?p1, rdfs:subPropertyOf, ?p2) T(?p2, rdfs:subPropertyOf, ?p1) 
T(?p1, owl:equivalentProperty, ?p2) 
scmrng1  A property with range c also has range c's superclasses.  T(?p, rdfs:range, ?c1) T(?c1, rdfs:subClassOf, ?c2) 
T(?p, rdfs:range, ?c2) 
scmrng2  A subproperty inherits the ranges of its superproperties.  T(?p2, rdfs:range, ?c) T(?p1, rdfs:subPropertyOf, ?p2) 
T(?p1, rdfs:range, ?c) 
scmsco  owl:subClassOf relationships are transitive  T(?c1, rdfs:subClassOf, ?c2) T(?c2, rdfs:subClassOf, ?c3) 
T(?c1, rdfs:subClassOf, ?c3) 
scmspo  owl:subPropertyOf relationships are transitive.  T(?p1, rdfs:subPropertyOf, ?p2) T(?p2, rdfs:subPropertyOf, ?p3) 
T(?p1, rdfs:subPropertyOf, ?p3) 
The scmdp and scmop schema vocabulary rules are not run. Those rules add significant compute overhead but do not result in meaningful inference results.
OWL 2 RL Rules
The tables below define the subset of OWL 2 RL inference rules that are supported.
Semantics of Equality
Rule  Description  IF  THEN 

eqrepo  Describes the replacement property of the owl:sameAs axiom.  T(?o, owl:sameAs, ?o') T(?s, ?p, ?o) 
T(?s, ?p, ?o') 
eqrepp  Describes the replacement property of the owl:sameAs axiom.  T(?p, owl:sameAs, ?p') T(?s, ?p, ?o) 
T(?s, ?p', ?o) 
eqreps  Describes the replacement property of the owl:sameAs axiom.  T(?s, owl:sameAs, ?s') T(?s, ?p, ?o) 
T(?s', ?p, ?o) 
eqsym  Describes the symmetric property of the owl:sameAs axiom.  T(?x, owl:sameAs, ?y)  T(?y, owl:sameAs, ?x) 
eqtrans  Describes the transitive property of the owl:sameAs axiom.  T(?x, owl:sameAs, ?y) T(?y, owl:sameAs, ?z) 
T(?x, owl:sameAs, ?z) 
Semantics of Schema Vocabulary
Rule  Description  IF  THEN 

scmsvf1  A property restriction c1 is a subclass of c2 if they are both someValuesFrom restrictions on the same property and c1's target class is a subclass of c2's target class.  T(?c1, owl:someValuesFrom, ?y1) T(?c1, owl:onProperty, ?p) T(?c2, owl:someValuesFrom, ?y2) T(?c2, owl:onProperty, ?p) T(?y1, rdfs:subClassOf, ?y2) 
T(?c1, rdfs:subClassOf, ?c2) 
scmsvf2  A property restriction c1 is a subclass of c2 if they are both someValuesFrom restrictions on the same class where c1's target property is a subproperty of c2's target property.  T(?c1, owl:someValuesFrom, ?y) T(?c1, owl:onProperty, ?p1) T(?c2, owl:someValuesFrom, ?y) T(?c2, owl:onProperty, ?p2) T(?p1, rdfs:subPropertyOf, ?p2) 
T(?c1, rdfs:subClassOf, ?c2) 
scmint  T(?c, owl:intersectionOf, ?x) LIST[?x, ?c1, ..., ?cn] 
T(?c, rdfs:subClassOf, ?c1) T(?c, rdfs:subClassOf, ?c2) ... T(?c, rdfs:subClassOf, ?cn) 
Semantics of Classes
Rule  Description  IF  THEN 

clssvf1  At least one object of a property is a member of the specified class.  T(?x, owl:someValuesFrom, ?y) T(?x, owl:onProperty, ?p) T(?u, ?p, ?v) T(?v, rdf:type, ?y) 
T(?u, rdf:type, ?x) 
clsint1  An instance belongs to every one of the specified classes.  T(?c, owl:intersectionOf, ?x)
LIST[?x, ?c1, ..., ?cn] T(?y, rdf:type, ?c1) T(?y, rdf:type, ?c2) ... T(?y, rdf:type, ?cn) 
T(?y, rdf:type, ?c) 
Inference Example
The following simple example demonstrates the inferences that AnzoGraph DB generates to infer friendships in the sample Tickit data set. The example uses the following subset of triples, and it describes the friend relationships using the owl:TransitiveProperty vocabulary:
# friends.ttl PREFIX owl: <http://www.w3.org/2002/07/owl#> <friend> a owl:TransitiveProperty . <person1> rdf:type <person> ;<name> "Rafael Taylor" ;<like> "sports","theatre","classical","vegas","musicals" ;<dislike> "jazz","broadway" ;<friend> <person2>,<person4> . <person2> rdf:type <person> ;<name> "Vladimir Humphrey" ;<like> "jazz","classical","vegas","musicals" ;<dislike> "broadway" ;<friend> <person3> . <person3> rdf:type <person> ;<name> "Lars Ratliff" ;<like> "sports","rock","musicals" ;<dislike> "theatre","jazz","opera" ;<friend> <person1> . <person4> rdf:type <person> ;<name> "Barry Roy" ;<like> "theatre" ;<dislike> "sports","jazz","musicals" ;<friend> <person5> . <person5> rdf:type <person> ;<name> "Reagan Hodge" ;<like> "concerts","rock","vegas","musicals" ;<dislike> "jazz","broadway" ;<friend> <person1> .
Loading friends.ttl into a graph named friends and querying the new graph for a list of friendships produces the following results. The query returns 6 friendships:
SELECT * FROM <friends> WHERE { ?person <friend> ?friend . } ORDER BY ?person
person  friend + person1  person4 person1  person2 person2  person3 person3  person1 person4  person5 person5  person1 6 rows
The query below generates inferences for the friends graph based on the rules for owl:TransitiveProperty. The query creates the inferences in a graph named morefriends:
CREATE INFERENCES FROM <friends> INTO GRAPH <morefriends>
When the inferencing is complete, the following query returns the friend triples in the morefriends graph. The query filters out triples for which the same person is the subject (?person) and object (?friend):
SELECT * FROM <morefriends> WHERE { ?person <friend> ?friend. FILTER(?person != ?friend). } ORDER BY ?person
person  friend + person1  person5 person1  person3 person2  person5 person2  person4 person2  person1 person3  person5 person3  person2 person3  person4 person4  person2 person4  person3 person4  person1 person5  person2 person5  person4 person5  person3 14 rows
Following the OWL 2 RL rules for owl:TransitiveProperty, AnzoGraph DB inferred 8 new friendships from the 6 friendships in the original friend graph.