From 9a23615712e8e203c2942ecdd9a10671eb4fe27e Mon Sep 17 00:00:00 2001 From: Ashley Sommer Date: Fri, 23 Nov 2018 09:03:17 +1000 Subject: [PATCH] Renamed module from RDFClosure to owlrl Added a new modern setup.py based on latest setuptools - old setup.py is archived as setup.py.old added python Trove Classifiers for extra metadata Updated docs to reflect module name change added some new info to the changelog in the README file Bumped version to 5.1.0 to reflect recent significant changes Released on pypi!!! --- .gitignore | 6 +- LICENSE.txt | 2 +- MANIFEST.in | 3 + PKG-INFO | 233 +++++++++++++++++- README.rst | 39 ++- README_OLD.md | 2 +- docs/source/AxiomaticTriples.rst | 2 +- docs/source/AxiomaticTriples_source.rst | 2 +- docs/source/Closure.rst | 2 +- docs/source/CombinedClosure.rst | 2 +- docs/source/DatatypeHandling.rst | 2 +- docs/source/DatatypeHandling_source.rst | 2 +- docs/source/Literals.rst | 2 +- docs/source/OWL.rst | 4 +- docs/source/OWLRL.rst | 2 +- docs/source/OWLRLExtras.rst | 2 +- docs/source/RDFS.rst | 4 +- docs/source/RDFSClosure.rst | 2 +- docs/source/RestrictedDatatype.rst | 4 +- docs/source/XsdDatatypes.rst | 2 +- docs/source/XsdDatatypes_source.rst | 2 +- docs/source/conf.py | 4 +- docs/source/index.rst | 2 +- docs/source/{RDFClosure.rst => owlrl.rst} | 6 +- ...FClosure.Closure.rst => owlrl.Closure.rst} | 6 +- ...Closure.rst => owlrl.DeductiveClosure.rst} | 6 +- .../stubs/{RDFClosure.rst => owlrl.rst} | 6 +- docs/source/usage.rst | 2 +- {RDFClosure => owlrl}/AxiomaticTriples.py | 10 +- {RDFClosure => owlrl}/Closure.py | 6 +- {RDFClosure => owlrl}/CombinedClosure.py | 8 +- {RDFClosure => owlrl}/DatatypeHandling.py | 2 +- {RDFClosure => owlrl}/Literals.py | 9 +- {RDFClosure => owlrl}/OWL.py | 0 {RDFClosure => owlrl}/OWLRL.py | 16 +- {RDFClosure => owlrl}/OWLRLExtras.py | 0 {RDFClosure => owlrl}/RDFS.py | 0 {RDFClosure => owlrl}/RDFSClosure.py | 12 +- {RDFClosure => owlrl}/RestrictedDatatype.py | 19 +- {RDFClosure => owlrl}/XsdDatatypes.py | 0 {RDFClosure => owlrl}/__init__.py | 11 +- requirements-dev.txt | 5 +- requirements.txt | 2 +- scripts/RDFConvertService.py | 4 +- scripts/closure.py | 2 +- setup.py | 86 ++++++- setup.py.old | 12 + tests/test_basic.py | 6 +- tests/test_datatypes.py | 8 +- 49 files changed, 448 insertions(+), 123 deletions(-) create mode 100644 MANIFEST.in rename docs/source/{RDFClosure.rst => owlrl.rst} (62%) rename docs/source/stubs/{RDFClosure.Closure.rst => owlrl.Closure.rst} (56%) rename docs/source/stubs/{RDFClosure.DeductiveClosure.rst => owlrl.DeductiveClosure.rst} (82%) rename docs/source/stubs/{RDFClosure.rst => owlrl.rst} (82%) rename {RDFClosure => owlrl}/AxiomaticTriples.py (98%) rename {RDFClosure => owlrl}/Closure.py (98%) rename {RDFClosure => owlrl}/CombinedClosure.py (96%) rename {RDFClosure => owlrl}/DatatypeHandling.py (99%) rename {RDFClosure => owlrl}/Literals.py (97%) rename {RDFClosure => owlrl}/OWL.py (100%) rename {RDFClosure => owlrl}/OWLRL.py (99%) rename {RDFClosure => owlrl}/OWLRLExtras.py (100%) rename {RDFClosure => owlrl}/RDFS.py (100%) rename {RDFClosure => owlrl}/RDFSClosure.py (95%) rename {RDFClosure => owlrl}/RestrictedDatatype.py (98%) rename {RDFClosure => owlrl}/XsdDatatypes.py (100%) rename {RDFClosure => owlrl}/__init__.py (99%) create mode 100755 setup.py.old diff --git a/.gitignore b/.gitignore index 78a46b1..09a3964 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,8 @@ /venv/ -docs/build/ \ No newline at end of file +docs/build/ + +build/ +dist/ +*.egg-info/ diff --git a/LICENSE.txt b/LICENSE.txt index bb4d380..88ee4b2 100755 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -RDFClosure is released under the W3C© SOFTWARE NOTICE AND LICENSE, see: +owlrl is released under the W3C© SOFTWARE NOTICE AND LICENSE, see: http://href="http//www.w3.org/Consortium/Legal/2002/copyright-software-20021231%22 diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d9d5ac8 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include *.txt *.md *.rst +recursive-include docs *.txt *.md *.rst + diff --git a/PKG-INFO b/PKG-INFO index 4272c66..ae9fa50 100755 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,9 +1,228 @@ -Metadata-Version: 1.0 -Name: RDFClosure -Version: 5.0.0 -Summary: RDF Closure +Metadata-Version: 1.2 +Name: owlrl +Version: 5.1.0 +Summary: OWL-RL and RDFS based RDF Closure inferencing +Home-page: https://github.com/RDFLib/OWL-RL/ Author: Ivan Herman -Author-email: ivan@w3.org -License: W3C© SOFTWARE NOTICE AND LICENSE -Description: UNKNOWN +Author-email: ivan@ivan-herman.net +Maintainer: Nicholas Car +Maintainer-email: nicholas.car@csiro.au +License: LICENSE.txt +Download-URL: https://github.com/RDFLib/OWL-RL/archive/v5.1.0.tar.gz +Description: |Original Author DOI| + + .. |Original Author DOI| image:: https://zenodo.org/badge/9385/RDFLib/OWL-RL.svg + :target: http://dx.doi.org/10.5281/zenodo.14543 + + + OWL-RL + ====== + + A simple implementation of the OWL2 RL Profile, as well as a basic RDFS inference, on top of RDFLib. Based mechanical forward chaining. The distribution contains: + + **OWL-RL**: the Python library. You should copy the directory somewhere into your :code:`PYTHONPATH`. Alternatively, you can also run the :code:`python setup.py install` script in the directory. + + * :code:`scripts/RDFConvertService.py`: can be used as a CGI script to invoke the library. It may have to be adapted to the local server setup. + + * :code:`scripts/closure.py`: script that can be run locally on to transform a file into RDF (on the standard output). Run the script with :code:`-h` to get the available flags. + + The package requires Python version 3.5 or higher; it depends on `RDFLib`_; version 4.2.2 or higher is required. If you need the python 2.7.x compatible version, see the @/py2 branch in this repository. + + .. _RDFLib: https://github.com/RDFLib + + For the details on RDFS, see the `RDF Semanics Specification`_; for OWL 2 RL, see the `OWL 2 Profile specification`_. + + .. _RDF Semanics Specification: http://www.w3.org/TR/rdf11-mt/ + .. _OWL 2 Profile specification: http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules + + View the **OWL-RL documentation** online: http://owl-rl.readthedocs.io/ + + Release notes (starting from version 3) + --------------------------------------- + + + v5.1.0 + ~~~~~~ + + Changes: + + * Rename module from RDFClosure to owlrl + + * Published on PyPI! + + * Fixed bugs caused by python3 automatic conversion (like :code:`range` being a variabe, not a function) + + * Added some basic tests (more tests coming!) + + * Started foundational work to remove :code:`LiteralProxies` in the future (thanks :code:`@wrobell`) + + * Simplified some sections of the code (thanks :code:`@wrobell`) + + + + Version 5.0.0 + ~~~~~~~~~~~~~ + + Changes: + + * Port to Python3. Minimum recommended version is now Python v3.5. + + * Fixed a bug where the inferencing process would crash if the engine encountered a literal node that has a datatype for which it does not have a hardcoded converter. + + + + Version 4/5 + ~~~~~~~~~~~ + + This is a major release: the package has been updated to Python 2.7 and RDFLib 4 (and to Python 3.5 in v5.0.0). + + Some important changes: + + * The local parser and serializer implementations have been removed; the package relies fully on RDFLib. + + * If the extra JSON-LD parser and serializer is available, that format may also be used both for input and output. + + * RDFa as a possible input format has been added. + + * The datatype part has been reworked to adapt itself to the way RDFLib handles datatypes. + + * The :code:`Literal` class has been adapted to the latest versions of RDFLib's :code:`Literal` (there is no :code:`cmp_value` any more, only value) + + * Python 2.7 includes an implementation for rational numbers (under the name :code:`Fraction`), so the separate module became moot. + + * The :code:`script` directory has been moved to the top level of the distribution. + + * The RDF1.1 specific datatypes (:code:`LangString` and :code:`HTML`) have been added, although the :code:`HTML` is simply treated as a text (a reliance on the HTML5 Library may be too much for what this is worth…) + + * The :code:`closure` script has now an extra flag (:code:`-m`) to use the "maximal" entailment, i.e., extended OWLRL+RDF with extra trimmings. + + + Version 4.2.1 + ~~~~~~~~~~~~~ + + Changes: + + * Per error report of Michael Schneider: if a class name is a blank node, the XML serialization went wrong. In case of exception, the fall back is to use the pure xml rather than the pretty xml; that works. There was also a 'trimming' argument missing in case of a pure format conversion that led to an exception, that is handled, too. + + Version 4.2 + ~~~~~~~~~~~ + + Changes: + + * I exchanged rdflib Graph usage to rdflib ConjunctiveGraph. It avoids issues around deprecation and is also a possible entry point for named graphs. + + * Added an extra check in the allValuesFrom handling for datatype restrictions. This does not affect pure OWLRL but is used by the extras that implement facets. + + * The RestrictedDatatype class has now a 'Core' superclass; this can be used by other restricted datatypes that are not necessarily defined in OWL 2 + + Version 4.1 + ~~~~~~~~~~~ + + Changes: + + * On advise from Dominique, the error message in the CGI script uses cgi.escape on the text input before displaying it. + + * 'Trimming' has been added to the command line options + + * Adaptation to rdflib 2.4.2 (or even 2.4.1?): the :code:`Literal._PythonToXSD` changed its structure from a dictionary to a list of tuples; :code:`DatatypeHandling.use_Alt_lexical_conversions()` had to change. + + Version 4.0 + ~~~~~~~~~~~ + + Changes: + + * The top level :code:`__init__` file has been reorganized, so that the package can be used as a module for applications in RDFLib. There is a top level class (:code:`DeductiveClosure`) that can be invoked from an RDFLib application and the old entry point (:code:`convert_graph`) relies on that. + + * New class have been added to cover a combined RDFS + OWL 2 RL closure (Michael Schneider's idea). + + * An extension mechanism has been built in from bottom up; user can define his/her own rules via an extension class that is given as a parameter to the core closure class. + + * Using the extension mechanism a separate OWLRLExtras module has been added to implement, eg, self restriction, rational datatype. + + * In the closure class the array of temporarily stored tuples has been exchanged against a set; in other words, checking whether the tuple is to be stored already is now done by the built-in set operation. It became much faster... + + * The input argument has changed from 'source' to 'sources'; ie, several input files can be given to the service at the same time (eg, a separate URI for the data and the ontology, respectively). + + * Added the implementation of owl:imports. + + * Added an implemenatation for the datatype restrictions. + + * Bugs: + * there was an optimization in the datatype handling of OWLRL that excluded subsumptions for 'implicit' literals, ie, literals that are given datatypes via the ^^ formalism (and not via sameAs and explicit datatype definitions). But this excluded proper inferences for existential restrictions...:-( + + * handler for the :code:`xsd:normalizedString` datatype was missing. + + Version 3.2 + ~~~~~~~~~~~ + + Note: this version passes the full batch of official OWL Full/RL tests uploaded by Michael Schneider to the OWL Working Group site. The difference, in this respect, between this version and version 3.1 is the handling of datatypes (which was only rudimentary in 3.1) + + * Bugs: + * the rules on dt-diff/dt-eq were missing in the implementation. (My mistake: I did not realize that ( owl:sameAs "adfa") was a possible setups whereby those rules do come in even in practice, so I did not implement them thinking that the results would not appear in the final code anyway due to a literal appearing in a subject position. Clearly an error in judgement.) + + * :code:`PlainLiteral` was in a wrong namespace in the OWLRL file:-( + + * Added an explicit handling for virtually all data types, to check the lexical values. (This is, in fact, a RDFLib deficiency for most cases, except those that came in via OWL, like PlainLiteral...) + + * Added a note referring to a Turtle parser bug... + + Version 3.1 + ~~~~~~~~~~~ + + Note: this version passes the first, basic batch of official OWL Full/RL tests uploaded by Michael Schneider to the OWL Working Group site. + + * Bugs: + * if the URI of a predicate did not correspond to a defined namespace, the extra namespace declaration did not appear in the pretty xml output. Typical situation: the user defines a namespace without trailing '#' or '/', but uses the prefix nevertheless; this ends up in a URI for, say, a predicate or a type that cannot be represented in XML. The proper approach is then to add a new prefix with 'http://' and use that in the output. + + The original XML serialization of RDFLib does that; the PrettyXMLSerialization did not. The pretty XML serialization is based on the one of RDFLib, and has therefore inherited this bug. + + * the axiomatic expression for (byte subclass short) was misspelled to (byte subclass byte) + + * the axiomatic triples added automatically should say (Thing type :code:`owl:Class`) (and not :code:`rdfs:Class` as before). Also, (Nothing type :code:`owl:Class`) was missing there. + + * :code:`rdf:text` changed to :code:`rdf:PlainLiteral` (in the axiomatic triples), as a result of the OWL WG on changing the name. + + * missing subclass relationship for dateTimeStamp vs dateTime. + + * there was an optimization that added Datatype triples only for those datatypes that appeared as part of a literal in the input graph. However, the rule set requires those triples to be added no matter what. At the moment, this is pending (there are discussions in the group on this). + + * the set of triples declaring annotation properties were missing + + * error message for asymmetric properties was bogus (has :code:`%p` instead of :code:`%s` in the text). + + * there was a leftover error message via exceptions for :code:`owl:Nothing` check. + + * rule :code:`scm-eqc2` was missing :-( + + * New Features: + * added some support to booleans; essentially introducing a stronger check (according to XSD the :code:`"111"^xsd:boolean` is not a valid boolean values, though RDFLib accepts it as such...). + + * triples with a bnode predicate were systematically filtered out when added to a graph. However, incoming ontologies may include statements like '[ owl:inverseOf P]', and processing those through the rule set requires to allow such triples during deduction. Lucklily RDFLib is relaxed on that. So such 'generalized' triples are now allowed during the forward chaining and are filtered out only once, right before serialization. + + * some improvements on the datatype handling: + * adding type relationships to super(data)types. For example, if the original graph includes (:code:` rdf:type xsd:short`), then the triple (:code:` rdf:type xsd:integer`), etc, is also added. As an optimization the (:code:`xsd:short rdfs:subClassOf xsd:integer`) triples are not added, but the direct datatyping is done instead. + * adding disjointness information on datatypes on top of the hierarchy. This means that inconsistencies of the sort :code:` ex:prop 123 . ex:prop "1"^^xsd:boolean`. will be detected (integers and booleans must be disjoing per XSD; the explicit type relationships and the disjointness of some data types will trigger the necessary rules). + + Note that, mainly the first rule, is really useful when generic nodes are used as datatypes, as opposed to explicit literals. + + * added the possibility to set the input format explicitly, and changed the RDFConvert script accordingly (the service is not yet changed...). + + * added the possibility to consume standard input. +Keywords: Linked Data,Semantic Web,Python,triples,inferencing,RDF,OWL,OWL-RL,owlrl,RDFS Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Topic :: Utilities +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: W3C License +Classifier: Natural Language :: English +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Operating System :: OS Independent diff --git a/README.rst b/README.rst index 2b836a2..6b85f50 100644 --- a/README.rst +++ b/README.rst @@ -29,6 +29,37 @@ View the **OWL-RL documentation** online: http://owl-rl.readthedocs.io/ Release notes (starting from version 3) --------------------------------------- + +v5.1.0 +~~~~~~ + +Changes: + +* Rename module from RDFClosure to owlrl + +* Published on PyPI! + +* Fixed bugs caused by python3 automatic conversion (like :code:`range` being a variabe, not a function) + +* Added some basic tests (more tests coming!) + +* Started foundational work to remove :code:`LiteralProxies` in the future (thanks :code:`@wrobell`) + +* Simplified some sections of the code (thanks :code:`@wrobell`) + + + +Version 5.0.0 +~~~~~~~~~~~~~ + +Changes: + +* Port to Python3. Minimum recommended version is now Python v3.5. + +* Fixed a bug where the inferencing process would crash if the engine encountered a literal node that has a datatype for which it does not have a hardcoded converter. + + + Version 4/5 ~~~~~~~~~~~ @@ -54,14 +85,6 @@ Some important changes: * The :code:`closure` script has now an extra flag (:code:`-m`) to use the "maximal" entailment, i.e., extended OWLRL+RDF with extra trimmings. -Version 5.0.0 -~~~~~~~~~~~~~ - -Changes: - -* Port to Python3. Minimum recommended version is now Python v3.5. - -* Fixed a bug where the inferencing process would crash if the engine encountered a literal node that has a datatype for which it does not have a hardcoded converter. Version 4.2.1 ~~~~~~~~~~~~~ diff --git a/README_OLD.md b/README_OLD.md index c7af9aa..a6c1dd2 100644 --- a/README_OLD.md +++ b/README_OLD.md @@ -5,7 +5,7 @@ A simple implementation of the OWL2 RL Profile, as well as a basic RDFS inference, on top of RDFLib. Based mechanical forward chaining. The distribution contains: -* ``RDFClosure``: the Python library. You should copy the directory somewhere into your ``PYTHONPATH``. Alternatively, you can also run the ``python setup.py install`` script in the directory. +* ``owlrl``: the Python library. You should copy the directory somewhere into your ``PYTHONPATH``. Alternatively, you can also run the ``python setup.py install`` script in the directory. * ``scripts/RDFConvertService.py``: can be used as a CGI script to invoke the library. It may have to be adapted to the local server setup. diff --git a/docs/source/AxiomaticTriples.rst b/docs/source/AxiomaticTriples.rst index 360626a..02ba2f9 100644 --- a/docs/source/AxiomaticTriples.rst +++ b/docs/source/AxiomaticTriples.rst @@ -1,7 +1,7 @@ AxiomaticTriples ================ -.. automodule:: RDFClosure.AxiomaticTriples +.. automodule:: owlrl.AxiomaticTriples :members: :undoc-members: :inherited-members: diff --git a/docs/source/AxiomaticTriples_source.rst b/docs/source/AxiomaticTriples_source.rst index b68f8e2..54b5e47 100644 --- a/docs/source/AxiomaticTriples_source.rst +++ b/docs/source/AxiomaticTriples_source.rst @@ -3,5 +3,5 @@ AxiomaticTriples.py ------------------- -.. literalinclude:: ../../RDFClosure/AxiomaticTriples.py +.. literalinclude:: ../../owlrl/AxiomaticTriples.py :linenos: \ No newline at end of file diff --git a/docs/source/Closure.rst b/docs/source/Closure.rst index 2aea11a..755344c 100644 --- a/docs/source/Closure.rst +++ b/docs/source/Closure.rst @@ -1,7 +1,7 @@ Closure ======= -.. automodule:: RDFClosure.Closure +.. automodule:: owlrl.Closure :members: :undoc-members: :inherited-members: diff --git a/docs/source/CombinedClosure.rst b/docs/source/CombinedClosure.rst index de83f16..ad020dc 100644 --- a/docs/source/CombinedClosure.rst +++ b/docs/source/CombinedClosure.rst @@ -1,7 +1,7 @@ CombinedClosure =============== -.. automodule:: RDFClosure.CombinedClosure +.. automodule:: owlrl.CombinedClosure :members: :undoc-members: :inherited-members: diff --git a/docs/source/DatatypeHandling.rst b/docs/source/DatatypeHandling.rst index 53ef06b..e09aa04 100644 --- a/docs/source/DatatypeHandling.rst +++ b/docs/source/DatatypeHandling.rst @@ -1,7 +1,7 @@ DatatypeHandling ================ -.. automodule:: RDFClosure.DatatypeHandling +.. automodule:: owlrl.DatatypeHandling :members: :undoc-members: :inherited-members: diff --git a/docs/source/DatatypeHandling_source.rst b/docs/source/DatatypeHandling_source.rst index f0fee2a..6217bc8 100644 --- a/docs/source/DatatypeHandling_source.rst +++ b/docs/source/DatatypeHandling_source.rst @@ -3,5 +3,5 @@ DatatypeHandling.py ------------------- -.. literalinclude:: ../../RDFClosure/DatatypeHandling.py +.. literalinclude:: ../../owlrl/DatatypeHandling.py :linenos: \ No newline at end of file diff --git a/docs/source/Literals.rst b/docs/source/Literals.rst index 2d1c7fb..09d3858 100644 --- a/docs/source/Literals.rst +++ b/docs/source/Literals.rst @@ -1,7 +1,7 @@ Literals ======== -.. automodule:: RDFClosure.Literals +.. automodule:: owlrl.Literals :members: :undoc-members: :inherited-members: diff --git a/docs/source/OWL.rst b/docs/source/OWL.rst index 06ba2ad..744ba14 100644 --- a/docs/source/OWL.rst +++ b/docs/source/OWL.rst @@ -1,7 +1,7 @@ OWL === -.. automodule:: RDFClosure.OWL +.. automodule:: owlrl.OWL :members: :undoc-members: :inherited-members: @@ -10,5 +10,5 @@ OWL Source code ----------- -.. literalinclude:: ../../RDFClosure/OWL.py +.. literalinclude:: ../../owlrl/OWL.py :linenos: \ No newline at end of file diff --git a/docs/source/OWLRL.rst b/docs/source/OWLRL.rst index 47481cb..4c4b3cf 100644 --- a/docs/source/OWLRL.rst +++ b/docs/source/OWLRL.rst @@ -1,7 +1,7 @@ OWLRL ===== -.. automodule:: RDFClosure.OWLRL +.. automodule:: owlrl.OWLRL :members: :undoc-members: :inherited-members: diff --git a/docs/source/OWLRLExtras.rst b/docs/source/OWLRLExtras.rst index db0c509..f7fd678 100644 --- a/docs/source/OWLRLExtras.rst +++ b/docs/source/OWLRLExtras.rst @@ -1,7 +1,7 @@ OWLRLExtras =========== -.. automodule:: RDFClosure.OWLRLExtras +.. automodule:: owlrl.OWLRLExtras :members: :undoc-members: :inherited-members: diff --git a/docs/source/RDFS.rst b/docs/source/RDFS.rst index 56686d7..0980bb2 100644 --- a/docs/source/RDFS.rst +++ b/docs/source/RDFS.rst @@ -1,7 +1,7 @@ RDFS ==== -.. automodule:: RDFClosure.RDFS +.. automodule:: owlrl.RDFS :members: :undoc-members: :inherited-members: @@ -11,5 +11,5 @@ RDFS Source code ----------- -.. literalinclude:: ../../RDFClosure/RDFS.py +.. literalinclude:: ../../owlrl/RDFS.py :linenos: \ No newline at end of file diff --git a/docs/source/RDFSClosure.rst b/docs/source/RDFSClosure.rst index 1f0ac85..98b8f6f 100644 --- a/docs/source/RDFSClosure.rst +++ b/docs/source/RDFSClosure.rst @@ -1,7 +1,7 @@ RDFSClosure =========== -.. automodule:: RDFClosure.RDFSClosure +.. automodule:: owlrl.RDFSClosure :members: :undoc-members: :inherited-members: diff --git a/docs/source/RestrictedDatatype.rst b/docs/source/RestrictedDatatype.rst index 10689d5..921f568 100644 --- a/docs/source/RestrictedDatatype.rst +++ b/docs/source/RestrictedDatatype.rst @@ -1,11 +1,11 @@ RestrictedDatatype ================== -.. automodule:: RDFClosure.RestrictedDatatype +.. automodule:: owlrl.RestrictedDatatype :members: :undoc-members: :inherited-members: :show-inheritance: -.. autofunction:: RDFClosure.RestrictedDatatype._lit_to_value \ No newline at end of file +.. autofunction:: owlrl.RestrictedDatatype._lit_to_value \ No newline at end of file diff --git a/docs/source/XsdDatatypes.rst b/docs/source/XsdDatatypes.rst index a262552..1602b5f 100644 --- a/docs/source/XsdDatatypes.rst +++ b/docs/source/XsdDatatypes.rst @@ -1,7 +1,7 @@ XsdDatatypes ============ -.. automodule:: RDFClosure.XsdDatatypes +.. automodule:: owlrl.XsdDatatypes :members: :undoc-members: :inherited-members: diff --git a/docs/source/XsdDatatypes_source.rst b/docs/source/XsdDatatypes_source.rst index bbb27c1..e12f920 100644 --- a/docs/source/XsdDatatypes_source.rst +++ b/docs/source/XsdDatatypes_source.rst @@ -3,5 +3,5 @@ XsdDatatypes.py --------------- -.. literalinclude:: ../../RDFClosure/XsdDatatypes.py +.. literalinclude:: ../../owlrl/XsdDatatypes.py :linenos: \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 32fd07d..28b066c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -26,7 +26,7 @@ # The short X.Y version version = '' # The full version, including alpha/beta/rc tags -release = '5.0' +release = '5.1.0' # -- General configuration --------------------------------------------------- @@ -45,7 +45,7 @@ 'sphinx.ext.autosummary' ] -# generate classes and add to the toctree. See RDFClosure.rst for example usage. +# generate classes and add to the toctree. See owlrl.rst for example usage. # autodoc_default_flags = ['members'] autosummary_generate = True diff --git a/docs/source/index.rst b/docs/source/index.rst index 8676609..6b7dd12 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -22,7 +22,7 @@ OWL-RL Documentation :maxdepth: 2 :caption: Modules - RDFClosure + owlrl AxiomaticTriples Closure CombinedClosure diff --git a/docs/source/RDFClosure.rst b/docs/source/owlrl.rst similarity index 62% rename from docs/source/RDFClosure.rst rename to docs/source/owlrl.rst index 63d7a5a..48099de 100644 --- a/docs/source/RDFClosure.rst +++ b/docs/source/owlrl.rst @@ -1,7 +1,7 @@ -RDFClosure -========== +owlrl +===== -.. automodule:: RDFClosure +.. automodule:: owlrl :members: :undoc-members: :inherited-members: diff --git a/docs/source/stubs/RDFClosure.Closure.rst b/docs/source/stubs/owlrl.Closure.rst similarity index 56% rename from docs/source/stubs/RDFClosure.Closure.rst rename to docs/source/stubs/owlrl.Closure.rst index 5176e03..6884823 100644 --- a/docs/source/stubs/RDFClosure.Closure.rst +++ b/docs/source/stubs/owlrl.Closure.rst @@ -1,7 +1,7 @@ -RDFClosure.Closure -================== +owlrl.Closure +============= -.. automodule:: RDFClosure.Closure +.. automodule:: owlrl.Closure diff --git a/docs/source/stubs/RDFClosure.DeductiveClosure.rst b/docs/source/stubs/owlrl.DeductiveClosure.rst similarity index 82% rename from docs/source/stubs/RDFClosure.DeductiveClosure.rst rename to docs/source/stubs/owlrl.DeductiveClosure.rst index af075b6..69bbbf7 100644 --- a/docs/source/stubs/RDFClosure.DeductiveClosure.rst +++ b/docs/source/stubs/owlrl.DeductiveClosure.rst @@ -1,7 +1,7 @@ -RDFClosure.DeductiveClosure -=========================== +owlrl.DeductiveClosure +====================== -.. currentmodule:: RDFClosure +.. currentmodule:: owlrl .. autoclass:: DeductiveClosure diff --git a/docs/source/stubs/RDFClosure.rst b/docs/source/stubs/owlrl.rst similarity index 82% rename from docs/source/stubs/RDFClosure.rst rename to docs/source/stubs/owlrl.rst index 0978e90..cbc5e90 100644 --- a/docs/source/stubs/RDFClosure.rst +++ b/docs/source/stubs/owlrl.rst @@ -1,7 +1,7 @@ -RDFClosure -========== +owlrl +===== -.. automodule:: RDFClosure +.. automodule:: owlrl diff --git a/docs/source/usage.rst b/docs/source/usage.rst index b6cb147..cb79aaf 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -3,4 +3,4 @@ Usage *Coming soon.* -.. note:: Refer to :class:`RDFClosure` for package entry details, etc. \ No newline at end of file +.. note:: Refer to :class:`owlrl` for package entry details, etc. \ No newline at end of file diff --git a/RDFClosure/AxiomaticTriples.py b/owlrl/AxiomaticTriples.py similarity index 98% rename from RDFClosure/AxiomaticTriples.py rename to owlrl/AxiomaticTriples.py index 69aa30f..be541e2 100755 --- a/RDFClosure/AxiomaticTriples.py +++ b/owlrl/AxiomaticTriples.py @@ -27,11 +27,11 @@ __license__ = 'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' import rdflib -from RDFClosure.RDFS import Seq, Bag, Alt, Statement, Property, XMLLiteral, List -from RDFClosure.RDFS import RDFNS as ns_rdf -from RDFClosure.RDFS import rdf_subject, rdf_predicate, rdf_object, rdf_type, value, first, rest, nil -from RDFClosure.RDFS import Resource, Class, subClassOf, subPropertyOf, comment, label, rdfs_domain, rdfs_range -from RDFClosure.RDFS import seeAlso, isDefinedBy, Literal, Container, ContainerMembershipProperty, member, Datatype +from owlrl.RDFS import Seq, Bag, Alt, Statement, Property, XMLLiteral, List +from owlrl.RDFS import RDFNS as ns_rdf +from owlrl.RDFS import rdf_subject, rdf_predicate, rdf_object, rdf_type, value, first, rest, nil +from owlrl.RDFS import Resource, Class, subClassOf, subPropertyOf, comment, label, rdfs_domain, rdfs_range +from owlrl.RDFS import seeAlso, isDefinedBy, Literal, Container, ContainerMembershipProperty, member, Datatype from rdflib.namespace import XSD as ns_xsd from .OWL import * diff --git a/RDFClosure/Closure.py b/owlrl/Closure.py similarity index 98% rename from RDFClosure/Closure.py rename to owlrl/Closure.py index ea706bb..11833ac 100755 --- a/RDFClosure/Closure.py +++ b/owlrl/Closure.py @@ -32,10 +32,10 @@ from rdflib import Namespace # noinspection PyPep8Naming -from RDFClosure.RDFS import RDFNS as ns_rdf -from RDFClosure.RDFS import rdf_type +from owlrl.RDFS import RDFNS as ns_rdf +from owlrl.RDFS import rdf_type -from RDFClosure.Literals import LiteralProxies +from owlrl.Literals import LiteralProxies debugGlobal = False offlineGeneration = False diff --git a/RDFClosure/CombinedClosure.py b/owlrl/CombinedClosure.py similarity index 96% rename from RDFClosure/CombinedClosure.py rename to owlrl/CombinedClosure.py index 742ed2c..9fa77f6 100755 --- a/RDFClosure/CombinedClosure.py +++ b/owlrl/CombinedClosure.py @@ -30,11 +30,11 @@ __contact__ = 'Ivan Herman, ivan@w3.org' __license__ = 'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' -from RDFClosure.RDFS import Resource, Class, Datatype -from RDFClosure.OWL import OWLClass, Thing, equivalentClass, DataRange +from owlrl.RDFS import Resource, Class, Datatype +from owlrl.OWL import OWLClass, Thing, equivalentClass, DataRange -from RDFClosure.RDFSClosure import RDFS_Semantics -from RDFClosure.OWLRL import OWLRL_Semantics +from owlrl.RDFSClosure import RDFS_Semantics +from owlrl.OWLRL import OWLRL_Semantics ###################################################################################################### diff --git a/RDFClosure/DatatypeHandling.py b/owlrl/DatatypeHandling.py similarity index 99% rename from RDFClosure/DatatypeHandling.py rename to owlrl/DatatypeHandling.py index abb1e7f..c89db58 100755 --- a/RDFClosure/DatatypeHandling.py +++ b/owlrl/DatatypeHandling.py @@ -34,7 +34,7 @@ __license__ = 'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' # noinspection PyPep8Naming -from RDFClosure.RDFS import RDFNS as ns_rdf +from owlrl.RDFS import RDFNS as ns_rdf from rdflib.term import XSDToPython, Literal, _toPythonMapping # noinspection PyPep8Naming diff --git a/RDFClosure/Literals.py b/owlrl/Literals.py similarity index 97% rename from RDFClosure/Literals.py rename to owlrl/Literals.py index 10d4eb1..0f045fb 100755 --- a/RDFClosure/Literals.py +++ b/owlrl/Literals.py @@ -41,7 +41,6 @@ from rdflib import Literal as rdflibLiteral from rdflib.namespace import XSD as ns_xsd -from . import text_type from .RDFS import rdf_type from .RDFS import Literal from .DatatypeHandling import AltXSDToPYTHON @@ -63,7 +62,7 @@ class _LiteralStructure: # noinspection PyPep8 def __init__(self, lit): self.lit = lit - self.lex = text_type(lit) + self.lex = str(lit) self.dt = lit.datatype self.lang = lit.language self.value = lit.value @@ -151,10 +150,10 @@ def __init__(self, graph, closure): if obj.datatype: converter = AltXSDToPYTHON.get(obj.datatype, identity) try: - converter(text_type(obj)) + converter(str(obj)) except ValueError: closure.add_error("Lexical value of the literal '%s' does not match its datatype (%s)" % - (text_type(obj), obj.datatype)) + (str(obj), obj.datatype)) # Check if a BNode has already been associated with that literal obj_st = _LiteralStructure(obj) @@ -206,7 +205,7 @@ def restore(self): # serialization... lit = self.bnode_to_lit[obj].lit if lit.datatype is not None and lit.datatype == ns_xsd["string"]: - lit = rdflibLiteral(text_type(lit)) + lit = rdflibLiteral(str(lit)) to_be_added.add((subj, pred, lit)) # Do the real modifications diff --git a/RDFClosure/OWL.py b/owlrl/OWL.py similarity index 100% rename from RDFClosure/OWL.py rename to owlrl/OWL.py diff --git a/RDFClosure/OWLRL.py b/owlrl/OWLRL.py similarity index 99% rename from RDFClosure/OWLRL.py rename to owlrl/OWLRL.py index 0606001..9fece9a 100755 --- a/RDFClosure/OWLRL.py +++ b/owlrl/OWLRL.py @@ -37,14 +37,14 @@ import rdflib from rdflib import BNode -from RDFClosure.RDFS import Property, rdf_type -from RDFClosure.RDFS import subClassOf, subPropertyOf, comment, label, rdfs_domain, rdfs_range -from RDFClosure.RDFS import seeAlso, isDefinedBy, Datatype - -from RDFClosure.OWL import * -from RDFClosure.Closure import Core -from RDFClosure.AxiomaticTriples import OWLRL_Axiomatic_Triples, OWLRL_D_Axiomatic_Triples -from RDFClosure.AxiomaticTriples import OWLRL_Datatypes_Disjointness +from owlrl.RDFS import Property, rdf_type +from owlrl.RDFS import subClassOf, subPropertyOf, comment, label, rdfs_domain, rdfs_range +from owlrl.RDFS import seeAlso, isDefinedBy, Datatype + +from owlrl.OWL import * +from owlrl.Closure import Core +from owlrl.AxiomaticTriples import OWLRL_Axiomatic_Triples, OWLRL_D_Axiomatic_Triples +from owlrl.AxiomaticTriples import OWLRL_Datatypes_Disjointness OWLRL_Annotation_properties = [label, comment, seeAlso, isDefinedBy, deprecated, versionInfo, priorVersion, backwardCompatibleWith, incompatibleWith] diff --git a/RDFClosure/OWLRLExtras.py b/owlrl/OWLRLExtras.py similarity index 100% rename from RDFClosure/OWLRLExtras.py rename to owlrl/OWLRLExtras.py diff --git a/RDFClosure/RDFS.py b/owlrl/RDFS.py similarity index 100% rename from RDFClosure/RDFS.py rename to owlrl/RDFS.py diff --git a/RDFClosure/RDFSClosure.py b/owlrl/RDFSClosure.py similarity index 95% rename from RDFClosure/RDFSClosure.py rename to owlrl/RDFSClosure.py index 34fbf5e..9e9e1eb 100755 --- a/RDFClosure/RDFSClosure.py +++ b/owlrl/RDFSClosure.py @@ -30,14 +30,14 @@ from itertools import product -from RDFClosure.RDFS import Property, rdf_type -from RDFClosure.RDFS import Resource, Class, subClassOf, subPropertyOf, rdfs_domain, rdfs_range -from RDFClosure.RDFS import Literal, ContainerMembershipProperty, member, Datatype +from owlrl.RDFS import Property, rdf_type +from owlrl.RDFS import Resource, Class, subClassOf, subPropertyOf, rdfs_domain, rdfs_range +from owlrl.RDFS import Literal, ContainerMembershipProperty, member, Datatype # noinspection PyPep8Naming -from RDFClosure.RDFS import RDFNS as ns_rdf +from owlrl.RDFS import RDFNS as ns_rdf -from RDFClosure.Closure import Core -from RDFClosure.AxiomaticTriples import RDFS_Axiomatic_Triples, RDFS_D_Axiomatic_Triples +from owlrl.Closure import Core +from owlrl.AxiomaticTriples import RDFS_Axiomatic_Triples, RDFS_D_Axiomatic_Triples ###################################################################################################### diff --git a/RDFClosure/RestrictedDatatype.py b/owlrl/RestrictedDatatype.py similarity index 98% rename from RDFClosure/RestrictedDatatype.py rename to owlrl/RestrictedDatatype.py index 712ff0b..1bd8999 100644 --- a/RDFClosure/RestrictedDatatype.py +++ b/owlrl/RestrictedDatatype.py @@ -59,17 +59,16 @@ from .OWL import * # noinspection PyPep8Naming,PyPep8Naming from .OWL import OWLNS as ns_owl -from RDFClosure.RDFS import Datatype -from RDFClosure.RDFS import rdf_type +from owlrl.RDFS import Datatype +from owlrl.RDFS import rdf_type # noinspection PyPep8Naming -from RDFClosure.RDFS import RDFNS as ns_rdf +from owlrl.RDFS import RDFNS as ns_rdf from rdflib import Literal as rdflibLiteral # noinspection PyPep8Naming from rdflib.namespace import XSD as ns_xsd from .DatatypeHandling import AltXSDToPYTHON -from . import text_type from functools import reduce #: Constant for datatypes using min, max (inclusive and exclusive): @@ -242,10 +241,10 @@ def extract_faceted_datatypes(core, graph): # it is caught some lines below anyway... try: if lit.datatype is None or lit.datatype == ns_xsd["string"]: - final_facets.append((facet, text_type(lit))) + final_facets.append((facet, str(lit))) else: final_facets.append( - (facet, AltXSDToPYTHON[lit.datatype](text_type(lit))) + (facet, AltXSDToPYTHON[lit.datatype](str(lit))) ) except Exception as msg: core.add_error(msg) @@ -469,7 +468,7 @@ def _check_min_length(self, value): @rtype: boolean """ if isinstance(value, rdflibLiteral): - val = text_type(value) + val = str(value) else: val = value if self.minLength is not None: @@ -484,7 +483,7 @@ def _check_max_length(self, value): @rtype: boolean """ if isinstance(value, rdflibLiteral): - val = text_type(value) + val = str(value) else: val = value if self.maxLength is not None: @@ -499,7 +498,7 @@ def _check_length(self, value): @rtype: boolean """ if isinstance(value, rdflibLiteral): - val = text_type(value) + val = str(value) else: val = value if self.length is not None: @@ -514,7 +513,7 @@ def _check_pattern(self, value): @rtype: boolean """ if isinstance(value, rdflibLiteral): - val = text_type(value) + val = str(value) else: val = value for p in self.pattern: diff --git a/RDFClosure/XsdDatatypes.py b/owlrl/XsdDatatypes.py similarity index 100% rename from RDFClosure/XsdDatatypes.py rename to owlrl/XsdDatatypes.py diff --git a/RDFClosure/__init__.py b/owlrl/__init__.py similarity index 99% rename from RDFClosure/__init__.py rename to owlrl/__init__.py index 2ba7c5f..53306d9 100755 --- a/RDFClosure/__init__.py +++ b/owlrl/__init__.py @@ -158,18 +158,15 @@ """ # Examples: LangString is disjoint from String -__version__ = "5.0" +__version__ = '5.1.0' __author__ = 'Ivan Herman' __contact__ = 'Ivan Herman, ivan@w3.org' __license__ = 'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' import sys import io -if sys.version_info < (3,): - text_type = str -else: - text_type = str - +if sys.version_info < (3, 4, ): + raise RuntimeError("This version of owl-rl cannot be used in python < 3.4") # noinspection PyPackageRequirements,PyPackageRequirements,PyPackageRequirements import rdflib @@ -284,7 +281,7 @@ def interpret_owl_imports(iformat, graph): # this is not 100% kosher. The expected object for an import statement is a URI. However, # on local usage, a string would also make sense, so I do that one, too if isinstance(uri, rdflibLiteral): - __parse_input(iformat, text_type(uri), graph) + __parse_input(iformat, str(uri), graph) else: __parse_input(iformat, uri, graph) # 4. start all over again to see if import statements have been imported diff --git a/requirements-dev.txt b/requirements-dev.txt index 6a9eeb0..9a91f30 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,4 +2,7 @@ pytest sphinx sphinx_rtd_theme rdflib>=4.2.2 -rdflib-jsonld \ No newline at end of file +rdflib-jsonld +wheel +twine + diff --git a/requirements.txt b/requirements.txt index d2ac7ff..c1698ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ rdflib>=4.2.2 -rdflib-jsonld \ No newline at end of file +rdflib-jsonld>=0.4.0 \ No newline at end of file diff --git a/scripts/RDFConvertService.py b/scripts/RDFConvertService.py index f1562f9..d128d17 100755 --- a/scripts/RDFConvertService.py +++ b/scripts/RDFConvertService.py @@ -1,7 +1,7 @@ #!/usr/bin/python2.4 # -*- coding: utf-8 -*- """ -Possible CGI entry point for the RDFClosure package. +Possible CGI entry point for the owl package. @author: U{Ivan Herman} @license: This software is available for use under the @@ -27,7 +27,7 @@ sys.path.insert(0, "C:\\Documents and Settings\\Ivan Herman\\My Documents\\Lib\\Python") sys.path.insert(0, "C:\\Documents and Settings\\Ivan Herman\\My Documents\\Lib\\Python\\rdlib-2.4.2") -from RDFClosure import convert_graph, RDFXML, TURTLE, AUTO +from owlrl import convert_graph, RDFXML, TURTLE, AUTO # --------------------------------------------------------------------------------------------------------------------- diff --git a/scripts/closure.py b/scripts/closure.py index ed19c52..1038fa3 100755 --- a/scripts/closure.py +++ b/scripts/closure.py @@ -9,7 +9,7 @@ sys.path.insert(0,"/home/ivan/lib/Python") from optparse import OptionParser -from RDFClosure import convert_graph, RDFXML, TURTLE, JSON, AUTO, RDFA +from owlrl import convert_graph, RDFXML, TURTLE, JSON, AUTO, RDFA def main(): diff --git a/setup.py b/setup.py index 51ecb2b..399e3b7 100755 --- a/setup.py +++ b/setup.py @@ -1,12 +1,78 @@ -from distutils.core import setup -setup(name="RDFClosure", - description="RDFClosure Library", - version="5.0.0", - author="Ivan Herman", - author_email="ivan@ivan-herman.net", - maintainer="Ivan Herman", - maintainer_email="ivan@ivan-herman.net", - packages=['RDFClosure'], - requires=['rdflib(>=4.2.2)', 'rdflib_jsonld'] +#!/usr/bin/env python3 +# -*- coding: latin-1 -*- +import codecs +import re +import os +from setuptools import setup + +def open_local(paths, mode='r', encoding='utf8'): + path = os.path.join( + os.path.abspath(os.path.dirname(__file__)), + *paths + ) + return codecs.open(path, mode, encoding) + + +with open_local(['owlrl', '__init__.py'], encoding='utf-8') as fp: + try: + version = re.findall(r"^__version__ = '([^']+)'\r?$", + fp.read(), re.M)[0] + except IndexError: + raise RuntimeError('Unable to determine version.') + +with open_local(['README.rst']) as readme: + long_description = readme.read() + +with open_local(['requirements.txt']) as req: + found_requirements = req.read().split("\n") + dependency_links = [] + requirements = [] + for f in found_requirements: + if 'git+' in f: + pkg = f.split('#')[-1] + dependency_links.append(f.strip() + '-9876543210') + requirements.append(pkg.replace('egg=', '').rstrip()) + else: + requirements.append(f.strip()) + +setup( + name='owlrl', + packages=['owlrl'], + scripts=['scripts/closure.py', 'scripts/RDFConvertService.py'], + package_dir={'owlrl': './owlrl'}, + version=version, + description='OWL-RL and RDFS based RDF Closure inferencing', + author='Ivan Herman', + author_email='ivan@ivan-herman.net', + maintainer='Nicholas Car', + maintainer_email='nicholas.car@csiro.au', + url='https://github.com/RDFLib/OWL-RL/', + download_url='https://github.com/RDFLib/OWL-RL/'\ + 'archive/v{:s}.tar.gz'.format(version), + license='LICENSE.txt', + keywords=['Linked Data', 'Semantic Web', 'Python', 'triples', + 'inferencing', 'RDF', 'OWL', 'OWL-RL', 'owlrl', 'RDFS'], + long_description=long_description, + long_description_content_type='text/x-rst', + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Topic :: Utilities', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: W3C License', + 'Natural Language :: English', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Operating System :: OS Independent' + ], + install_requires=requirements, + dependency_links=dependency_links ) diff --git a/setup.py.old b/setup.py.old new file mode 100755 index 0000000..0208302 --- /dev/null +++ b/setup.py.old @@ -0,0 +1,12 @@ +from distutils.core import setup +setup(name="RDFClosure", + description="RDFClosure Library", + version="5.1.0", + author="Ivan Herman", + author_email="ivan@ivan-herman.net", + maintainer="Ivan Herman", + maintainer_email="ivan@ivan-herman.net", + packages=['RDFClosure'], + requires=['rdflib(>=4.2.2)', 'rdflib_jsonld'] +) + diff --git a/tests/test_basic.py b/tests/test_basic.py index ec449c7..ab56859 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1,9 +1,9 @@ import rdflib import sys import os -# add path for the RDFClosure module +# add path for the owlrl module sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))) -import RDFClosure +import owlrl def test_basic(): @@ -36,7 +36,7 @@ def test_basic(): assert cnt == 0 # expand the graph with OWL-RL semantics - RDFClosure.DeductiveClosure(RDFClosure.OWLRL_Semantics).expand(g) + owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) # run a SELECT query for grandParents, should find 7 results q = ''' diff --git a/tests/test_datatypes.py b/tests/test_datatypes.py index 441190d..e53e3bd 100644 --- a/tests/test_datatypes.py +++ b/tests/test_datatypes.py @@ -13,7 +13,7 @@ from rdflib import Graph, Literal, Namespace, RDF, XSD, RDFS -import RDFClosure +import owlrl DAML = Namespace('http://www.daml.org/2002/03/agents/agent-ont#') T = Namespace('http://test.org/') @@ -23,7 +23,7 @@ def test_dt_type1(): Test dt-type1 rule for OWL 2 RL. """ g = Graph() - RDFClosure.DeductiveClosure(RDFClosure.OWLRL_Semantics).expand(g) + owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (RDF.PlainLiteral, RDF.type, RDFS.Datatype) in g assert (RDF.XMLLiteral, RDF.type, RDFS.Datatype) in g @@ -66,7 +66,7 @@ def test_dt_type2(): g = Graph() g.add((T.A, T.prop, p_one)) - RDFClosure.DeductiveClosure(RDFClosure.OWLRL_Semantics).expand(g) + owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (T.A, T.prop, p_one) in g assert (p_one, RDF.type, XSD.positiveInteger) in g @@ -79,7 +79,7 @@ def test_dt_not_type(): g = Graph() g.add((T.A, T.prop, m_one)) - RDFClosure.DeductiveClosure(RDFClosure.OWLRL_Semantics).expand(g) + owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (m_one, RDF.type, XSD.nonNegativeInteger) not in g