pylode 3.1.4__tar.gz → 3.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pylode-3.1.4 → pylode-3.2.0}/PKG-INFO +56 -34
- {pylode-3.1.4 → pylode-3.2.0}/README.rst +54 -31
- {pylode-3.1.4 → pylode-3.2.0}/pylode/cli.py +12 -4
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/ontpub.py +7 -3
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/html.py +5 -1
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/vocpub.py +8 -4
- pylode-3.2.0/pylode/rdf/refs.pickle +0 -0
- pylode-3.2.0/pylode/rdf/refs_titles.pickle +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/utils.py +31 -18
- {pylode-3.1.4 → pylode-3.2.0}/pyproject.toml +3 -3
- pylode-3.2.0/setup.py +42 -0
- {pylode-3.1.4 → pylode-3.2.0}/LICENSE +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/__init__.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/__main__.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/__init__.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/__init__.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/component/__init__.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/component/example.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/component/heading.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/component/link.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/component/preamble.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/component/properties_table.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/component/tooltip.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/dataset.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/fragment.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/loader.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/model.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/namespace.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/query/__init__.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/query/common.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/query/property_shape.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/random.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/profiles/supermodel/state.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/pylode.css +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/dcterms-mod.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/licenses.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/ontdoc.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/owl.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/prov.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/rdf.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/rdfs-mod.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/sdo-mod.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/skos.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf/void.ttl +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/rdf_elements.py +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/static/asciidoc.css +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/static/hierarchy.css +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/static/hierarchy.js +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/static/property-table-row.js +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/static/pylode.css +0 -0
- {pylode-3.1.4 → pylode-3.2.0}/pylode/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pylode
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.0
|
|
4
4
|
Summary: An OWL ontology documentation tool using Python, based on LODE.
|
|
5
5
|
Author: Nicholas Car
|
|
6
6
|
Author-email: nick@kurrawong.net
|
|
@@ -9,21 +9,20 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
12
|
Requires-Dist: Markdown (>=3.3.7,<4.0.0)
|
|
14
13
|
Requires-Dist: dominate (>=2.6.0,<3.0.0)
|
|
15
14
|
Requires-Dist: html5lib (>=1.1,<2.0)
|
|
16
15
|
Requires-Dist: httpx (>=0.25.0,<1.0.0)
|
|
17
|
-
Requires-Dist: rdflib (>=
|
|
16
|
+
Requires-Dist: rdflib (>=7.0.0,<8.0.0)
|
|
18
17
|
Description-Content-Type: text/x-rst
|
|
19
18
|
|
|
20
|
-
.. image:: https://rawcdn.githack.com/RDFLib/pyLODE/
|
|
21
|
-
|
|
19
|
+
.. image:: https://rawcdn.githack.com/RDFLib/pyLODE/master/img/pyLODE-250.png
|
|
22
20
|
.. image:: https://badge.fury.io/py/pyLODE.svg
|
|
23
21
|
:target: https://badge.fury.io/py/pyLODE
|
|
24
22
|
|
|
25
23
|
pyLODE
|
|
26
24
|
******
|
|
25
|
+
|
|
27
26
|
An OWL ontology documentation tool using Python, based on LODE.
|
|
28
27
|
|
|
29
28
|
In addition to making web page, human-readable forms of ontologies, pyLODE encourages ontology annotation *best
|
|
@@ -40,12 +39,13 @@ This is pyLODE version 3.0.1 and it's vastly different from pyLODE 2.x. It doesn
|
|
|
40
39
|
|
|
41
40
|
v 3.x will eventually catch up to all of v 2.13.2's features.
|
|
42
41
|
|
|
43
|
-
To access v 2.13.2 of pyLODE, either `download it from PyPI <https://pypi.org/project/
|
|
42
|
+
To access v 2.13.2 of pyLODE, either `download it from PyPI <https://pypi.org/project/pylode/2.13.2/>`_ , `check it out from GitHub <https://github.com/RDFLib/pyLODE/releases/tag/2.13.2>`_ or access it via the `online service <http://pylode.surroundaustralia.com/>`_ .
|
|
44
43
|
|
|
45
44
|
----
|
|
46
45
|
|
|
47
46
|
Contents
|
|
48
47
|
========
|
|
48
|
+
|
|
49
49
|
1. `Quick Intro`_
|
|
50
50
|
2. Use_
|
|
51
51
|
3. `What pyLODE understands`_
|
|
@@ -59,15 +59,15 @@ Contents
|
|
|
59
59
|
11. Collaboration_
|
|
60
60
|
12. Contacts_
|
|
61
61
|
|
|
62
|
-
|
|
63
62
|
Quick Intro
|
|
64
63
|
===========
|
|
64
|
+
|
|
65
65
|
The Live OWL Documentation Environment tool
|
|
66
66
|
(`LODE <https://github.com/essepuntato/LODE>`__) is a well-known (in
|
|
67
67
|
Semantic Web circles) Java & XSLT-based tool used to generate
|
|
68
68
|
human-readable HTML documents for OWL and RDF ontologies. That tool is
|
|
69
69
|
now a bit dated (old-style HTML, use of older technologies like XSLT)
|
|
70
|
-
and its (`online version <https://
|
|
70
|
+
and its (`online version <https://essepuntato.it/lode>`__) is not always
|
|
71
71
|
online.
|
|
72
72
|
|
|
73
73
|
This tool is a complete re-implementation of LODE's functionality using
|
|
@@ -102,7 +102,7 @@ Command line arguments
|
|
|
102
102
|
The BASH, Windows EXE and Python Script methods all use the same command line
|
|
103
103
|
arguments:
|
|
104
104
|
|
|
105
|
-
::
|
|
105
|
+
.. code-block:: text
|
|
106
106
|
|
|
107
107
|
usage: cli.py [-h] [-v] [-o OUTPUTFILE] [-c {true,false}] input
|
|
108
108
|
|
|
@@ -137,27 +137,46 @@ match exactly the file ``examples/minimal.html``.
|
|
|
137
137
|
|
|
138
138
|
* as a docker container
|
|
139
139
|
|
|
140
|
-
build the docker image
|
|
141
|
-
|
|
140
|
+
build the docker image:
|
|
141
|
+
|
|
142
|
+
.. code-block:: bash
|
|
142
143
|
|
|
143
144
|
docker build -t pylode:latest .
|
|
144
145
|
|
|
145
|
-
copy the example directory, mount it to the container and run cli.py in the container
|
|
146
|
-
|
|
146
|
+
copy the example directory, mount it to the container and run cli.py in the container:
|
|
147
|
+
|
|
148
|
+
.. code-block:: bash
|
|
147
149
|
|
|
148
150
|
docker run --mount 'type=bind,src=<ttl_directory>,target=/app/pylode/data' pylode:latest python3.10 pylode/cli.py data/<ttl_file> -o data/<html_file>
|
|
149
151
|
|
|
150
|
-
|
|
152
|
+
Note: ``<ttl_directory>`` must be absolute
|
|
151
153
|
|
|
152
154
|
Module Use
|
|
153
155
|
^^^^^^^^^^
|
|
154
156
|
|
|
155
|
-
|
|
157
|
+
for OWL:
|
|
158
|
+
|
|
159
|
+
.. code-block:: python
|
|
156
160
|
|
|
157
|
-
from pylode import
|
|
161
|
+
from pylode.profiles.ontpub import OntPub
|
|
158
162
|
|
|
159
163
|
# initialise
|
|
160
|
-
od =
|
|
164
|
+
od = OntPub(ontology="some-ontology-file.ttl")
|
|
165
|
+
|
|
166
|
+
# produce HTML
|
|
167
|
+
html = od.make_html()
|
|
168
|
+
|
|
169
|
+
# or save HTML to a file
|
|
170
|
+
od.make_html(destination="some-resulting-html-file.html")
|
|
171
|
+
|
|
172
|
+
for SKOS:
|
|
173
|
+
|
|
174
|
+
.. code-block:: python
|
|
175
|
+
|
|
176
|
+
from pylode.profiles.vocpub import VocPub
|
|
177
|
+
|
|
178
|
+
# initialise
|
|
179
|
+
od = VocPub(ontology="some-ontology-file.ttl")
|
|
161
180
|
|
|
162
181
|
# produce HTML
|
|
163
182
|
html = od.make_html()
|
|
@@ -176,17 +195,16 @@ version of pyLODE.
|
|
|
176
195
|
|
|
177
196
|
You can also see rendered versions of these example files online too:
|
|
178
197
|
|
|
179
|
-
* `minimal.html <https://rdflib.dev/pyLODE/examples/
|
|
180
|
-
* `agift.html <https://rdflib.dev/pyLODE/examples/
|
|
181
|
-
* `alternates.html <https://rdflib.dev/pyLODE/examples/
|
|
182
|
-
* `asgs.html <https://rdflib.dev/pyLODE/examples/
|
|
183
|
-
|
|
198
|
+
* `minimal.html <https://rdflib.dev/pyLODE/examples/ontpub/minimal.html>`_
|
|
199
|
+
* `agift.html <https://rdflib.dev/pyLODE/examples/ontpub/agrif.html>`_
|
|
200
|
+
* `alternates.html <https://rdflib.dev/pyLODE/examples/ontpub/alternates.html>`_
|
|
201
|
+
* `asgs.html <https://rdflib.dev/pyLODE/examples/ontpub/asgs.html>`_
|
|
184
202
|
|
|
185
203
|
What pyLODE understands
|
|
186
204
|
=======================
|
|
187
205
|
|
|
188
206
|
pyLODE knows about definitional ontologies (``owl:Ontology``) and the major
|
|
189
|
-
elements usually found in them, such as classes (``owl:Class`` or ``rdf:Class)
|
|
207
|
+
elements usually found in them, such as classes (``owl:Class`` or ``rdf:Class``)
|
|
190
208
|
and properties (``rdf:Property`` & ``owl:ObjectProperty`` etc.).
|
|
191
209
|
|
|
192
210
|
To see what properties for ontology, class and RDF property documentation
|
|
@@ -204,13 +222,14 @@ not really designed to document large ontologies containing class instances.
|
|
|
204
222
|
|
|
205
223
|
Notes on Agents
|
|
206
224
|
---------------
|
|
225
|
+
|
|
207
226
|
pyLODE can understand both simple and complex Agent objects. You can use
|
|
208
227
|
simple string properties like ``dc:contributor "Nicholas J. Car"`` too if
|
|
209
228
|
you really must but better would be to take advantage of real Linked Data
|
|
210
229
|
representation, e.g. complex Agent objects with web addresses, emails,
|
|
211
230
|
affiliations, ORCIDs and so on, e.g.:
|
|
212
231
|
|
|
213
|
-
::
|
|
232
|
+
.. code-block:: turtle
|
|
214
233
|
|
|
215
234
|
<ontology_x>
|
|
216
235
|
dct:creator [
|
|
@@ -221,6 +240,7 @@ affiliations, ORCIDs and so on, e.g.:
|
|
|
221
240
|
sdo:url "https://surroundaustralia.com"^^xsd:anyURI ;
|
|
222
241
|
] ;
|
|
223
242
|
] ;
|
|
243
|
+
.
|
|
224
244
|
|
|
225
245
|
See all the properties in ``rdf_elements.py:AGENT_PROPS`` for a list of
|
|
226
246
|
all the Agent properties pyLODE can handle.
|
|
@@ -235,18 +255,18 @@ it using `pip <https://pypi.org/project/pip/>`_ as normal:
|
|
|
235
255
|
|
|
236
256
|
pip install pylode
|
|
237
257
|
|
|
238
|
-
|
|
239
258
|
Testing
|
|
240
259
|
=======
|
|
241
260
|
|
|
242
261
|
It's best to disable warnings to hide pointless warnings from the RDFLib library.
|
|
243
262
|
|
|
244
263
|
::
|
|
245
|
-
~$ python -m pytest tests --disable-warnings
|
|
246
264
|
|
|
265
|
+
python -m pytest tests --disable-warnings
|
|
247
266
|
|
|
248
267
|
Differences from LODE
|
|
249
268
|
=====================
|
|
269
|
+
|
|
250
270
|
- command line access
|
|
251
271
|
|
|
252
272
|
- you can use this on your own desktop so you don't need me to
|
|
@@ -281,12 +301,13 @@ Differences from LODE
|
|
|
281
301
|
still very much actively developed - it's not just staying still
|
|
282
302
|
- it will be improved in foreseeable to cater for more and more things
|
|
283
303
|
- recent ontology documentation initiatives such as the `MOD
|
|
284
|
-
Ontology <https://github.com/
|
|
304
|
+
Ontology <https://github.com/FAIR-IMPACT/MOD>`__ will be
|
|
285
305
|
handled, if requested
|
|
286
306
|
|
|
287
307
|
|
|
288
308
|
Releases
|
|
289
309
|
========
|
|
310
|
+
|
|
290
311
|
pyLODE is under continual and constant development. The current developers have a roadmap for enhancements in mind,
|
|
291
312
|
which is given here, however, since this is an open source project, new developers may join the pyLODE dev community
|
|
292
313
|
and change/add development priorities.
|
|
@@ -294,7 +315,7 @@ and change/add development priorities.
|
|
|
294
315
|
Current Release
|
|
295
316
|
---------------
|
|
296
317
|
|
|
297
|
-
The current release, as of
|
|
318
|
+
The current release, as of July, 2024, is **3.2.0**.
|
|
298
319
|
|
|
299
320
|
Release Schedule
|
|
300
321
|
----------------
|
|
@@ -303,6 +324,7 @@ Release Schedule
|
|
|
303
324
|
:header: "Version", "Date", "Description"
|
|
304
325
|
:widths: 15, 10, 30
|
|
305
326
|
|
|
327
|
+
3.2.0, 27 July 2024, "dependency updates and merged multiple small PRs"
|
|
306
328
|
3.1.4, 6 April 2024, "Fix load_ontology function's detection of data input"
|
|
307
329
|
3.1.3, 18 March 2024, "Relax rdflib version constraint"
|
|
308
330
|
3.1.2, 18 March 2024, "Relax httpx version constraint"
|
|
@@ -328,22 +350,22 @@ Release Schedule
|
|
|
328
350
|
2.0, 18 Apr 2020, "Includes multiple profiles - OWP & vocpub"
|
|
329
351
|
1.0, 15 Dec 2019, "Initial working release"
|
|
330
352
|
|
|
331
|
-
|
|
332
353
|
License
|
|
333
354
|
=======
|
|
355
|
+
|
|
334
356
|
This code is licensed using the BSD 3-Clause licence. See the `LICENSE
|
|
335
357
|
file <LICENSE>`_ for the deed. Note *Citation* below though for
|
|
336
358
|
attribution.
|
|
337
359
|
|
|
338
|
-
|
|
339
360
|
Citation
|
|
340
361
|
========
|
|
362
|
+
|
|
341
363
|
If you use pyLODE, please leave the pyLODE logo with a hyperlink back
|
|
342
364
|
here in the top left of published HTML pages.
|
|
343
365
|
|
|
344
|
-
|
|
345
366
|
Collaboration
|
|
346
367
|
=============
|
|
368
|
+
|
|
347
369
|
The maintainers welcome any collaboration.
|
|
348
370
|
|
|
349
371
|
If you have suggestions, please email the contacts below or leave Issues
|
|
@@ -352,12 +374,12 @@ in this repository's `Issue tracker <https://github.com/rdflib/pyLODE/issues>`_.
|
|
|
352
374
|
But the very best thing you could do is create a Pull Request for us to
|
|
353
375
|
action!
|
|
354
376
|
|
|
355
|
-
|
|
356
377
|
Contacts
|
|
357
378
|
========
|
|
379
|
+
|
|
358
380
|
| *Author*:
|
|
359
381
|
| **Nicholas Car**
|
|
360
382
|
| *Data Architect*
|
|
361
|
-
| `Kurrawong AI <https://kurrawong.
|
|
362
|
-
| nick@kurrawong.
|
|
383
|
+
| `Kurrawong AI <https://kurrawong.ai>`_
|
|
384
|
+
| nick@kurrawong.ai
|
|
363
385
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
.. image:: https://rawcdn.githack.com/RDFLib/pyLODE/
|
|
2
|
-
|
|
1
|
+
.. image:: https://rawcdn.githack.com/RDFLib/pyLODE/master/img/pyLODE-250.png
|
|
3
2
|
.. image:: https://badge.fury.io/py/pyLODE.svg
|
|
4
3
|
:target: https://badge.fury.io/py/pyLODE
|
|
5
4
|
|
|
6
5
|
pyLODE
|
|
7
6
|
******
|
|
7
|
+
|
|
8
8
|
An OWL ontology documentation tool using Python, based on LODE.
|
|
9
9
|
|
|
10
10
|
In addition to making web page, human-readable forms of ontologies, pyLODE encourages ontology annotation *best
|
|
@@ -21,12 +21,13 @@ This is pyLODE version 3.0.1 and it's vastly different from pyLODE 2.x. It doesn
|
|
|
21
21
|
|
|
22
22
|
v 3.x will eventually catch up to all of v 2.13.2's features.
|
|
23
23
|
|
|
24
|
-
To access v 2.13.2 of pyLODE, either `download it from PyPI <https://pypi.org/project/
|
|
24
|
+
To access v 2.13.2 of pyLODE, either `download it from PyPI <https://pypi.org/project/pylode/2.13.2/>`_ , `check it out from GitHub <https://github.com/RDFLib/pyLODE/releases/tag/2.13.2>`_ or access it via the `online service <http://pylode.surroundaustralia.com/>`_ .
|
|
25
25
|
|
|
26
26
|
----
|
|
27
27
|
|
|
28
28
|
Contents
|
|
29
29
|
========
|
|
30
|
+
|
|
30
31
|
1. `Quick Intro`_
|
|
31
32
|
2. Use_
|
|
32
33
|
3. `What pyLODE understands`_
|
|
@@ -40,15 +41,15 @@ Contents
|
|
|
40
41
|
11. Collaboration_
|
|
41
42
|
12. Contacts_
|
|
42
43
|
|
|
43
|
-
|
|
44
44
|
Quick Intro
|
|
45
45
|
===========
|
|
46
|
+
|
|
46
47
|
The Live OWL Documentation Environment tool
|
|
47
48
|
(`LODE <https://github.com/essepuntato/LODE>`__) is a well-known (in
|
|
48
49
|
Semantic Web circles) Java & XSLT-based tool used to generate
|
|
49
50
|
human-readable HTML documents for OWL and RDF ontologies. That tool is
|
|
50
51
|
now a bit dated (old-style HTML, use of older technologies like XSLT)
|
|
51
|
-
and its (`online version <https://
|
|
52
|
+
and its (`online version <https://essepuntato.it/lode>`__) is not always
|
|
52
53
|
online.
|
|
53
54
|
|
|
54
55
|
This tool is a complete re-implementation of LODE's functionality using
|
|
@@ -83,7 +84,7 @@ Command line arguments
|
|
|
83
84
|
The BASH, Windows EXE and Python Script methods all use the same command line
|
|
84
85
|
arguments:
|
|
85
86
|
|
|
86
|
-
::
|
|
87
|
+
.. code-block:: text
|
|
87
88
|
|
|
88
89
|
usage: cli.py [-h] [-v] [-o OUTPUTFILE] [-c {true,false}] input
|
|
89
90
|
|
|
@@ -118,27 +119,46 @@ match exactly the file ``examples/minimal.html``.
|
|
|
118
119
|
|
|
119
120
|
* as a docker container
|
|
120
121
|
|
|
121
|
-
build the docker image
|
|
122
|
-
|
|
122
|
+
build the docker image:
|
|
123
|
+
|
|
124
|
+
.. code-block:: bash
|
|
123
125
|
|
|
124
126
|
docker build -t pylode:latest .
|
|
125
127
|
|
|
126
|
-
copy the example directory, mount it to the container and run cli.py in the container
|
|
127
|
-
|
|
128
|
+
copy the example directory, mount it to the container and run cli.py in the container:
|
|
129
|
+
|
|
130
|
+
.. code-block:: bash
|
|
128
131
|
|
|
129
132
|
docker run --mount 'type=bind,src=<ttl_directory>,target=/app/pylode/data' pylode:latest python3.10 pylode/cli.py data/<ttl_file> -o data/<html_file>
|
|
130
133
|
|
|
131
|
-
|
|
134
|
+
Note: ``<ttl_directory>`` must be absolute
|
|
132
135
|
|
|
133
136
|
Module Use
|
|
134
137
|
^^^^^^^^^^
|
|
135
138
|
|
|
136
|
-
|
|
139
|
+
for OWL:
|
|
140
|
+
|
|
141
|
+
.. code-block:: python
|
|
137
142
|
|
|
138
|
-
from pylode import
|
|
143
|
+
from pylode.profiles.ontpub import OntPub
|
|
139
144
|
|
|
140
145
|
# initialise
|
|
141
|
-
od =
|
|
146
|
+
od = OntPub(ontology="some-ontology-file.ttl")
|
|
147
|
+
|
|
148
|
+
# produce HTML
|
|
149
|
+
html = od.make_html()
|
|
150
|
+
|
|
151
|
+
# or save HTML to a file
|
|
152
|
+
od.make_html(destination="some-resulting-html-file.html")
|
|
153
|
+
|
|
154
|
+
for SKOS:
|
|
155
|
+
|
|
156
|
+
.. code-block:: python
|
|
157
|
+
|
|
158
|
+
from pylode.profiles.vocpub import VocPub
|
|
159
|
+
|
|
160
|
+
# initialise
|
|
161
|
+
od = VocPub(ontology="some-ontology-file.ttl")
|
|
142
162
|
|
|
143
163
|
# produce HTML
|
|
144
164
|
html = od.make_html()
|
|
@@ -157,17 +177,16 @@ version of pyLODE.
|
|
|
157
177
|
|
|
158
178
|
You can also see rendered versions of these example files online too:
|
|
159
179
|
|
|
160
|
-
* `minimal.html <https://rdflib.dev/pyLODE/examples/
|
|
161
|
-
* `agift.html <https://rdflib.dev/pyLODE/examples/
|
|
162
|
-
* `alternates.html <https://rdflib.dev/pyLODE/examples/
|
|
163
|
-
* `asgs.html <https://rdflib.dev/pyLODE/examples/
|
|
164
|
-
|
|
180
|
+
* `minimal.html <https://rdflib.dev/pyLODE/examples/ontpub/minimal.html>`_
|
|
181
|
+
* `agift.html <https://rdflib.dev/pyLODE/examples/ontpub/agrif.html>`_
|
|
182
|
+
* `alternates.html <https://rdflib.dev/pyLODE/examples/ontpub/alternates.html>`_
|
|
183
|
+
* `asgs.html <https://rdflib.dev/pyLODE/examples/ontpub/asgs.html>`_
|
|
165
184
|
|
|
166
185
|
What pyLODE understands
|
|
167
186
|
=======================
|
|
168
187
|
|
|
169
188
|
pyLODE knows about definitional ontologies (``owl:Ontology``) and the major
|
|
170
|
-
elements usually found in them, such as classes (``owl:Class`` or ``rdf:Class)
|
|
189
|
+
elements usually found in them, such as classes (``owl:Class`` or ``rdf:Class``)
|
|
171
190
|
and properties (``rdf:Property`` & ``owl:ObjectProperty`` etc.).
|
|
172
191
|
|
|
173
192
|
To see what properties for ontology, class and RDF property documentation
|
|
@@ -185,13 +204,14 @@ not really designed to document large ontologies containing class instances.
|
|
|
185
204
|
|
|
186
205
|
Notes on Agents
|
|
187
206
|
---------------
|
|
207
|
+
|
|
188
208
|
pyLODE can understand both simple and complex Agent objects. You can use
|
|
189
209
|
simple string properties like ``dc:contributor "Nicholas J. Car"`` too if
|
|
190
210
|
you really must but better would be to take advantage of real Linked Data
|
|
191
211
|
representation, e.g. complex Agent objects with web addresses, emails,
|
|
192
212
|
affiliations, ORCIDs and so on, e.g.:
|
|
193
213
|
|
|
194
|
-
::
|
|
214
|
+
.. code-block:: turtle
|
|
195
215
|
|
|
196
216
|
<ontology_x>
|
|
197
217
|
dct:creator [
|
|
@@ -202,6 +222,7 @@ affiliations, ORCIDs and so on, e.g.:
|
|
|
202
222
|
sdo:url "https://surroundaustralia.com"^^xsd:anyURI ;
|
|
203
223
|
] ;
|
|
204
224
|
] ;
|
|
225
|
+
.
|
|
205
226
|
|
|
206
227
|
See all the properties in ``rdf_elements.py:AGENT_PROPS`` for a list of
|
|
207
228
|
all the Agent properties pyLODE can handle.
|
|
@@ -216,18 +237,18 @@ it using `pip <https://pypi.org/project/pip/>`_ as normal:
|
|
|
216
237
|
|
|
217
238
|
pip install pylode
|
|
218
239
|
|
|
219
|
-
|
|
220
240
|
Testing
|
|
221
241
|
=======
|
|
222
242
|
|
|
223
243
|
It's best to disable warnings to hide pointless warnings from the RDFLib library.
|
|
224
244
|
|
|
225
245
|
::
|
|
226
|
-
~$ python -m pytest tests --disable-warnings
|
|
227
246
|
|
|
247
|
+
python -m pytest tests --disable-warnings
|
|
228
248
|
|
|
229
249
|
Differences from LODE
|
|
230
250
|
=====================
|
|
251
|
+
|
|
231
252
|
- command line access
|
|
232
253
|
|
|
233
254
|
- you can use this on your own desktop so you don't need me to
|
|
@@ -262,12 +283,13 @@ Differences from LODE
|
|
|
262
283
|
still very much actively developed - it's not just staying still
|
|
263
284
|
- it will be improved in foreseeable to cater for more and more things
|
|
264
285
|
- recent ontology documentation initiatives such as the `MOD
|
|
265
|
-
Ontology <https://github.com/
|
|
286
|
+
Ontology <https://github.com/FAIR-IMPACT/MOD>`__ will be
|
|
266
287
|
handled, if requested
|
|
267
288
|
|
|
268
289
|
|
|
269
290
|
Releases
|
|
270
291
|
========
|
|
292
|
+
|
|
271
293
|
pyLODE is under continual and constant development. The current developers have a roadmap for enhancements in mind,
|
|
272
294
|
which is given here, however, since this is an open source project, new developers may join the pyLODE dev community
|
|
273
295
|
and change/add development priorities.
|
|
@@ -275,7 +297,7 @@ and change/add development priorities.
|
|
|
275
297
|
Current Release
|
|
276
298
|
---------------
|
|
277
299
|
|
|
278
|
-
The current release, as of
|
|
300
|
+
The current release, as of July, 2024, is **3.2.0**.
|
|
279
301
|
|
|
280
302
|
Release Schedule
|
|
281
303
|
----------------
|
|
@@ -284,6 +306,7 @@ Release Schedule
|
|
|
284
306
|
:header: "Version", "Date", "Description"
|
|
285
307
|
:widths: 15, 10, 30
|
|
286
308
|
|
|
309
|
+
3.2.0, 27 July 2024, "dependency updates and merged multiple small PRs"
|
|
287
310
|
3.1.4, 6 April 2024, "Fix load_ontology function's detection of data input"
|
|
288
311
|
3.1.3, 18 March 2024, "Relax rdflib version constraint"
|
|
289
312
|
3.1.2, 18 March 2024, "Relax httpx version constraint"
|
|
@@ -309,22 +332,22 @@ Release Schedule
|
|
|
309
332
|
2.0, 18 Apr 2020, "Includes multiple profiles - OWP & vocpub"
|
|
310
333
|
1.0, 15 Dec 2019, "Initial working release"
|
|
311
334
|
|
|
312
|
-
|
|
313
335
|
License
|
|
314
336
|
=======
|
|
337
|
+
|
|
315
338
|
This code is licensed using the BSD 3-Clause licence. See the `LICENSE
|
|
316
339
|
file <LICENSE>`_ for the deed. Note *Citation* below though for
|
|
317
340
|
attribution.
|
|
318
341
|
|
|
319
|
-
|
|
320
342
|
Citation
|
|
321
343
|
========
|
|
344
|
+
|
|
322
345
|
If you use pyLODE, please leave the pyLODE logo with a hyperlink back
|
|
323
346
|
here in the top left of published HTML pages.
|
|
324
347
|
|
|
325
|
-
|
|
326
348
|
Collaboration
|
|
327
349
|
=============
|
|
350
|
+
|
|
328
351
|
The maintainers welcome any collaboration.
|
|
329
352
|
|
|
330
353
|
If you have suggestions, please email the contacts below or leave Issues
|
|
@@ -333,11 +356,11 @@ in this repository's `Issue tracker <https://github.com/rdflib/pyLODE/issues>`_.
|
|
|
333
356
|
But the very best thing you could do is create a Pull Request for us to
|
|
334
357
|
action!
|
|
335
358
|
|
|
336
|
-
|
|
337
359
|
Contacts
|
|
338
360
|
========
|
|
361
|
+
|
|
339
362
|
| *Author*:
|
|
340
363
|
| **Nicholas Car**
|
|
341
364
|
| *Data Architect*
|
|
342
|
-
| `Kurrawong AI <https://kurrawong.
|
|
343
|
-
| nick@kurrawong.
|
|
365
|
+
| `Kurrawong AI <https://kurrawong.ai>`_
|
|
366
|
+
| nick@kurrawong.ai
|
|
@@ -34,6 +34,13 @@ parser.add_argument(
|
|
|
34
34
|
default="true",
|
|
35
35
|
)
|
|
36
36
|
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
"-s",
|
|
39
|
+
"--sort",
|
|
40
|
+
help="Enables sorting of the subjects in the ontology in the output",
|
|
41
|
+
action='store_true',
|
|
42
|
+
)
|
|
43
|
+
|
|
37
44
|
parser.add_argument(
|
|
38
45
|
"-p",
|
|
39
46
|
"--profile",
|
|
@@ -50,17 +57,18 @@ def main():
|
|
|
50
57
|
args = parser.parse_args()
|
|
51
58
|
|
|
52
59
|
try:
|
|
60
|
+
sort_subjects = args.sort
|
|
53
61
|
if args.profile == "ontpub":
|
|
54
|
-
html = OntPub(args.input)
|
|
62
|
+
html = OntPub(args.input, sort_subjects = sort_subjects)
|
|
55
63
|
elif args.profile == "vocpub":
|
|
56
|
-
html = VocPub(args.input)
|
|
64
|
+
html = VocPub(args.input, sort_subjects = sort_subjects)
|
|
57
65
|
elif args.profile == "supermodel":
|
|
58
|
-
html = Supermodel(args.input)
|
|
66
|
+
html = Supermodel(args.input, sort_subjects = sort_subjects)
|
|
59
67
|
else:
|
|
60
68
|
raise ValueError(f"Unexpected profile type '{args.profile}'")
|
|
61
69
|
except PylodeError as e:
|
|
62
70
|
print("ERROR: " + str(e))
|
|
63
|
-
exit()
|
|
71
|
+
exit(1)
|
|
64
72
|
|
|
65
73
|
pylode_kwargs = {}
|
|
66
74
|
|
|
@@ -56,6 +56,7 @@ try:
|
|
|
56
56
|
get_ns,
|
|
57
57
|
prop_obj_pair_html,
|
|
58
58
|
section_html,
|
|
59
|
+
sort_ontology,
|
|
59
60
|
make_pylode_logo,
|
|
60
61
|
)
|
|
61
62
|
|
|
@@ -71,6 +72,7 @@ except ImportError:
|
|
|
71
72
|
get_ns,
|
|
72
73
|
prop_obj_pair_html,
|
|
73
74
|
section_html,
|
|
75
|
+
sort_ontology,
|
|
74
76
|
make_pylode_logo,
|
|
75
77
|
)
|
|
76
78
|
|
|
@@ -102,8 +104,10 @@ class OntPub:
|
|
|
102
104
|
od.make_html(destination="some-resulting-html-file.html")
|
|
103
105
|
"""
|
|
104
106
|
|
|
105
|
-
def __init__(self, ontology: Union[Graph, Path, str]):
|
|
107
|
+
def __init__(self, ontology: Union[Graph, Path, str], sort_subjects: bool = False):
|
|
106
108
|
self.ont = load_ontology(ontology)
|
|
109
|
+
if sort_subjects:
|
|
110
|
+
self.ont = sort_ontology(self.ont)
|
|
107
111
|
self._ontdoc_inference(self.ont)
|
|
108
112
|
self.back_onts = load_background_onts()
|
|
109
113
|
self.back_onts_titles = load_background_onts_titles(self.back_onts)
|
|
@@ -125,7 +129,7 @@ class OntPub:
|
|
|
125
129
|
if t is None:
|
|
126
130
|
raise PylodeError(
|
|
127
131
|
"You MUST supply a title property "
|
|
128
|
-
"(dcterms:title,
|
|
132
|
+
"(dcterms:title, rdfs:label or sdo:name) for your ontology"
|
|
129
133
|
)
|
|
130
134
|
self.doc = dominate.document(title=t)
|
|
131
135
|
|
|
@@ -142,7 +146,7 @@ class OntPub:
|
|
|
142
146
|
self._make_body()
|
|
143
147
|
|
|
144
148
|
if destination is not None:
|
|
145
|
-
open(destination, "w").write(self.doc.render())
|
|
149
|
+
open(destination, "w", encoding="utf8").write(self.doc.render())
|
|
146
150
|
else:
|
|
147
151
|
return self.doc.render()
|
|
148
152
|
|
|
@@ -38,6 +38,7 @@ from pylode.profiles.supermodel.component.properties_table import (
|
|
|
38
38
|
from pylode.utils import (
|
|
39
39
|
PylodeError,
|
|
40
40
|
load_ontology,
|
|
41
|
+
sort_ontology,
|
|
41
42
|
)
|
|
42
43
|
from pylode.profiles.supermodel.query import Query
|
|
43
44
|
from pylode.profiles.supermodel.model import (
|
|
@@ -93,9 +94,12 @@ def get_headings(doc: dominate.document) -> list:
|
|
|
93
94
|
|
|
94
95
|
class Supermodel:
|
|
95
96
|
def __init__(
|
|
96
|
-
self, ontology: Graph | Path | str, QueryClass: Type[Query] = Query
|
|
97
|
+
self, ontology: Graph | Path | str, QueryClass: Type[Query] = Query,
|
|
98
|
+
sort_subjects: bool = False
|
|
97
99
|
) -> None:
|
|
98
100
|
self.ont = load_ontology(ontology)
|
|
101
|
+
if sort_subjects:
|
|
102
|
+
self.ont = sort_ontology(self.ont)
|
|
99
103
|
self.query = QueryClass(self.ont)
|
|
100
104
|
|
|
101
105
|
self.toc: dict[str, str] = {}
|
|
@@ -55,6 +55,7 @@ try:
|
|
|
55
55
|
get_ns,
|
|
56
56
|
prop_obj_pair_html,
|
|
57
57
|
section_html,
|
|
58
|
+
sort_ontology,
|
|
58
59
|
make_pylode_logo,
|
|
59
60
|
)
|
|
60
61
|
|
|
@@ -70,6 +71,7 @@ except ImportError:
|
|
|
70
71
|
get_ns,
|
|
71
72
|
prop_obj_pair_html,
|
|
72
73
|
section_html,
|
|
74
|
+
sort_ontology,
|
|
73
75
|
make_pylode_logo,
|
|
74
76
|
)
|
|
75
77
|
|
|
@@ -105,8 +107,10 @@ class VocPub:
|
|
|
105
107
|
od.make_html(destination="some-resulting-html-file.html")
|
|
106
108
|
"""
|
|
107
109
|
|
|
108
|
-
def __init__(self, ontology: Union[Graph, Path, str]):
|
|
110
|
+
def __init__(self, ontology: Union[Graph, Path, str], sort_subjects: bool = False):
|
|
109
111
|
self.ont = load_ontology(ontology)
|
|
112
|
+
if sort_subjects:
|
|
113
|
+
self.ont = sort_ontology(self.ont)
|
|
110
114
|
self._ontdoc_inference(self.ont)
|
|
111
115
|
self.back_onts = load_background_onts()
|
|
112
116
|
self.back_onts_titles = load_background_onts_titles(self.back_onts)
|
|
@@ -128,7 +132,7 @@ class VocPub:
|
|
|
128
132
|
if t is None:
|
|
129
133
|
raise PylodeError(
|
|
130
134
|
"You MUST supply a title property "
|
|
131
|
-
"(dcterms:title,
|
|
135
|
+
"(dcterms:title, rdfs:label or sdo:name) for your ontology"
|
|
132
136
|
)
|
|
133
137
|
self.doc = dominate.document(title=t)
|
|
134
138
|
|
|
@@ -145,7 +149,7 @@ class VocPub:
|
|
|
145
149
|
self._make_body()
|
|
146
150
|
|
|
147
151
|
if destination is not None:
|
|
148
|
-
open(destination, "w").write(self.doc.render())
|
|
152
|
+
open(destination, "w", encoding="utf8").write(self.doc.render())
|
|
149
153
|
else:
|
|
150
154
|
return self.doc.render()
|
|
151
155
|
|
|
@@ -293,7 +297,7 @@ class VocPub:
|
|
|
293
297
|
else:
|
|
294
298
|
link(href="pylode.css", rel="stylesheet", type="text/css")
|
|
295
299
|
shutil.copy(
|
|
296
|
-
Path(__file__).parent / "pylode.css",
|
|
300
|
+
Path(__file__).parent.parent / "pylode.css",
|
|
297
301
|
destination.parent / "pylode.css",
|
|
298
302
|
)
|
|
299
303
|
link(
|
|
Binary file
|
|
Binary file
|
|
@@ -258,10 +258,10 @@ def load_ontology(ontology: Union[Graph, Path, str]) -> Graph:
|
|
|
258
258
|
try:
|
|
259
259
|
# try URL
|
|
260
260
|
if isinstance(ontology, str) and ontology.startswith("http"):
|
|
261
|
-
return Graph().parse(location=ontology)
|
|
261
|
+
return Graph(bind_namespaces="core").parse(location=ontology)
|
|
262
262
|
elif isinstance(ontology, str):
|
|
263
263
|
if _is_file(ontology):
|
|
264
|
-
return Graph().parse(ontology)
|
|
264
|
+
return Graph(bind_namespaces="core").parse(ontology)
|
|
265
265
|
else: # it's data
|
|
266
266
|
if ontology.startswith("[") or ontology.startswith("{"):
|
|
267
267
|
input_format = "json-ld"
|
|
@@ -273,11 +273,11 @@ def load_ontology(ontology: Union[Graph, Path, str]) -> Graph:
|
|
|
273
273
|
input_format = "xml"
|
|
274
274
|
else:
|
|
275
275
|
input_format = "turtle" # this will also cover n-triples
|
|
276
|
-
return Graph().parse(data=ontology, format=input_format)
|
|
276
|
+
return Graph(bind_namespaces="core").parse(data=ontology, format=input_format)
|
|
277
277
|
elif isinstance(ontology, Graph):
|
|
278
278
|
return cast(Graph, ontology)
|
|
279
279
|
elif isinstance(ontology, Path):
|
|
280
|
-
return Graph().parse(ontology)
|
|
280
|
+
return Graph(bind_namespaces="core").parse(ontology)
|
|
281
281
|
else:
|
|
282
282
|
raise ValueError(
|
|
283
283
|
"The ontology you supply to OntDoc must be either "
|
|
@@ -288,6 +288,14 @@ def load_ontology(ontology: Union[Graph, Path, str]) -> Graph:
|
|
|
288
288
|
print(f"{type(e).__name__} Error {e}")
|
|
289
289
|
exit()
|
|
290
290
|
|
|
291
|
+
def sort_ontology(ont_orig: Graph) -> Graph:
|
|
292
|
+
"""Creates a copy of the supplied ontology, sorted by subjects"""
|
|
293
|
+
trpls = ont_orig.triples((None, None, None))
|
|
294
|
+
trpls_srt = sorted(trpls)
|
|
295
|
+
ont_sorted = Graph(bind_namespaces="core")
|
|
296
|
+
for trpl in trpls_srt:
|
|
297
|
+
ont_sorted.add(trpl)
|
|
298
|
+
return ont_sorted
|
|
291
299
|
|
|
292
300
|
def load_background_onts():
|
|
293
301
|
"""Loads background ontology files into an RDFLib graph from either
|
|
@@ -297,7 +305,7 @@ def load_background_onts():
|
|
|
297
305
|
generating from RDF source files."""
|
|
298
306
|
|
|
299
307
|
def _parse_background_onts():
|
|
300
|
-
g_ = Graph()
|
|
308
|
+
g_ = Graph(bind_namespaces="core")
|
|
301
309
|
for f_ in RDF_FOLDER.glob("*.ttl"):
|
|
302
310
|
g_.parse(f_)
|
|
303
311
|
|
|
@@ -643,15 +651,15 @@ def rdf_obj_html(
|
|
|
643
651
|
span(card, _class="cardinality"),
|
|
644
652
|
raw(_rdf_obj_single_html),
|
|
645
653
|
)
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
654
|
+
|
|
655
|
+
card = span(
|
|
656
|
+
span(card, _class="cardinality"),
|
|
657
|
+
span(
|
|
658
|
+
_hyperlink_html(
|
|
659
|
+
ont__, back_onts_, ns__, o, fids_, OWL.Class
|
|
660
|
+
)
|
|
661
|
+
),
|
|
662
|
+
)
|
|
655
663
|
|
|
656
664
|
restriction = span(prop, card, br()) if card is not None else prop
|
|
657
665
|
restriction = (
|
|
@@ -664,11 +672,11 @@ def rdf_obj_html(
|
|
|
664
672
|
"""Makes lists of (union) 'ClassX or Class Y or ClassZ' or
|
|
665
673
|
(intersection) 'ClassX and Class Y and ClassZ'"""
|
|
666
674
|
if (obj__, OWL.unionOf, None) in ont__:
|
|
667
|
-
joining_word =
|
|
675
|
+
joining_word = span("or", _class="cardinality")
|
|
668
676
|
elif (obj__, OWL.intersectionOf, None) in ont__:
|
|
669
|
-
joining_word =
|
|
677
|
+
joining_word = span("and", _class="cardinality")
|
|
670
678
|
else:
|
|
671
|
-
joining_word =
|
|
679
|
+
joining_word = span(",", _class="cardinality")
|
|
672
680
|
|
|
673
681
|
class_set = set()
|
|
674
682
|
for o in ont__.objects(obj__, OWL.unionOf | OWL.intersectionOf):
|
|
@@ -679,7 +687,7 @@ def rdf_obj_html(
|
|
|
679
687
|
)
|
|
680
688
|
)
|
|
681
689
|
|
|
682
|
-
return
|
|
690
|
+
return intersperse(class_set, joining_word)
|
|
683
691
|
|
|
684
692
|
def _bn_html(ont__, back_onts__, ns__, fids__, obj__: BNode):
|
|
685
693
|
# TODO: remove back_onts and fids if not needed by subfunctions
|
|
@@ -879,6 +887,11 @@ def section_html(
|
|
|
879
887
|
return elems
|
|
880
888
|
|
|
881
889
|
|
|
890
|
+
def intersperse(lst, sep):
|
|
891
|
+
result = [sep] * (len(lst) * 2 - 1)
|
|
892
|
+
result[0::2] = lst
|
|
893
|
+
return result
|
|
894
|
+
|
|
882
895
|
def de_space_html(html):
|
|
883
896
|
# s = "".join([l_.strip().replace("\n", " ") for l_ in html.split("\n")])
|
|
884
897
|
# return re.sub(" +", " ", s)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pylode"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.2.0"
|
|
4
4
|
description = "An OWL ontology documentation tool using Python, based on LODE."
|
|
5
5
|
authors = ["Nicholas Car <nick@kurrawong.net>"]
|
|
6
6
|
readme = "README.rst"
|
|
7
7
|
|
|
8
8
|
[tool.poetry.dependencies]
|
|
9
9
|
python = "^3.9"
|
|
10
|
-
rdflib = ">=
|
|
10
|
+
rdflib = ">=7.0.0,<8.0.0"
|
|
11
11
|
Markdown = "^3.3.7"
|
|
12
12
|
dominate = "^2.6.0"
|
|
13
13
|
html5lib = "^1.1"
|
|
@@ -20,7 +20,7 @@ pylode = "pylode.cli:main"
|
|
|
20
20
|
pytest = "^7.2.0"
|
|
21
21
|
black = "^22.3.0"
|
|
22
22
|
flake8 = "^4.0.1"
|
|
23
|
-
pyinstaller = { version = "^5.
|
|
23
|
+
pyinstaller = { version = "^5.13", python = ">=3.9,<3.11" }
|
|
24
24
|
|
|
25
25
|
[build-system]
|
|
26
26
|
requires = ["poetry-core>=1.0.0"]
|
pylode-3.2.0/setup.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
|
|
4
|
+
packages = \
|
|
5
|
+
['pylode',
|
|
6
|
+
'pylode.profiles',
|
|
7
|
+
'pylode.profiles.supermodel',
|
|
8
|
+
'pylode.profiles.supermodel.component',
|
|
9
|
+
'pylode.profiles.supermodel.query']
|
|
10
|
+
|
|
11
|
+
package_data = \
|
|
12
|
+
{'': ['*'], 'pylode': ['rdf/*', 'static/*']}
|
|
13
|
+
|
|
14
|
+
install_requires = \
|
|
15
|
+
['Markdown>=3.3.7,<4.0.0',
|
|
16
|
+
'dominate>=2.6.0,<3.0.0',
|
|
17
|
+
'html5lib>=1.1,<2.0',
|
|
18
|
+
'httpx>=0.25.0,<1.0.0',
|
|
19
|
+
'rdflib>=7.0.0,<8.0.0']
|
|
20
|
+
|
|
21
|
+
entry_points = \
|
|
22
|
+
{'console_scripts': ['pylode = pylode.cli:main']}
|
|
23
|
+
|
|
24
|
+
setup_kwargs = {
|
|
25
|
+
'name': 'pylode',
|
|
26
|
+
'version': '3.2.0',
|
|
27
|
+
'description': 'An OWL ontology documentation tool using Python, based on LODE.',
|
|
28
|
+
'long_description': '.. image:: https://rawcdn.githack.com/RDFLib/pyLODE/master/img/pyLODE-250.png\n.. image:: https://badge.fury.io/py/pyLODE.svg\n :target: https://badge.fury.io/py/pyLODE\n\npyLODE\n******\n\nAn OWL ontology documentation tool using Python, based on LODE.\n\nIn addition to making web page, human-readable forms of ontologies, pyLODE encourages ontology annotation *best\npractice* by only producing good results for well documented inputs! pyLODE defines what it considers \'well documented\'\nin sections below, e.g. `What pyLODE understands`_.\n\n**New mode**: In v3.1.0, pyLODE now has a new mode called ``supermodel``, in addition to the existing ``ontpub`` mode. This new mode allows for documenting **profiles and modules** of multi-part models. See `supermodel.md <supermodel.md>`_ for more information.\n\n----\n\n**A note on the v 3.x change**\n\nThis is pyLODE version 3.0.1 and it\'s vastly different from pyLODE 2.x. It doesn\'t yet handle all the various "profiles" that pyLODE 2.13.2 does, such as SKOS \'vocabularies\' & Profiles Vocabulary \'profiles\', it only handles OWL \'ontologies\', nor all the special data types, such as JSON literals, BUT, it generates HTML in a much more straightforward manner and the code is both more efficient and much more maintainable, which is why it\'s been made.\n\nv 3.x will eventually catch up to all of v 2.13.2\'s features.\n\nTo access v 2.13.2 of pyLODE, either `download it from PyPI <https://pypi.org/project/pylode/2.13.2/>`_ , `check it out from GitHub <https://github.com/RDFLib/pyLODE/releases/tag/2.13.2>`_ or access it via the `online service <http://pylode.surroundaustralia.com/>`_ .\n\n----\n\nContents\n========\n\n1. `Quick Intro`_\n2. Use_\n3. `What pyLODE understands`_\n4. Examples_\n5. Installation_\n6. Testing_\n7. `Differences from LODE`_\n8. `Releases`_\n9. License_\n10. Citation_\n11. Collaboration_\n12. Contacts_\n\nQuick Intro\n===========\n\nThe Live OWL Documentation Environment tool\n(`LODE <https://github.com/essepuntato/LODE>`__) is a well-known (in\nSemantic Web circles) Java & XSLT-based tool used to generate\nhuman-readable HTML documents for OWL and RDF ontologies. That tool is\nnow a bit dated (old-style HTML, use of older technologies like XSLT)\nand its (`online version <https://essepuntato.it/lode>`__) is not always\nonline.\n\nThis tool is a complete re-implementation of LODE\'s functionality using\nPython and Python\'s RDF manipulation module,\n`rdflib <https://pypi.org/project/rdflib/>`__. An ontology to be\ndocumented is parsed and inspected using rdflib and HTML is generated\ndirectly, using Python\'s `dominate <https://pypi.org/project/dominate/>`__\npackage.\n\nUse\n===\n\nThe tool can be used in multiple ways:\n\n- BASH command line script\n - pyLODE.sh in bin/\n- Windows EXE\n - pyLODE.exe in bin/\n- Mac executable\n - pyLODE in bin/\n- Python Script\n - cli.py or module\n- as-a-service locally\n - via the popular `Falcon framework <https://falconframework.org/>`__.\n - see server.py in the main folder\n- as-a-service online\n - hosted at https://pylode.surroundaustralia.com\n\nCommand line arguments\n----------------------\n\nThe BASH, Windows EXE and Python Script methods all use the same command line\narguments:\n\n.. code-block:: text\n\n usage: cli.py [-h] [-v] [-o OUTPUTFILE] [-c {true,false}] input\n\n positional arguments:\n input Input file location or URL\n\n optional arguments:\n -h, --help show this help message and exit\n -v, --version show program\'s version number and exit\n -o OUTPUTFILE,\n --outputfile OUTPUTFILE\n A name you wish to assign to the output file. Will be\n postfixed with .html if not already added. If no\n output file is given, output will be printed to screen\n -c {true,false},\n --css {true,false}\n Whether (true) or not (false) to include CSS within an\n output HTML file.\n\nBasic Use\n^^^^^^^^^\n\n* as a Python script\n* executed in this directory\n\n::\n\n python pylode examples/ontpub/minimal.ttl -o minimal.html\n\nThis will produce the file ``minimal.html`` in this directory which should\nmatch exactly the file ``examples/minimal.html``.\n\n* as a docker container\n\nbuild the docker image:\n\n.. code-block:: bash\n\n docker build -t pylode:latest .\n\ncopy the example directory, mount it to the container and run cli.py in the container:\n\n.. code-block:: bash\n\n docker run --mount \'type=bind,src=<ttl_directory>,target=/app/pylode/data\' pylode:latest python3.10 pylode/cli.py data/<ttl_file> -o data/<html_file>\n\nNote: ``<ttl_directory>`` must be absolute\n\nModule Use\n^^^^^^^^^^\n\nfor OWL:\n\n.. code-block:: python\n\n from pylode.profiles.ontpub import OntPub\n\n # initialise\n od = OntPub(ontology="some-ontology-file.ttl")\n\n # produce HTML\n html = od.make_html()\n\n # or save HTML to a file\n od.make_html(destination="some-resulting-html-file.html")\n\nfor SKOS:\n\n.. code-block:: python\n\n from pylode.profiles.vocpub import VocPub\n\n # initialise\n od = VocPub(ontology="some-ontology-file.ttl")\n\n # produce HTML\n html = od.make_html()\n\n # or save HTML to a file\n od.make_html(destination="some-resulting-html-file.html")\n\nThis will read from ``some-ontology-file.ttl`` to produce the file ``some-resulting-html-file.html`` in this directory.\n\nExamples\n========\n\nThe `examples/ directory <https://github.com/RDFLib/pyLODE/tree/master/examples>`_\ncontains multiple pairs of RDF & HTML files generated from them using this\nversion of pyLODE.\n\nYou can also see rendered versions of these example files online too:\n\n* `minimal.html <https://rdflib.dev/pyLODE/examples/ontpub/minimal.html>`_\n* `agift.html <https://rdflib.dev/pyLODE/examples/ontpub/agrif.html>`_\n* `alternates.html <https://rdflib.dev/pyLODE/examples/ontpub/alternates.html>`_\n* `asgs.html <https://rdflib.dev/pyLODE/examples/ontpub/asgs.html>`_\n\nWhat pyLODE understands\n=======================\n\npyLODE knows about definitional ontologies (``owl:Ontology``) and the major\nelements usually found in them, such as classes (``owl:Class`` or ``rdf:Class``)\nand properties (``rdf:Property`` & ``owl:ObjectProperty`` etc.).\n\nTo see what properties for ontology, class and RDF property documentation\npyLODE currently supports, just look in the ``rdf_elements.py`` file. All\nelements\' properties supported are given in property lists there.\n\npyLODES won\'t just translate everything that you can describe in RDF into\nHTML! This is a conscious design choice to ensure that a certain conventional\nstyle of documented ontology is produced. However, support for new\nproperties and ontology patterns can be made - just create an Issue on\n`this project\'s Issue tracker <https://github.com/RDFLib/pyLODE/issues>`__.\n\nWhile it *does* know about instance data, such as Named Individuals, it\'s\nnot really designed to document large ontologies containing class instances.\n\nNotes on Agents\n---------------\n\npyLODE can understand both simple and complex Agent objects. You can use\nsimple string properties like ``dc:contributor "Nicholas J. Car"`` too if\nyou really must but better would be to take advantage of real Linked Data\nrepresentation, e.g. complex Agent objects with web addresses, emails,\naffiliations, ORCIDs and so on, e.g.:\n\n.. code-block:: turtle\n\n <ontology_x>\n dct:creator [\n sdo:name "Nicholas J. Car" ;\n sdo:identifier <http://orcid.org/0000-0002-8742-7730> ;\n sdo:affiliation [\n sdo:name "SURROUND Australia Pty Ldt." ;\n sdo:url "https://surroundaustralia.com"^^xsd:anyURI ;\n ] ;\n ] ;\n .\n\nSee all the properties in ``rdf_elements.py:AGENT_PROPS`` for a list of\nall the Agent properties pyLODE can handle.\n\nInstallation\n============\n\npyLODE is `on PyPI <https://pypi.org/project/pyLODE/>`_, so you can install\nit using `pip <https://pypi.org/project/pip/>`_ as normal:\n\n::\n\n pip install pylode\n\nTesting\n=======\n\nIt\'s best to disable warnings to hide pointless warnings from the RDFLib library.\n\n::\n\n python -m pytest tests --disable-warnings\n\nDifferences from LODE\n=====================\n\n- command line access\n\n - you can use this on your own desktop so you don\'t need me to\n maintain a live service for use\n\n- use of modern simple HTML\n\n - no JavaScript: pyLODE generates static HTML pages\n\n- catering for a wider range of ontology options such as:\n\n - schema.org ``domainIncludes`` & ``rangeIncludes`` for properties\n\n- better Agent representation\n\n - see the `Notes on Agents`_ section above\n\n- smarter CURIES\n\n - pyLODE caches and looks up well-known prefixes to make more/better\n CURIES\n - it tries to be smart with CURIE presentation by CURIE-ising all\n URIs it finds, rather than printing them\n\n- reference ontologies property labels\n\n - pyLODE caches ~ 10 well-known ontologies (RDFS, SKOS etc), properties from which people often use for their ontology documentation. Where these properties are used, the background ontology\'s labels are use\n\n- **active development**\n\n - pyLODE has been under active development since mid-2019 and is\n still very much actively developed - it\'s not just staying still\n - it will be improved in foreseeable to cater for more and more things\n - recent ontology documentation initiatives such as the `MOD\n Ontology <https://github.com/FAIR-IMPACT/MOD>`__ will be\n handled, if requested\n\n\nReleases\n========\n\npyLODE is under continual and constant development. The current developers have a roadmap for enhancements in mind,\nwhich is given here, however, since this is an open source project, new developers may join the pyLODE dev community\nand change/add development priorities.\n\nCurrent Release\n---------------\n\nThe current release, as of July, 2024, is **3.2.0**.\n\nRelease Schedule\n----------------\n\n.. csv-table:: **pyLODE Release Schedule**\n :header: "Version", "Date", "Description"\n :widths: 15, 10, 30\n\n 3.2.0, 27 July 2024, "dependency updates and merged multiple small PRs"\n 3.1.4, 6 April 2024, "Fix load_ontology function\'s detection of data input"\n 3.1.3, 18 March 2024, "Relax rdflib version constraint"\n 3.1.2, 18 March 2024, "Relax httpx version constraint"\n 3.1.1, 19 February 2024, "Fix release"\n 3.1.0, 19 February 2024, "Add supermodel mode - supports documenting profiles and modules"\n 3.0.5, 27 April 2023, "Minor patching"\n 3.0.4, 24 May 2022, "Use of Poetry"\n 3.0.2, 24 May 2022, "Support for preformatted skos:example literals"\n 3.0.1, 6 Jan 2022, "Direct HTML generation using dominate; easier to maintain and extend"\n 2.13.2, 21 December 2021, "Updated RDFlib to 6.1.1, improved test to properly use pytest"\n 2.10.0, 24 May 2021, "Update Windows EXE build process, simplified versioning"\n 2.9.1, 28 Apr 2021, "Support for ASCIIDOC format (OntDoc profile only)"\n 2.8.11, 28 Apr 2021, "Further changes for PyPI only"\n 2.8.10, 27 Apr 2021, "Further changes for PyPI only"\n 2.8.9, 27 Apr 2021, "PyPI enhancements only"\n 2.8.8, 27 Apr 2021, "Several small bugs fixed, auto-generation of version no. from Git tag"\n 2.8.6, 23 Feb 2021, "Fixing char encoding issues, updated examples, new test files style - per issue"\n 2.8.5, 5 Jan 2021, "Small enhancements to the Falcon server deployment option"\n 2.8.3, 3 July 2020, "Packaging bugfixes only"\n 2.7, 1 July 2020, "Much refactoring for new profile creation ease"\n 2.6, June 2020, "Supports PROF profiles as well as taxonomies & ontologies"\n 2.4, 27 May 2020, "Small improvements over 2.0"\n 2.0, 18 Apr 2020, "Includes multiple profiles - OWP & vocpub"\n 1.0, 15 Dec 2019, "Initial working release"\n\nLicense\n=======\n\nThis code is licensed using the BSD 3-Clause licence. See the `LICENSE\nfile <LICENSE>`_ for the deed. Note *Citation* below though for\nattribution.\n\nCitation\n========\n\nIf you use pyLODE, please leave the pyLODE logo with a hyperlink back\nhere in the top left of published HTML pages.\n\nCollaboration\n=============\n\nThe maintainers welcome any collaboration.\n\nIf you have suggestions, please email the contacts below or leave Issues\nin this repository\'s `Issue tracker <https://github.com/rdflib/pyLODE/issues>`_.\n\nBut the very best thing you could do is create a Pull Request for us to\naction!\n\nContacts\n========\n\n| *Author*:\n| **Nicholas Car**\n| *Data Architect*\n| `Kurrawong AI <https://kurrawong.ai>`_\n| nick@kurrawong.ai\n',
|
|
29
|
+
'author': 'Nicholas Car',
|
|
30
|
+
'author_email': 'nick@kurrawong.net',
|
|
31
|
+
'maintainer': 'None',
|
|
32
|
+
'maintainer_email': 'None',
|
|
33
|
+
'url': 'None',
|
|
34
|
+
'packages': packages,
|
|
35
|
+
'package_data': package_data,
|
|
36
|
+
'install_requires': install_requires,
|
|
37
|
+
'entry_points': entry_points,
|
|
38
|
+
'python_requires': '>=3.9,<4.0',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
setup(**setup_kwargs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|