Skip to content

Commit

Permalink
Added RDFS module. Refactored a bunch of other documentation for modu…
Browse files Browse the repository at this point in the history
…les that rendered large blobs of table data. Now there is a link to the source code in those large docs, and for the not so large ones, there's the source code embedded in the page.
  • Loading branch information
edmondchuc committed Nov 21, 2018
1 parent aff835e commit 7dd3953
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 106 deletions.
11 changes: 7 additions & 4 deletions RDFClosure/AxiomaticTriples.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from rdflib.namespace import XSD as ns_xsd
from .OWL import *

#: Simple RDF axiomatic triples (typing of subject, predicate, first, rest, etc)
# Simple RDF axiomatic triples (typing of subject, predicate, first, rest, etc)
_Simple_RDF_axiomatic_triples = [
(rdf_type, rdf_type, Property),
(rdf_subject, rdf_type, Property),
Expand All @@ -48,7 +48,7 @@
(nil, rdf_type, List),
]

#: RDFS axiomatic triples (domain and range, as well as class setting for a number of RDFS symbols)
# RDFS axiomatic triples (domain and range, as well as class setting for a number of RDFS symbols)
_RDFS_axiomatic_triples = [
(rdf_type, rdfs_domain, Resource),
(rdfs_domain, rdfs_domain, Property),
Expand Down Expand Up @@ -159,6 +159,7 @@
(ns_xsd['dateTimeStamp'], subClassOf, ns_xsd['dateTime']),
]

#:
RDFS_D_Axiomatic_Triples_types = [
(ns_xsd['integer'], rdf_type, Datatype),
(ns_xsd['decimal'], rdf_type, Datatype),
Expand Down Expand Up @@ -195,7 +196,7 @@

RDFS_D_Axiomatic_Triples = RDFS_D_Axiomatic_Triples_types + RDFS_D_Axiomatic_Triples_subclasses

#: OWL Class axiomatic triples: definition of special classes
# OWL Class axiomatic triples: definition of special classes
_OWL_axiomatic_triples_Classes = [
(AllDifferent, rdf_type, Class),
(AllDifferent, subClassOf, Resource),
Expand Down Expand Up @@ -593,6 +594,7 @@
(ns_rdf['PlainLiteral'], rdf_type, Datatype)
]

#:
OWL_D_Axiomatic_Triples_subclasses = [
(ns_xsd['string'], subClassOf, ns_rdf['PlainLiteral']),
(ns_xsd['normalizedString'], subClassOf, ns_rdf['PlainLiteral']),
Expand All @@ -602,6 +604,7 @@
(ns_xsd['NMTOKEN'], subClassOf, ns_rdf['PlainLiteral'])
]

#:
OWLRL_Datatypes_Disjointness = [
(ns_xsd["anyURI"], disjointWith, ns_xsd['base64Binary']),
(ns_xsd["anyURI"], disjointWith, ns_xsd['boolean']),
Expand Down Expand Up @@ -667,7 +670,7 @@
]

#: OWL RL D Axiomatic triples: combination of the RDFS ones, plus some extra statements on ranges and domains, plus
# some OWL specific datatypes
#: some OWL specific datatypes
OWLRL_D_Axiomatic_Triples = RDFS_D_Axiomatic_Triples + _OWL_D_Axiomatic_Triples_types + \
OWL_D_Axiomatic_Triples_subclasses + OWLRL_Datatypes_Disjointness

Expand Down
2 changes: 0 additions & 2 deletions RDFClosure/DatatypeHandling.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ def _strToPlainLiteral(v):
}


# noinspection PyPep8Naming
def use_Alt_lexical_conversions():
"""
Registering the datatypes item for RDFLib, ie, bind the dictionary values. The 'bind' method of RDFLib adds
Expand All @@ -664,7 +663,6 @@ def use_Alt_lexical_conversions():
_toPythonMapping.update(AltXSDToPYTHON)


# noinspection PyPep8Naming
def use_RDFLib_lexical_conversions():
"""
Restore the original (ie, RDFLib) set of lexical conversion routines.
Expand Down
2 changes: 1 addition & 1 deletion RDFClosure/OWL.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from rdflib import Namespace


