Skip to content

Commit

Permalink
Went through all the code for PEP and others; except for the Datatype…
Browse files Browse the repository at this point in the history
…Handling.py module that requires a more thorough check with rdflib 4
  • Loading branch information
iherman committed Jan 23, 2014
1 parent 1cfc7f1 commit 44a6ac3
Show file tree
Hide file tree
Showing 7 changed files with 563 additions and 565 deletions.
20 changes: 11 additions & 9 deletions RDFClosure/CombinedClosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
"""

"""
$Id: CombinedClosure.py,v 1.7 2011/08/04 12:41:57 ivan Exp $ $Date: 2011/08/04 12:41:57 $
"""

__author__ = 'Ivan Herman'
__contact__ = 'Ivan Herman, [email protected]'
__license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231'
Expand All @@ -31,6 +27,7 @@
######################################################################################################


# noinspection PyPep8Naming
class RDFS_OWLRL_Semantics(RDFS_Semantics, OWLRL_Semantics):
"""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
Expand All @@ -51,22 +48,25 @@ class RDFS_OWLRL_Semantics(RDFS_Semantics, OWLRL_Semantics):
(Class, equivalentClass, OWLClass),
(DataRange, equivalentClass, Datatype)
]

def __init__(self, graph, axioms, daxioms, rdfs=True):
"""
@param graph: the RDF graph to be extended
@type graph: rdflib.Graph
@param axioms: whether (non-datatype) axiomatic triples should be added or not
@type axioms: Boolean
@type axioms: bool
@param daxioms: whether datatype axiomatic triples should be added or not
@type daxioms: Boolean
@type daxioms: bool
@param rdfs: placeholder flag (used in subclassed only, it is always defaulted to True in this class)
@type rdfs: boolean
"""
OWLRL_Semantics.__init__(self, graph, axioms, daxioms, rdfs)
RDFS_Semantics.__init__(self, graph, axioms, daxioms, rdfs)
self.rdfs = True

def add_new_datatype(self, uri, conversion_function, datatype_list, subsumption_dict=None, subsumption_key=None, subsumption_list=None):
# noinspection PyMethodMayBeStatic
@staticmethod
def 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.
@param uri : URI for the new datatypes, like owl_ns["Rational"]
Expand All @@ -79,7 +79,8 @@ def add_new_datatype(self, uri, conversion_function, datatype_list, subsumption_
"""
from DatatypeHandling import AltXSDToPYTHON, use_Alt_lexical_conversions

if datatype_list : datatype_list.append(uri)
if datatype_list:
datatype_list.append(uri)

if subsumption_dict and subsumption_list:
if subsumption_key:
Expand Down Expand Up @@ -119,7 +120,8 @@ def add_d_axioms(self):

def one_time_rules(self):
"""Adds some extra axioms and calls for the d_axiom part of the OWL Semantics."""
for t in self.full_binding_triples : self.store_triple(t)
for t in self.full_binding_triples:
self.store_triple(t)

# Note that the RL one time rules include the management of datatype which is a true superset
# of the rules in RDFS. It is therefore unnecessary to add those even self.rdfs is True.
Expand Down
Loading

0 comments on commit 44a6ac3

Please sign in to comment.