RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming

Package RDFClosure :: Module OWLRLExtras :: Class OWLRL_Extension_Trimming |
[hide private]
[frames] | no frames]

# Class OWLRL_Extension_Trimming

source code

                    Closure.Core --+
                                   |
          RDFSClosure.RDFS_Semantics --+
                                       |
                    Closure.Core --+   |
                                   |   |
               OWLRL.OWLRL_Semantics --+
                                       |
    CombinedClosure.RDFS_OWLRL_Semantics --+
                                           |
                             OWLRL_Extension --+
                                               |
                                              OWLRL_Extension_Trimming

This Class adds only one feature to OWLRL_Extension: to initialize with a trimming flag set to `True` by default.

This is pretty experimental and probably contentious: this class removes a number of triples from the Graph at the very end of the processing steps. These triples are either the by-products of the deductive closure calculation or are axiom like triples that are added following the rules of OWL 2 RL. While these triples are necessary for the correct inference of really 'useful' triples, they may not be of interest for the application for the end result. The triples that are removed are of the form (following a SPARQL-like notation):

- `?x owl:sameAs ?x`, `?x rdfs:subClassOf ?x`, `?x rdfs:subPropertyOf ?x`, `?x owl:equivalentClass ?x` type triples
- `?x rdfs:subClassOf rdf:Resource`, `?x rdfs:subClassOf owl:Thing`, `?x rdf:type rdf:Resource`, `owl:Nothing rdfs:subClassOf ?x` type triples
- For a datatype that does not appear explicitly in a type assignments (ie, in a `?x rdf:type dt`) the corresponding `dt rdf:type owl:Datatype` and `dt rdf:type owl:DataRange` triples, as well as the disjointness statements with other datatypes
- annotation property axioms
- a number of axiomatic triples on `owl:Thing`, `owl:Nothing` and `rdf:Resource` (eg, `owl:Nothing rdf:type owl:Class`, `owl:Thing owl:equivalentClass rdf:Resource`, etc.)

Trimming is the only feature of this class, done in the post_process step. If users extend OWLRL_Extension, this class can be safely mixed in via multiple inheritance.

Instance Methods | [hide private]
__init__(self, graph, axioms, daxioms, rdfs=False) | source code
post_process(self) Do some post-processing step performing the trimming of the graph. | source code
Inherited from `OWLRL_Extension`: `add_axioms`, `one_time_rules`, `restriction_typing_check`, `rules` Inherited from `OWLRL_Extension` (private): `_subsume_restricted_datatypes` Inherited from `CombinedClosure.RDFS_OWLRL_Semantics`: `add_d_axioms` Inherited from `Closure.Core`: `add_error`, `closure`, `empty_stored_triples`, `flush_stored_triples`, `get_literal_value`, `pre_process`, `store_triple` Inherited from `OWLRL.OWLRL_Semantics` (private): `_class_axioms`, `_classes`, `_equality`, `_get_resource_or_literal`, `_list`, `_one_time_rules_datatypes`, `_one_time_rules_misc`, `_properties`, `_property_chain`, `_schema_vocabulary`

Static Methods | [hide private]
Inherited from `CombinedClosure.RDFS_OWLRL_Semantics`: `add_new_datatype`

Class Variables | [hide private]
Inherited from `OWLRL_Extension`: `extra_axioms`

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

Method Details | [hide private]

### __init__(self, graph, axioms, daxioms, rdfs=False) (Constructor) | source code
Parameters: `graph` (rdflib.Graph) - the RDF graph to be extended `axioms` (Boolean) - whether (non-datatype) axiomatic triples should be added or not `daxioms` (Boolean) - whether datatype axiomatic triples should be added or not `rdfs` (boolean) - whether RDFS extension is done Overrides: OWLRL.OWLRL_Semantics.__init__

### post_process(self) | source code
Do some post-processing step performing the trimming of the graph. See the class description for further details. Overrides: OWLRL.OWLRL_Semantics.post_process