#: The OWL namespace as used for RDFLib
# The OWL namespace as used for RDFLib
OWLNS = Namespace("http://www.w3.org/2002/07/owl#")

annotatedSource = OWLNS["annotatedSource"]
Expand Down
22 changes: 16 additions & 6 deletions RDFClosure/RDFS.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
"""
RDF(S) terms. Note that the set of terms is I{complete}, ie, it includes I{all} OWL 2 terms, regardless of whether the
RDF(S) terms. Note that the set of terms is *complete*, i.e., it includes *all* OWL 2 terms, regardless of whether the
term is used in OWL 2 RL or not.
@requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher
@license: This software is available for use under the U{W3C Software
License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>}
@organization: U{World Wide Web Consortium<http://www.w3.org>}
@author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">}
**Requires**: `RDFLib`_, 4.0.0 and higher.
.. _RDFLib: https://github.com/RDFLib/rdflib
**License**: This software is available for use under the `W3C Software License`_.
.. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
**Organization**: `World Wide Web Consortium`_
.. _World Wide Web Consortium: http://www.w3.org
**Author**: `Ivan Herman`_
.. _Ivan Herman: http://www.w3.org/People/Ivan/
"""

import rdflib
Expand Down
4 changes: 3 additions & 1 deletion docs/source/AxiomaticTriples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ AxiomaticTriples
:members:
:undoc-members:
:inherited-members:
:show-inheritance:
:show-inheritance:

.. seealso:: View the source code :ref:`AxiomaticTriples`.
7 changes: 7 additions & 0 deletions docs/source/AxiomaticTriples_source.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _AxiomaticTriples:

AxiomaticTriples.py
-------------------

.. literalinclude:: ../../RDFClosure/AxiomaticTriples.py
:linenos:
8 changes: 7 additions & 1 deletion docs/source/DatatypeHandling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ DatatypeHandling
AltXSDToPYTHON Table
--------------------

.. note:: The code below is not extracted automatically from the source code.

If there are any errors, please make a pull request or an issue: https://github.com/RDFLib/OWL-RL

.. code-block:: python
AltXSDToPYTHON = {
Expand Down Expand Up @@ -55,4 +59,6 @@ AltXSDToPYTHON Table
ns_xsd["gMonthDay"]: _strTogMonthDay,
ns_xsd["gDay"]: _strTogDay,
ns_xsd["gMonth"]: _strTogMonth,
}
}
.. seealso:: View the source code :ref:`DatatypeHandling`.
7 changes: 7 additions & 0 deletions docs/source/DatatypeHandling_source.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _DatatypeHandling:

DatatypeHandling.py
-------------------

.. literalinclude:: ../../RDFClosure/DatatypeHandling.py
:linenos:
95 changes: 4 additions & 91 deletions docs/source/OWL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,95 +7,8 @@ OWL
:inherited-members:
:show-inheritance:

Variables
---------
Source code
-----------

