RDFClosure.OWLRL.OWLRL_Semantics

Package RDFClosure :: Module OWLRL :: Class OWLRL_Semantics |
[hide private]
[frames] | no frames]

# Class OWLRL_Semantics

source code

    Closure.Core --+
                   |
                  OWLRL_Semantics

Known Subclasses:
  - CombinedClosure.RDFS_OWLRL_Semantics

OWL 2 RL Semantics class, ie, implementation of the OWL 2 RL closure graph.

Note that the module does not implement the so called Datatype entailment rules, simply because the underlying RDFLib does not implement the datatypes (ie, RDFLib will not make the literal "1.00" and "1.00000" identical, although even with all the ambiguities on datatypes, this should be made equal...). Also, the so-called extensional entailment rules (Section 7.3.1 in the RDF Semantics document) have not been implemented either.

The comments and references to the various rule follow the names as used in the OWL 2 RL document.

Instance Methods | [hide private]
__init__(self, graph, axioms, daxioms, rdfs=None) | source code
_list(self, l) Shorthand to get a list of values (ie, from an rdf:List structure) starting at a head | source code
_get_resource_or_literal(self, node) | source code
post_process(self) Remove triples with bnode predicates. | source code
add_axioms(self) Add axioms | source code
add_d_axioms(self) Add the datatype axioms | source code
restriction_typing_check(self, v, t) Helping method to check whether a type statement is in line with a possible restriction. | source code
_one_time_rules_datatypes(self) Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. | source code
_one_time_rules_misc(self) Rules executed: cls-thing, cls-nothing, prp-ap. | source code
one_time_rules(self) Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. | source code
rules(self, t, cycle_num) Go through the various rule groups, as defined in the OWL-RL profile text and implemented via local methods. | source code
_property_chain(self, p, x) Implementation of the property chain axiom, invoked from inside the property axiom handler. | source code
_equality(self, triple, cycle_num) Table 4: Semantics of equality. | source code
_properties(self, triple, cycle_num) Table 5: The Semantics of Axioms about Properties. | source code
_classes(self, triple, cycle_num) Table 6: The Semantics of Classes. | source code
_class_axioms(self, triple, cycle_num) Table 7: Class Axioms. | source code
_schema_vocabulary(self, triple, cycle_num) Table 9: The Semantics of Schema Vocabulary. | source code
Inherited from `Closure.Core`: `add_error`, `closure`, `empty_stored_triples`, `flush_stored_triples`, `get_literal_value`, `pre_process`, `store_triple`

Instance Variables | [hide private]
Inherited from `Closure.Core`: `IMaxNum`, `added_triples`, `axioms`, `daxioms`, `error_messages`, `graph`, `literal_proxies`, `rdfs`

Method Details | [hide private]

### __init__(self, graph, axioms, daxioms, rdfs=None) (Constructor) | source code
Parameters: `graph` (rdflib.Graph) - the RDF graph to be extended `axioms` (bool) - whether (non-datatype) axiomatic triples should be added or not `daxioms` (bool) - whether datatype axiomatic triples should be added or not `rdfs` (boolean) - whether RDFS inference is also done (used in subclassed only) Overrides: Closure.Core.__init__

### _list(self, l) | source code
Shorthand to get a list of values (ie, from an rdf:List structure) starting at a head Parameters: `l` - RDFLib resource, should be the head of an rdf:List Returns: array of resources

### post_process(self) | source code
Remove triples with bnode predicates. The Bnodes in the graph are collected in the first cycle run. Overrides: Closure.Core.post_process

### add_axioms(self) | source code
Add axioms Overrides: Closure.Core.add_axioms

### add_d_axioms(self) | source code
Add the datatype axioms Overrides: Closure.Core.add_d_axioms

### restriction_typing_check(self, v, t) | source code
Helping method to check whether a type statement is in line with a possible restriction. This method is invoked by rule "cls-avf" before setting a type on an allValuesFrom restriction. The method is a placeholder at this level. It is typically implemented by subclasses for extra checks, eg, for datatype facet checks. Parameters: `v` - the resource that is to be 'typed' `t` - the targeted type (ie, Class) Returns: boolean

### _one_time_rules_datatypes(self) | source code
Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once at the beginning of the process. These are: cls-thing, cls-nothing1, prp-ap, dt-types1, dt-types2, dt-eq, dt-diff. Note, however, that the dt-* are executed only partially, limited by the possibilities offered by RDFLib. These may not cover all the edge cases of OWL RL. Especially, dt-not-type has not (yet?) been implemented (I wonder whether RDFLib should not raise exception for those anyway...

### one_time_rules(self) | source code
Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once at the beginning of the process. These are: cls-thing, cls-nothing1, prp-ap, dt-types1, dt-types2, dt-eq, dt-diff. Overrides: Closure.Core.one_time_rules

### rules(self, t, cycle_num) | source code
Go through the various rule groups, as defined in the OWL-RL profile text and implemented via local methods. (The calling cycle takes every tuple in the graph.) Parameters: `t` - a triple (in the form of a tuple) `cycle_num` - which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph. Overrides: Closure.Core.rules

### _property_chain(self, p, x) | source code
Implementation of the property chain axiom, invoked from inside the property axiom handler. This is the implementation of rule prp-spo2, taken aside for an easier readability of the code.

### _equality(self, triple, cycle_num) | source code
Table 4: Semantics of equality. Essentially, the eq-* rules. Parameters: `triple` - triple to work on `cycle_num` - which cycle are we in, starting with 1. Can be used for some optimization.

### _properties(self, triple, cycle_num) | source code
Table 5: The Semantics of Axioms about Properties. Essentially, the prp-* rules. Parameters: `triple` - triple to work on `cycle_num` - which cycle are we in, starting with 1. Can be used for some optimization.

### _classes(self, triple, cycle_num) | source code
Table 6: The Semantics of Classes. Essentially, the cls-* rules Parameters: `triple` - triple to work on `cycle_num` - which cycle are we in, starting with 1. Can be used for some optimization.

### _class_axioms(self, triple, cycle_num) | source code
Table 7: Class Axioms. Essentially, the cax-* rules. Parameters: `triple` - triple to work on `cycle_num` - which cycle are we in, starting with 1. Can be used for some optimization.

### _schema_vocabulary(self, triple, cycle_num) | source code
Table 9: The Semantics of Schema Vocabulary. Essentially, the scm-* rules Parameters: `triple` - triple to work on `cycle_num` - which cycle are we in, starting with 1. Can be used for some optimization.