Package RDFClosure :: Module CombinedClosure :: Class RDFS_OWLRL_Semantics
[hide private]
[frames] | no frames]

Class RDFS_OWLRL_Semantics

source code

          Closure.Core --+    
                         |    
RDFSClosure.RDFS_Semantics --+
                             |
          Closure.Core --+   |
                         |   |
     OWLRL.OWLRL_Semantics --+
                             |
                            RDFS_OWLRL_Semantics
Known Subclasses:

Common subclass of the RDFS and OWL 2 RL semantic classes. All methods simply call back to the functions in the superclasses. This may lead to some unnecessary duplication of terms and rules, but it it not so bad. Also, the additional identification defined for OWL Full, ie, Resource being the same as Thing and OWL and RDFS classes being identical are added to the triple store.

Note that this class is also a possible user extension point: subclasses can be created that extend the standard functionality by extending this class. This class always performs RDFS inferences. Subclasses have to set the self.rdfs flag explicitly to the requested value if that is to be controlled.

Instance Methods [hide private]
 
__init__(self, graph, axioms, daxioms, rdfs=True) source code
 
post_process(self)
Do some post-processing step.
source code
 
rules(self, t, cycle_num)
Go through the RDFS entailment rules rdf1, rdfs4-rdfs12, by extending the graph.
source code
 
add_axioms(self)
Add axioms
source code
 
add_d_axioms(self)
This is not really complete, because it just uses the comparison possibilities that rdflib provides.
source code
 
one_time_rules(self)
Adds some extra axioms and calls for the d_axiom part of the OWL Semantics.
source code

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: restriction_typing_check

Static Methods [hide private]
 
add_new_datatype(uri, conversion_function, datatype_list, subsumption_dict=None, subsumption_key=None, subsumption_list=None)
If an extension wants to add new datatypes, this method should be invoked at initialization time.
source code
Instance Variables [hide private]
  full_binding_triples = [(rdflib.term.URIRef(u'http://www.w3.or...
additional axiom type triples that are added to the combined semantics; these 'bind' the RDFS and the OWL worlds together
boolean rdfs
whether RDFS inference is also done (used in subclassed only)

Inherited from Closure.Core: IMaxNum, added_triples, axioms, daxioms, error_messages, graph, literal_proxies

Method Details [hide private]

__init__(self, graph, axioms, daxioms, rdfs=True)
(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) - placeholder flag (used in subclassed only, it is always defaulted to True in this class)
Overrides: OWLRL.OWLRL_Semantics.__init__

add_new_datatype(uri, conversion_function, datatype_list, subsumption_dict=None, subsumption_key=None, subsumption_list=None)
Static Method

source code 

If an extension wants to add new datatypes, this method should be invoked at initialization time.

Parameters:
  • uri - URI for the new datatypes, like owl_ns["Rational"]
  • conversion_function - a function converting the lexical representation of the datatype to a Python value, possibly raising an exception in case of unsuitable lexical form
  • datatype_list - list of datatypes already in use that has to be checked
  • subsumption_dict - dictionary of subsumption hierarchies (indexed by the datatype URI-s)
  • subsumption_key - key in the dictionary, if None, the uri parameter is used
  • subsumption_list - list of subsumptions associated to a subsumption key (ie, all datatypes that are superclasses of the new datatype)

post_process(self)

source code 

Do some post-processing step. This method when all processing is done, but before handling possible errors (ie, the method can add its own error messages). By default, this method is empty, subclasses can add content to it by overriding it.

Overrides: OWLRL.OWLRL_Semantics.post_process

rules(self, t, cycle_num)

source code 

Go through the RDFS entailment rules rdf1, rdfs4-rdfs12, by extending 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: OWLRL.OWLRL_Semantics.rules

add_axioms(self)

source code 

Add axioms

Overrides: OWLRL.OWLRL_Semantics.add_axioms
(inherited documentation)

add_d_axioms(self)

source code 

This is not really complete, because it just uses the comparison possibilities that rdflib provides.

Overrides: OWLRL.OWLRL_Semantics.add_d_axioms
(inherited documentation)

one_time_rules(self)

source code 

Adds some extra axioms and calls for the d_axiom part of the OWL Semantics.

Overrides: OWLRL.OWLRL_Semantics.one_time_rules

Instance Variable Details [hide private]

full_binding_triples

additional axiom type triples that are added to the combined semantics; these 'bind' the RDFS and the OWL worlds together
Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Thing'),
  rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#equivalentClass')\
,
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Resource')\
),
 (rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Class'),
  rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#equivalentClass')\
,
...

rdfs

whether RDFS inference is also done (used in subclassed only)
Type:
boolean