.. code-block:: python
import rdflib
from rdflib import Namespace
#: The OWL namespace as used for RDFLib
OWLNS = Namespace("http://www.w3.org/2002/07/owl#")
annotatedSource = OWLNS["annotatedSource"]
annotatedTarget = OWLNS["annotatedTarget"]
annotatedProperty = OWLNS["annotatedProperty"]
allValuesFrom = OWLNS["allValuesFrom"]
assertionProperty = OWLNS["assertionProperty"]
backwardCompatibleWith = OWLNS["backwardCompatibleWith"]
cardinality = OWLNS["cardinality"]
complementOf = OWLNS["complementOf"]
BottomDataProperty = OWLNS["BottomDataProperty"]
BottomObjectProperty = OWLNS["BottomObjectProperty"]
datatypeComplementOf = OWLNS["datatypeComplementOf"]
deprecated = OWLNS["deprecated"]
differentFrom = OWLNS["differentFrom"]
disjointUnionOf = OWLNS["disjointUnionOf"]
disjointClasses = OWLNS["disjointClasses"]
disjointWith = OWLNS["disjointWith"]
distinctMembers = OWLNS["distinctMembers"]
equivalentClass = OWLNS["equivalentClass"]
equivalentProperty = OWLNS["equivalentProperty"]
hasKey = OWLNS["hasKey"]
hasValue = OWLNS["hasValue"]
hasSelf = OWLNS["hasSelf"]
imports = OWLNS["imports"]
incompatibleWith = OWLNS["incompatibleWith"]
intersectionOf = OWLNS["intersectionOf"]
inverseOf = OWLNS["inverseOf"]
maxCardinality = OWLNS["maxCardinality"]
maxQualifiedCardinality = OWLNS["maxQualifiedCardinality"]
members = OWLNS["members"]
minCardinality = OWLNS["minCardinality"]
minQualifiedCardinality = OWLNS["minQualifiedCardinality"]
onClass = OWLNS["onClass"]
onDataRange = OWLNS["onDataRange"]
onDatatype = OWLNS["onDatatype"]
oneOf = OWLNS["oneOf"]
onProperty = OWLNS["onProperty"]
onProperties = OWLNS["onProperties"]
OWLpredicate = OWLNS["predicate"]
priorVersion = OWLNS["priorVersion"]
propertyChainAxiom = OWLNS["propertyChainAxiom"]
propertyDisjointWith = OWLNS["propertyDisjointWith"]
qualifiedCardinality = OWLNS["qualifiedCardinality"]
sameAs = OWLNS["sameAs"]
someValuesFrom = OWLNS["someValuesFrom"]
sourceIndividual = OWLNS["sourceIndividual"]
OWLsubject = OWLNS["subject"]
targetIndividual = OWLNS["targetIndividual"]
targetValue = OWLNS["targetValue"]
TopDataProperty = OWLNS["TopDataProperty"]
TopObjectProperty = OWLNS["TopObjectProperty"]
unionOf = OWLNS["unionOf"]
versionInfo = OWLNS["versionInfo"]
versionIRI = OWLNS["versionIRI"]
withRestrictions = OWLNS["withRestrictions"]
AllDisjointProperties = OWLNS["AllDisjointProperties"]
AllDifferent = OWLNS["AllDifferent"]
AllDisjointClasses = OWLNS["AllDisjointClasses"]
Annotation = OWLNS["Annotation"]
AnnotationProperty = OWLNS["AnnotationProperty"]
AsymmetricProperty = OWLNS["AsymmetricProperty"]
Axiom = OWLNS["Axiom"]
OWLClass = OWLNS["Class"]
DataRange = OWLNS["DataRange"]
DatatypeProperty = OWLNS["DatatypeProperty"]
DeprecatedClass = OWLNS["DeprecatedClass"]
DeprecatedProperty = OWLNS["DeprecatedProperty"]
FunctionalProperty = OWLNS["FunctionalProperty"]
InverseFunctionalProperty = OWLNS["InverseFunctionalProperty"]
IrreflexiveProperty = OWLNS["IrreflexiveProperty"]
NamedIndividual = OWLNS["NamedIndividual"]
NegativePropertyAssertion = OWLNS["NegativePropertyAssertion"]
Nothing = OWLNS["Nothing"]
ObjectProperty = OWLNS["ObjectProperty"]
Ontology = OWLNS["Ontology"]
OntologyProperty = OWLNS["OntologyProperty"]
ReflexiveProperty = OWLNS["ReflexiveProperty"]
Restriction = OWLNS["Restriction"]
Thing = OWLNS["Thing"]
SelfRestriction = OWLNS["SelfRestriction"]
SymmetricProperty = OWLNS["SymmetricProperty"]
TransitiveProperty = OWLNS["TransitiveProperty"]
.. literalinclude:: ../../RDFClosure/OWL.py
:linenos:
15 changes: 15 additions & 0 deletions docs/source/RDFS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
RDFS
====

.. automodule:: RDFClosure.RDFS
:members:
:undoc-members:
:inherited-members:
:show-inheritance:


Source code
-----------

.. literalinclude:: ../../RDFClosure/RDFS.py
:linenos:
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ OWL-RL Documentation
OWL
OWLRL
OWLRLExtras
RDFS
RDFSClosure
XsdDatatypes
RestrictedDatatype
Expand Down

0 comments on commit 7dd3953

Please sign in to comment.