pylode 2.8.3__py2.py3-none-any.whl

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.
Files changed (63) hide show
  1. pyLODE-2.8.3.dist-info/LICENSE +643 -0
  2. pyLODE-2.8.3.dist-info/METADATA +772 -0
  3. pyLODE-2.8.3.dist-info/RECORD +63 -0
  4. pyLODE-2.8.3.dist-info/WHEEL +6 -0
  5. pyLODE-2.8.3.dist-info/entry_points.txt +3 -0
  6. pyLODE-2.8.3.dist-info/top_level.txt +1 -0
  7. pylode/__init__.py +5 -0
  8. pylode/cli.py +191 -0
  9. pylode/common.py +191 -0
  10. pylode/curies.py +2208 -0
  11. pylode/profiles/__init__.py +4 -0
  12. pylode/profiles/base.py +463 -0
  13. pylode/profiles/ontdoc.py +1283 -0
  14. pylode/profiles/prof.py +276 -0
  15. pylode/profiles/profile.py +135 -0
  16. pylode/profiles/vocpub.py +605 -0
  17. pylode/server.py +24 -0
  18. pylode/style/pylode.css +179 -0
  19. pylode/templates/agent.html +11 -0
  20. pylode/templates/agent.md +11 -0
  21. pylode/templates/namespaces.html +9 -0
  22. pylode/templates/namespaces.md +5 -0
  23. pylode/templates/ontdoc/class.html +121 -0
  24. pylode/templates/ontdoc/class.md +40 -0
  25. pylode/templates/ontdoc/classes.html +11 -0
  26. pylode/templates/ontdoc/classes.md +7 -0
  27. pylode/templates/ontdoc/document.html +42 -0
  28. pylode/templates/ontdoc/document.md +16 -0
  29. pylode/templates/ontdoc/metadata.html +127 -0
  30. pylode/templates/ontdoc/metadata.md +111 -0
  31. pylode/templates/ontdoc/named_individual.html +65 -0
  32. pylode/templates/ontdoc/named_individual.md +25 -0
  33. pylode/templates/ontdoc/named_individuals.html +11 -0
  34. pylode/templates/ontdoc/named_individuals.md +7 -0
  35. pylode/templates/ontdoc/properties.html +65 -0
  36. pylode/templates/ontdoc/properties.md +45 -0
  37. pylode/templates/ontdoc/property.html +129 -0
  38. pylode/templates/ontdoc/property.md +37 -0
  39. pylode/templates/orcid.html +19 -0
  40. pylode/templates/orcid.md +1 -0
  41. pylode/templates/prof/prof.html +38 -0
  42. pylode/templates/prof/prof.md +16 -0
  43. pylode/templates/prof/profile.html +90 -0
  44. pylode/templates/prof/profile.md +85 -0
  45. pylode/templates/prof/resource_descriptor.html +49 -0
  46. pylode/templates/prof/resource_descriptor.md +21 -0
  47. pylode/templates/vocpub/collection.html +51 -0
  48. pylode/templates/vocpub/collection.md +23 -0
  49. pylode/templates/vocpub/collections.html +11 -0
  50. pylode/templates/vocpub/collections.md +7 -0
  51. pylode/templates/vocpub/concept.html +115 -0
  52. pylode/templates/vocpub/concept.md +40 -0
  53. pylode/templates/vocpub/concept_hierarchy.html +80 -0
  54. pylode/templates/vocpub/concept_scheme.html +105 -0
  55. pylode/templates/vocpub/concept_scheme.md +102 -0
  56. pylode/templates/vocpub/concepts.html +9 -0
  57. pylode/templates/vocpub/concepts.md +7 -0
  58. pylode/templates/vocpub/taxonomy.html +42 -0
  59. pylode/templates/vocpub/taxonomy.md +17 -0
  60. pylode/tests/__init__.py +0 -0
  61. pylode/tests/test_ont_html_description.py +7 -0
  62. pylode/tests/test_skos.py +8 -0
  63. pylode/tests/tests_all.py +50 -0
@@ -0,0 +1,772 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyLODE
3
+ Version: 2.8.3
4
+ Summary: An OWL ontology documentation tool using Python and templating, based on LODE.
5
+ Home-page: https://github.com/rdflib/pyLODE
6
+ Author: Nicholas J. Car
7
+ Author-email: nicholas.car@surroundaustralia.com
8
+ License: LICENSE
9
+ Download-URL: https://github.com/rdflib/pyLODE/archive/v2.8.3.tar.gz
10
+ Project-URL: Bug Reports, https://github.com/rdflib/pyLODE/issues
11
+ Project-URL: Source, https://github.com/rdflib/pyLODE/
12
+ Keywords: Semantic Web,OWL,ontology,template,Jinja2,documentation
13
+ Platform: UNKNOWN
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Topic :: Utilities
16
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Natural Language :: English
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.5
22
+ Classifier: Programming Language :: Python :: 3.6
23
+ Classifier: Programming Language :: Python :: 3.7
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
+ Description-Content-Type: text/x-rst
28
+ Requires-Dist: argparse
29
+ Requires-Dist: falcon
30
+ Requires-Dist: gunicorn
31
+ Requires-Dist: jinja2
32
+ Requires-Dist: markdown
33
+ Requires-Dist: pytest
34
+ Requires-Dist: python-dateutil
35
+ Requires-Dist: rdflib (>=5.0.0)
36
+ Requires-Dist: rdflib-jsonld (>=0.5.0)
37
+ Requires-Dist: requests
38
+
39
+ .. image:: img/pyLODE-250.png
40
+
41
+ .. image:: https://badge.fury.io/py/pyLODE.svg
42
+ :target: https://badge.fury.io/py/pyLODE
43
+
44
+ pyLODE
45
+ ******
46
+ An OWL ontology documentation tool using Python and templating, based on
47
+ LODE.
48
+
49
+ In addition to making human-readable forms of ontologies/taxonomies, pyLODE encourages ontology annotation *best
50
+ practice* by only producing good results for well documented inputs! pyLODe defines what it considers w'well documented'
51
+ in sections below, such as `Profiles`_ & `What pyLODE understands`_.
52
+
53
+ Contents
54
+ ========
55
+ 1. `Quick Intro`_
56
+ 2. Examples_
57
+ 3. Installation_
58
+ 4. Use_
59
+ 5. `What pyLODE understands`_
60
+ 6. `Profiles`_
61
+ 7. `Differences from LODE`_
62
+ 8. `Releases`_
63
+ 9. License_
64
+ 10. Citation_
65
+ 11. Collaboration_
66
+ 12. Contacts_
67
+
68
+
69
+ Quick Intro
70
+ ===========
71
+ The Live OWL Documentation Environment tool
72
+ (`LODE <https://github.com/essepuntato/LODE>`__) is a well-known (in
73
+ Semantic Web circles) Java & XSLT-based tool used to generate
74
+ human-readable HTML documents for OWL and RDF ontologies. That tool is
75
+ now a bit dated (old-style HTML, use of older technologies like XSLT)
76
+ and it's (`online version <https://www.essepuntato.it/lode>`__) is not always
77
+ online.
78
+
79
+ This tool is a complete re-implementation of LODE's functionality using
80
+ Python and Python's RDF manipulation module,
81
+ `rdflib <https://pypi.org/project/rdflib/>`__. An ontology to be
82
+ documented is parsed and inspected using rdflib and HTML or Markdown is generated
83
+ using basic Python scripting and Python's `Jinja2
84
+ templating <https://pypi.org/project/Jinja2/>`__.
85
+
86
+ The tool can be run as in these ways:
87
+
88
+ - Python command line
89
+ - cli.py in the main folder
90
+ - BASH command line
91
+ - bin/ directory, uses cli.py
92
+ - as-a-service locally
93
+ - via the popular `Falcon framework <https://falconframework.org/>`__.
94
+ - see server.py in the main folder
95
+ - as-a-service online
96
+ - hosted at https://kurrawong.net/pylode-online
97
+
98
+
99
+ Examples
100
+ ========
101
+ pyLODE has been tested with all of the 30+ ontologies in `pylode/examples/ <pylode/examples/>`_ and we are trying to
102
+ ensure it captures all of their annotations. For each example, there is the original RDF file and the corresponding
103
+ output, in HTML & Markdown.
104
+
105
+ For example, `Epimorphic's <https://www.epimorphics.com/>`__'s **Registry Ontology** is:
106
+
107
+ - **reg.ttl** - source file
108
+ - **reg.html** - HTML output
109
+ - this is a couple of releases ahead of the `online version <https://epimorphics.com/public/vocabulary/Registry.html>`_
110
+ - **reg.md** - Markdown output
111
+
112
+ Another, the Australian Government's Records Interoperability Framework (AGRIF) Ontology:
113
+
114
+ - **agrif.ttl** - source file
115
+ - **agrif.html** - HTML output
116
+ - see this `rendered online by GitHack <https://raw.githack.com/RDFLib/pyLODE/master/pylode/examples/agrif.html>`__
117
+ - see `the point-of-truth rendered online <https://linked.data.gov.au/def/agrif>`__
118
+ - **agrif.md** - Markdown output
119
+ - see this `rendered online by GitHub <https://github.com/RDFLib/pyLODE/blob/master/pylode/examples/agrif.md>`__
120
+ - **agrif.skos.html** - HTMl output, "vocpub" profile
121
+ - see this `rendered online by GitHack <https://raw.githack.com/RDFLib/pyLODE/master/pylode/examples/agrif.vocpub.html>`__
122
+
123
+ You can build all of the example outputs locally by running `pylode/examples/_make_examples.py <pylode/examples/_make_examples.py>`_
124
+ which also serves as a good demonstration of calling pyLODE from a Python file.
125
+
126
+
127
+ Ontologies online using pyLODE:
128
+ -------------------------------
129
+
130
+ - `Australia's Department of Finance's <https://www.finance.gov.au>`__'s **AGRIF ontology** - http://linked.data.gov.au/def/agrif
131
+ - see the `Markdown version <https://github.com/AGLDWG/agrif-ont/blob/master/agrif.md>`__
132
+ - `National Archives of Australia <http://www.naa.gov.au>`__'s **Commonwealth Records Series ontology** - http://linked.data.gov.au/def/crs
133
+ - see the `Markdown version <https://github.com/RDFLib/pyLODE/blob/master/pylode/examples/crs.md>`__
134
+ - `CSIRO's <https://www.csiro.au>`__'s **LocI ontology** - http://linked.data.gov.au/def/loci
135
+ - `Geological Survey of
136
+ Queensland <https://www.business.qld.gov.au/industries/mining-energy-water/resources/geoscience-information/gsq>`__'s
137
+ **Boreholes Profile** - http://linked.data.gov.au/def/borehole
138
+ - `Geoscience Australia <http://www.ga.gov.au/>`__'s **Place Names
139
+ Profile** - http://linked.data.gov.au/def/placenames
140
+ - `Epimorphic <https://www.epimorphics.com/>`__'s **Registry Ontology**
141
+ - https://epimorphics.com/public/vocabulary/Registry.html
142
+ - `Semantic Web for Earth and Environmental Terminology <http://sweetontology.net>`__ (SWEET)
143
+ - a series of ontologies that are live rendered into HTML via pyLODE being called by a Falcon server
144
+
145
+ See pairs of RDF & HTML files in the
146
+ `pylode/examples/ <pylode/examples/>`__ directory for other,
147
+ preprocessed examples.
148
+
149
+
150
+ Installation
151
+ ============
152
+ This tool can be used either as a command line utility (Linux, Mac or Windows, see below) or as a Python module in other Python code. It can also be used via a hosted, online, service or even as a local web server that you can run. This repo contains executable files for Mac & Windows (soon Linux!) that you can use without any installation too.
153
+
154
+ The most important dependency to get correct when using this as a Python script of a command line program is the package ``rdflib`` which must be v5.0.0 or greater (see requirements.txt).
155
+
156
+ Python
157
+ ------
158
+ Do this to use pyLODE as a Python command line program.
159
+
160
+ This tool is available on PyPI, the Python Package Index, at https://pypi.org/project/pyLODE/ and can be installed for use as a Python module via pip:
161
+
162
+ ::
163
+
164
+ pip install pylode
165
+
166
+ To use pyLODE within Python, try something like this:
167
+
168
+ ::
169
+
170
+ import pylode
171
+
172
+ html = pylode.MakeDocco(
173
+ input_data_file=input_file_path,
174
+ outputformat="html",
175
+ profile="owldoc",
176
+ exclude_css=True
177
+ ).document()
178
+
179
+ You will now have the HTML content within the variable ``html``.
180
+
181
+ For desktop command line use, just clone this repository and either use ``cli.py`` as per the command line instructions below or use makedocco.py as a Python script directly.
182
+
183
+
184
+ Use
185
+ ===
186
+ pyLODE presents natively as a Python command-line utility,
187
+ `pylode/cli.py <pylode/cli.py>`__ and there are also a BASH, Windows & Mac OS options available for command line use:
188
+
189
+ * `pylode/bin/pylode.sh <pylode/bin/pylode.sh>`__ - BASH script
190
+ * Linux executable coming soon!
191
+ * `pylode/bin/pylode.app <pylode/bin/pylode.app>`__ - MAC OS command line executable script
192
+ * `pylode/bin/pylode.exe <pylode/bin/pylode.exe>`__ - Windows command line executable
193
+
194
+ Additionally, there is a `Falcon framework <https://falconframework.org/>`__ local HTTP server option.
195
+
196
+ All use the same command line arguments.
197
+
198
+ Command line arguments
199
+ ----------------------
200
+ These are the command line arguments to run pyLODE as a BASH or Python script on Linux, Mac etc. or via the Windows executable:
201
+
202
+ - ``-i`` or ``--inputfile``, *required if* ``-u`` *not used*
203
+ - The RDF ontology file you wish to generate HTML for Must be in either Turtle, RDF/XML, JSON-LD or N-Triples formats indicated by the file type extensions .rdf, .owl, .ttl, .n3, .nt, .json respectively
204
+ - ``-u`` or ``--url``, *required if* ``-i`` *not used*
205
+ - The RDF ontology you wish to generate HTML for, online. Must be an absolute URL that can be resolved to RDF, preferably via Content Negotiation.
206
+ - ``-c`` or ``--css``, *optional, default 'false'*
207
+ - Whether (true) or not (false) to copy the default CSS file to the output directory.
208
+ - ``-o`` or ``--outputfile``, *optional*
209
+ - A name you wish to assign to the output file. Will be postfixed with .html or .md. If not specified, the name of the input file or last segment of RDF URI will be used, + .html/.md.
210
+ - ``-f`` or ``--outputformat``, *optional, default 'html'*
211
+ - The output format of the documentation. 'html' or 'md' accepted.
212
+ - ``-p`` or ``--profile``, *optional, default 'owl'*
213
+ - The profile (specification) for ontology documentation used. This has been "owl" (for OWL Ontology) only until the recent introduction of "vocpub" (according to the `Simple Knowledge Organization System (SKOS) <https://www.w3.org/TR/skos-reference/>`__). See ``-lp`` for all profiles supported.
214
+ - ``-lp`` or ``--listprofiles``, *optional, no arguments*
215
+ - Lists all the profiles (specifications) for ontology documentation supported by pyLODE
216
+
217
+ Example call
218
+ ------------
219
+ This call to the BASH script in `pylode/bin/ <pylode/bin/>`__ will
220
+ create an HTML document for an ontology called ``placenames.html`` and
221
+ save it with a basic CSS file into
222
+ `pylode/output\_files/ <pylode/output_files/>`__:
223
+
224
+ ::
225
+
226
+ ./pylode -i ../example/prof.ttl --css true
227
+
228
+ Online Service
229
+ --------------
230
+ An online API to access pyLODE is now available in test mode at https://kurrawong.net/pylode-online.
231
+
232
+ Local server - Falcon
233
+ ---------------------
234
+ You can run pyLODE using your own, local, HTTP server like this:
235
+
236
+ ::
237
+
238
+ cd pylode && gunicorn --chdir /path/to/pyLODE/pylode server:api
239
+
240
+ Then, in another terminal:
241
+
242
+ ::
243
+
244
+ curl localhost:8000/lode?url=http://sweetontology.net/sweetAll.ttl
245
+
246
+ Windows
247
+ -------
248
+ In ``pylode/bin/``, a Windows executable, ``pylode.exe`` is available for command line use.
249
+
250
+ Be sure to add ``pylode.exe`` to your Windows user's PATH variable so you can run ``pylode.exe`` from any folder. Just run the Registry Editor (search for "Regedit" in the Start menu) and then navicate to HKEY_CURRENT_USER > Environment > Path. Adding the full path of the folder ``pylode/bin/`` to Path will ensure you can run ``pylode.exe`` within the Windows command prompt, regardless of what folder you are in.
251
+
252
+ You can rebuild the ``pylode.exe`` file from the source code, if you like. Use the Python program `Pyinstaller <https://www.pyinstaller.org/>`__ as per
253
+ `its instructions <https://pyinstaller.readthedocs.io/en/stable/usage.html>`__. The created ``pylode.exe`` will have the same characteristics as the Linux/Mac
254
+ CLI program.
255
+
256
+ Pyinstaller uses a ``.spec`` file to make the binary and that is included in this repository: ``pylode-cli.spec``.
257
+
258
+ See `the PyInstaller installation guide <https://pyinstaller.readthedocs.io/en/stable/installation.html#installing-in-windows>`__
259
+ for info on how to install PyInstaller for Windows.
260
+
261
+ Once you have PyInstaller, use ``pyinstaller`` to generate the ``pyLODE.exe`` CLI file like so:
262
+
263
+ ::
264
+
265
+ cd pylode
266
+ pyinstaller pylode-cli.spec
267
+
268
+ This will output ``pylode.exe`` in the ``dist`` directory in ``pylode``. The .exe file in ``bin/`` is just the latest copy of this.
269
+
270
+ You can now run the pyLODE Command Line utility via ``pylode.exe``.
271
+ See above for the pyLODE command line util usage instructions.
272
+
273
+ Mac OS
274
+ ------
275
+ In ``pylode/bin/``, there is a Mac executable, ``pylode.app``.
276
+
277
+ As per instructions for PyInstaller use on Windows, you can rebuild the file ``pylode.app`` using ``pylode.spec``, if you wish.
278
+
279
+ Linux
280
+ -----
281
+ In ``pylode/bin/``, there is a shell script ``pylode.sh``. You can run this on the command line. It just pushes queries to the Python command line ``cli.py``.
282
+
283
+ What pyLODE understands
284
+ =======================
285
+ pyLODE understands Ontologies, Taxonomies & Profiles and handles them based on the *Ontology Document*, *Vocabulary Publication* and *PROF* profiles that it contains. These three profiles share understanding of basic annotation properties.
286
+
287
+ Annotations
288
+ -----------
289
+ pyLODE understands the following ontology constructs:
290
+
291
+ - **ontology/taxonomy/profile metadata**
292
+ - *imports* - ``owl:imports``
293
+ - *title* - ``rdfs:label`` or ``skos:prefLabel`` or ``dct:title`` or ``dc:title``
294
+ - *description* - ``rdfs:comment`` or ``skos:definition`` or ``dct:description`` or ``dc:description``
295
+ - Markdown is supported
296
+ - *historyNote* - ``skos:historyNote``
297
+ - Markdown is supported
298
+ - *version URI* - ``owl:versionIRI`` as a URI
299
+ - *version info* - ``owl:versionInfo`` as a string
300
+ - *preferred namespace prefix* - ``vann:preferredNamespacePrefix`` as a token
301
+ - *preferred namespace URI* - ``vann:preferredNamespaceUri`` as a URI
302
+ - **agents**: *publishers*, *creators*, *contributors*
303
+ - see **Agent Formatting** below for details
304
+ - see the `pylode/examples/ <pylode/examples/>`__ directory for examples!
305
+ - **dates**: *created*, *modified*, *issued* - ``dct:created`` etc., all as ``xsd:date`` or ``xsd:dateTime`` datatype properties
306
+ - **rights**: *license* - ``dct:license`` as a URI & *rights* - ``dct:rights`` as a string
307
+ - *code respository* - ``schema:codeRepository`` as a URI
308
+ - *source* - ``dcterms:source`` as a URI or text
309
+ - **ontology classes**
310
+ - per ``rdfs:Class`` or ``owl:Class``
311
+ - *title* - ``rdfs:label`` or ``skos:prefLabel`` or ``dct:title``
312
+ - *description* - ``rdf:comment`` or ``skos:definition`` or ``dct:description`` as a string or using `Markdown <https://daringfireball.net/projects/markdown/>`__ or HTML
313
+ - *usage note* - a ``skos:scopeNote`` string
314
+ - *example* - a ``skos:example`` string containing RDF
315
+ - *super classes* - by declaring a class to be ``owl:subClassOf`` something
316
+ - *sub classes* - pyLODE will work these out itself
317
+ - *restrictions* - by declaring a class to be ``owl:subClassOf`` of an ``owl:Restriction`` with any of the normal cardinality or property existence etc. restrictions
318
+ - *in domain/range of* - pyLODE will auto-calculate these
319
+ - **ontology properties**
320
+ - per ``owl:ObjectProperty``, ``owl:DatatypeProperty`` or ``owl:AnnotationProperty``
321
+ - *title* - ``rdfs:label`` or ``skos:prefLabel`` or ``dct:title``
322
+ - *description* - ``rdf:comment`` or ``skos:definition`` or ``dct:description``
323
+ - *usage note* - a ``skos:scopeNote`` string
324
+ - *example* - a ``skos:example`` string containing RDF
325
+ - *super properties* - by declaring a class to be ``owl:subPropertyOf`` something
326
+ - *sub properties* - pyLODE will work these out itself
327
+ - *equivalent properties* - by declaring a class to be ``owl:equivalentProperty`` something
328
+ - *inverse of* - by declaring a class to be ``owl:inverseOf`` something
329
+ - *domains* - ``rdfs:domain`` or ``schema:domainIncludes``
330
+ - *ranges* - ``rdfs:range`` or ``schema:rangeIncludes``
331
+ - **namespaces**
332
+ - pyLODE will honour any namespace prefixes you set and look up others in `http://prefix.cc <http://prefix.cc/>`__
333
+ - it will either read your ontology's default/base URI in annotations or guess it using a number of methods
334
+ - **named individuals**
335
+ - as per class but also ``owl:sameAs``
336
+
337
+ Agents
338
+ ------
339
+ Agents, individual persons or organisations, should be associated with ontologies/taxonomies/profiles to indicate *authors*, *creators*, *publishers* etc. There are 2 ways to do this that pyLODE understands: datatype & object type.
340
+
341
+ Datatype - not preferred
342
+ ~~~~~~~~~~~~~~~~~~~~~~~~
343
+ A simple literal value for an agent that a human can read but not a machine can't understand:
344
+
345
+ * ``<ONTOLOGY_URI> dc:creator "AGENT NAME" .``
346
+ * the range value is a string literal, either string typed (``^^xsd:string``) or language typed (``@en`` or ``@de``)
347
+ * the following `Dublin Core Elements 1.1 <https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#section-3>`__ properties may be used:
348
+ * ``dc:contributor``
349
+ * ``dc:creator``
350
+ * ``dc:publisher``
351
+ * the following `schema.org <https://schema.org>`__ properties may be used:
352
+ * ``schema:author``
353
+ * ``schema:contributor``
354
+ * ``schema:creator``
355
+ * ``schema:editor``
356
+ * ``schema:funder``
357
+ * ``schema:publisher``
358
+ * ``schema:translator``
359
+
360
+ ::
361
+
362
+ <ontology_x>
363
+ dc:creator "Nicholas J. Car" ;
364
+
365
+ Object type - preferred
366
+ ~~~~~~~~~~~~~~~~~~~~~~~
367
+ An RDF object is used for the agent and can contain multiple details. A Blank Node or a URI can be used. Best case, a persistent agent URI!
368
+
369
+ .. figure:: img/contributor-object.png
370
+ :align: center
371
+ :figclass: figure-eg
372
+
373
+ .....
374
+
375
+ * ``<ONTOLOGY_URI> dct:creator [...] .``
376
+
377
+ or
378
+
379
+ * ``<ONTOLOGY_URI> dct:creator <SOME_URI> .``
380
+ * the range value is a Blank Node or a URI of type:
381
+ * ``schema:Person``
382
+ * ``schema:Organization``
383
+ * ``foaf:Person``
384
+ * ``foaf:Organization``
385
+ * the properties of the Blank Node or the URI are as below
386
+ * the following `Dublin Core Terms <https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#section-2>`__ properties may be used:
387
+ * ``dct:contributor``
388
+ * ``dct:creator``
389
+ * ``dct:publisher``
390
+ * ``dct:rightsHolder``
391
+ * the following `schema.org <https://schema.org>`__ properties may be used:
392
+ * ``schema:author``
393
+ * ``schema:contributor``
394
+ * ``schema:creator``
395
+ * ``schema:editor``
396
+ * ``schema:funder``
397
+ * ``schema:publisher``
398
+ * ``schema:translator``
399
+ * the following `FOAF <http://xmlns.com/foaf/spec/>`__ properties may be used:
400
+ * ``foaf:maker``
401
+
402
+ e.g. (Blank Node):
403
+
404
+ ::
405
+
406
+ <ontology_x>
407
+ schema:editor [
408
+ a schema:Organization ;
409
+ ...
410
+ ] ;
411
+
412
+ or (URI):
413
+
414
+ ::
415
+
416
+ <ontology_x>
417
+ schema:editor <https://orcid.org/0000-0002-8742-7730> ;
418
+ ...
419
+
420
+ <https://orcid.org/0000-0002-8742-7730>
421
+ a foaf:Person ;
422
+ ...
423
+
424
+
425
+ Agent datatype properties
426
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
427
+
428
+ * ``foaf:name`` / ``schema:name``
429
+ * ``foaf:mbox`` / ``schema:email``
430
+ * ``foaf:homepage`` / ``schema:url``
431
+ * ``schema:identifier``
432
+
433
+
434
+ e.g.:
435
+
436
+ ::
437
+
438
+ <ontology_x>
439
+ dct:creator [
440
+ schema:name "Nicholas J. Car" ;
441
+ schema:identifier <http://orcid.org/0000-0002-8742-7730> ;
442
+ schema:email <mailto:nicholas.car@surroundaustralia.com> ;
443
+ ] ;
444
+
445
+
446
+ Linking a Person to an Organization
447
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
448
+
449
+ Use ``schema:member``, ``schema:affiliation`` (there is no FOAF Person -> Group/Org property):
450
+
451
+ e.g.:
452
+
453
+ ::
454
+
455
+ <ontology_x>
456
+ dct:creator [
457
+ schema:name "Nicholas J. Car" ;
458
+ schema:identifier <http://orcid.org/0000-0002-8742-7730> ;
459
+ schema:email <mailto:nicholas.car@surroundaustralia.com> ;
460
+ schema:affiliation [
461
+ schema:name "SURROUND Australia Pty Ltd" ;
462
+ schema:url <https://surroundaustralia.com> ;
463
+ ] ;
464
+ ] ;
465
+
466
+
467
+ Provenance
468
+ ----------
469
+
470
+ Ontology/Taxonomy Source
471
+ ~~~~~~~~~~~~~~~~~~~~~~~~
472
+ The ontology's HTML representation linking back to the RDF: generated automatically
473
+
474
+ .. figure:: img/source.png
475
+ :align: center
476
+ :figclass: figure-eg
477
+
478
+ .....
479
+
480
+ Code Repositories
481
+ ~~~~~~~~~~~~~~~~~
482
+ Indicating to readers where the 'live' version of the ontology/taxonomy is managed:
483
+
484
+ .. figure:: img/code-repository.png
485
+ :align: center
486
+ :figclass: figure-eg
487
+
488
+ .....
489
+
490
+ This should not be done for profiles, instread, create a ``prof:ResourceDescriptor`` instance with ``role:repository`` to indicate a profile's repository.
491
+
492
+ Code repositories that house an ontology can be indicated either using `schema.org's codeRepository property <https://schema.org/codeRepository>`__ or a combination of the `Description of a Project <https://github.com/ewilderj/doap>`__ and PROV:
493
+
494
+ ::
495
+
496
+ @prefix schema: <https://schema.org/> .
497
+
498
+ <ONTOLOGY_URI>
499
+ schema:codeRepository <REPO_URI> ;
500
+ ...
501
+
502
+ or
503
+
504
+ ::
505
+
506
+ @prefix doap: <http://usefulinc.com/ns/doap#> .
507
+ @prefix prov: <http://www.w3.org/ns/prov#> .
508
+
509
+ <ONTOLOGY_URI>
510
+ prov:wasGeneratedBy [
511
+ a doap:Project , prov:Activity ;
512
+ doap:repository <REPO_URI>
513
+ ]
514
+ ...
515
+
516
+ e.g., for the `ontology version on ISO 19160-1 <http://linked.data.gov.au/def/iso19160-1-address>`__:
517
+
518
+ ::
519
+
520
+ <http://linked.data.gov.au/def/iso19160-1-address>
521
+ prov:wasGeneratedBy [
522
+ a doap:Project , prov:Activity ;
523
+ doap:repository <https://github.com/AGLDWG/iso19160-1-address-ont>
524
+ ] ;
525
+ ...
526
+
527
+ Styling
528
+ -------
529
+ This tool generates HTML that is shamelessly similar to LODE's styling.
530
+ That's because we want things to look familiar and LODE's outputs look
531
+ great. The Markdown's pretty vanilla.
532
+
533
+ Also, pyLODE generates and uses only static HTML + CSS, no JavaScript,
534
+ live loading Google Fonts etc. This is to ensure that all you need for
535
+ nice display is within a couple of static, easy to use and maintain,
536
+ files. Prevents documentation breaking over time.
537
+
538
+ Feel free to extend your styling with your own CSS.
539
+
540
+
541
+ Profiles
542
+ ========
543
+ pyLODE can document ontologies, taxonomies and profiles according to different *profiles* which are specifications. The
544
+ basic, default, profile is pyLODE's so-called *Ontology Documentation* profile, which is a profile of OWL and a few
545
+ other bits and pieces. See `What pyLODE understands`_ section.
546
+
547
+ pyLODE can tell you what profiles it supports: just run ``~$ pylode -lp`` ("list profiles") or, if calling from Python:
548
+
549
+ ::
550
+
551
+ m = MakeDocco(input_data_file="examples/data-access-rights.ttl", profile="vocpub")
552
+ print(m.list_profiles())
553
+
554
+
555
+ Supported Profiles
556
+ ------------------
557
+ Currently pyLODE supports its OWL profile, as described above, and a profile of SKOS. For full details of what the
558
+ profiles include, see the profiles' definitions at:
559
+
560
+ ========= ==========================================
561
+ **Token** **URI**
562
+ ========= ==========================================
563
+ prof `<https://www.w3.org/TR/dx-prof/>`_
564
+ ontdoc `<https://w3id.org/profile/ontdocp>`_
565
+ vocpub `<https://w3id.org/profile/vocpub>`_
566
+ ========= ==========================================
567
+
568
+ Creating New Profiles
569
+ ---------------------
570
+ In the folder ``pylode/profiles/``, you will see an ``__init__.py`` file containing the ``BaseProfile`` class which all
571
+ profiles must inherit from. The existing ``OntDoc``, ``Prof`` & ``VocPub`` profile classes are in files ``ontdoc.py``,
572
+ ``prof.py`` & ``vocpub.py`` respectively. They do all the things profiles need to do and are listed in
573
+ ``pylode/profiles/__init__.py`` for pyLODE to know about with both a profile declaration and an entry in the ``PROFILES``
574
+ list. The profile declaration for PROF is:
575
+
576
+ ::
577
+
578
+ PROF_PROFILE = Profile(
579
+ "https://www.w3.org/TR/dx-prof/",
580
+ "The Profiles Vocabulary",
581
+ "The Profiles Vocabulary is an RDF vocabulary created to allow the machine-readable description of profiles of "
582
+ "specifications for information resources.",
583
+ [HTML_MEDIA_TYPE, "text/markdown"],
584
+ HTML_MEDIA_TYPE,
585
+ languages=["en"],
586
+ default_language="en"
587
+ )
588
+
589
+ See the ``Profile`` class in ``pylode/profiles/__init__.py`` for mor details.
590
+
591
+ The ``PROFILES`` object currently contains:
592
+
593
+ ::
594
+
595
+ PROFILES = {
596
+ "prof": PROF_PROFILE,
597
+ "ontdoc": ONT_DOC_PROFILE,
598
+ "vocpub": VOC_PUB_PROFILE,
599
+ }
600
+
601
+ Profiles also contain templates in ``pylode/templates/FOLDER`` and need to be imported into ``pylode/__init.py`` and
602
+ added to that file's ``document()`` finction to be made accessible.
603
+
604
+ So, to create your own profile:
605
+
606
+ 1. create a class to inherit from ``BaseProfile``
607
+ 2. do the work of profileing in your class, following the *prof*, *ontdoc* & *vocpub* examples
608
+ 3. list your profile with a profile declaration and an entry in PROFILES in ``pylode/profiles/__init__.py``
609
+ 4. place your templates in ``pylode/templates/FOLDER`` (FOLDER being your profile's folder name)
610
+ 5. make your profile work with pyLODE by importing it into ``pylode/__init.py`` and adding a call to its constructor in ``document()``
611
+
612
+ We hope to simplify this with profile auto-discovery soon!
613
+
614
+
615
+ Transformation by Profile
616
+ -------------------------
617
+ You can, of course, document an OWL ontology using the *owldoc* profile or a SKOS taxonomy using the *vocpub* profile
618
+ however, you can also document an OWL ontology using the *vocpub* profile! This is because SKOS is conceptually a subset
619
+ of OWL - whatever you can express in SKOS you can express in OWL.
620
+
621
+ pyLODE performs an OWL > SKOS transformation on OWL ontologies to produce a taxonomy document. The following
622
+ conversions are made:
623
+
624
+ - ``owl:Ontology`` > ``skos:ConceptScheme``
625
+ - and all the ontology metadata is used with the ConceptScheme
626
+ - ``owl:Class`` > ``skos:Concept``
627
+ - and other class annotation properties used with Concept
628
+ - ``owl:subClassOf`` > ``skos:broader``
629
+ - and the inverses, ``skos:narrower``
630
+
631
+ To see the full list of transformations, see the function ``_expand_graph_for_skos()`` in *makedocco.py*.
632
+
633
+ Examples of a small taxonomies documented using the *vocpub* profile are:
634
+
635
+ - `Data Access Rights <https://raw.githack.com/RDFLib/pyLODE/master/pylode/examples/data-access-rights.skos.html>`_
636
+ - `ISO 19115-1's RoleCodes <https://raw.githack.com/RDFLib/pyLODE/master/pylode/examples/iso19115-1-RoleCodes.skos.html>`_
637
+
638
+ An example of a large one:
639
+
640
+ - `Earth Science Data Category <https://raw.githack.com/RDFLib/pyLODE/master/pylode/examples/earth-science-data-category.skos.html>`_
641
+
642
+ An example of a *vocpub*-documented OWL ontology and the corresponding *owldoc* original is AGRIF:
643
+
644
+ - `AGRIF as vocpub <https://raw.githack.com/RDFLib/pyLODE/master/pylode/examples/agrif.skos.html>`_
645
+ - `AGRIF as owldoc <https://raw.githack.com/RDFLib/pyLODE/master/pylode/examples/agrif.html>`_
646
+
647
+
648
+ Differences from LODE
649
+ =====================
650
+ - command line access
651
+
652
+ - you can use this on your own desktop so you don't need me to
653
+ maintain a live service for use
654
+
655
+ - use of more modern & simpler HTML
656
+ - catering for a wider range of ontology options such as:
657
+
658
+ - schema.org ``domainIncludes`` & ``rangeIncludes`` for properties
659
+
660
+ - better Agent linking
661
+
662
+ - ``foaf:Agent`` or ``schema:Person`` objects for creators,
663
+ contributors & publishers
664
+ - you can still use simple string peoperties like
665
+ ``dc:contributor "Nicholas J. Car"`` too if you really must!
666
+
667
+ ::
668
+
669
+ <ontology_x>
670
+ dct:creator [
671
+ sdo:name "Nicholas J. Car" ;
672
+ sdo:identifier <http://orcid.org/0000-0002-8742-7730> ;
673
+ ] ;
674
+
675
+ - smarter CURIES
676
+
677
+ - pyLODE caches and looks up well-known prefixes to make more/better
678
+ CURIES
679
+ - it tries to be smart with CURIE presentation by CURIE-ising all
680
+ URIs it finds, rather than printing them
681
+
682
+ - **active development**
683
+
684
+ - this software is in use and will be improved for the foreseeable
685
+ future so we will cater for more and more things
686
+ - recent ontology documentation initiatives such as the `MOD
687
+ Ontology <https://github.com/sifrproject/MOD-Ontology>`__ will be
688
+ handled, if requested
689
+
690
+
691
+ Releases
692
+ ========
693
+ pyLODE is under continual and constant development. The current developers have a roadmap for enhancements in mind,
694
+ which is given here, however, since this is an open source project, new developers may join the pyLODE dev community
695
+ and change/add development priorities.
696
+
697
+ Current Release
698
+ ---------------
699
+
700
+ The current release, as of July 2020, is **2.8.3**.
701
+
702
+ Release Schedule
703
+ ----------------
704
+
705
+ .. csv-table:: **pyLODE Release Schedule**
706
+ :header: "Version", "Date", "Description"
707
+ :widths: 15, 10, 30
708
+
709
+ 3.0, *June 2020*, "Will include pre-testing inputs with SHACL"
710
+ **2.8.3**, **3 July 2020**, "Packaging bugfixes only"
711
+ 2.7, 1 July 2020, "Much refactoring for new profile creation ease"
712
+ 2.6, June 2020, "Supports PROF profiles as well as taxonomies & ontologies"
713
+ 2.4, 27 May 2020, "Small improvements over 2.0"
714
+ 2.0, 18 Apr 2020, "Includes multiple profiles - OWP & vocpub"
715
+ 1.0, 15 Dec 2019, "Initial working release"
716
+
717
+ Release Notes
718
+ -------------
719
+
720
+ 3.0 - expected
721
+ ~~~~~~~~~~~~~~
722
+ Expected to handle
723
+
724
+ - pre-documentation graph shape testing using SHACL
725
+ - you will be able to see what pyLODE-recommended annotation and design patterns your inputs do/don't handle
726
+ - "modp", a documentation profile based on the `MOD Ontology <https://github.com/sifrproject/MOD-Ontology>`_
727
+
728
+ 2.0 - current
729
+ ~~~~~~~~~~~~~~
730
+ - handles Named Individuals in OWL ontologies
731
+ - implements "owldoc" & "vocpub" documentation profiles for OWL, SKOS and OWL-as-SKOS results
732
+ - implements "prof" profile for documentation of `Profiles Vocabulary <https://www.w3.org/TR/dx-prof/>`__ profiles
733
+ - has a more modular structure than 1.0 to assist with the creation or more profiles
734
+
735
+ 1.0 - previous
736
+ ~~~~~~~~~~~~~~
737
+ Initial pyLODE release. Generated HTML documentation for OWL ontologies, missed quite a few expected ontology elements,
738
+ such as Named Individuals.
739
+
740
+ License
741
+ =======
742
+ This code is licensed using the GPL v3 licence. See the `LICENSE
743
+ file <LICENSE>`_ for the deed. Note *Citation* below though for
744
+ attribution.
745
+
746
+
747
+ Citation
748
+ ========
749
+ If you use pyLODE, please leave the pyLODE logo with a hyperlink back
750
+ here in the top left of published HTML pages.
751
+
752
+
753
+ Collaboration
754
+ =============
755
+ The maintainers welcome any collaboration.
756
+
757
+ If you have suggestions, please email the contacts below or leave Issues
758
+ in this repository's `Issue tracker <https://github.com/rdflib/pyLODE/issues>`_.
759
+
760
+ But the very best thing you could do is create a Pull Request for us to
761
+ action!
762
+
763
+
764
+ Contacts
765
+ ========
766
+ | *Author*:
767
+ | **Nicholas Car**
768
+ | *Data System Architect*
769
+ | `SURROUND Australia Pty Ltd <https://surroundaustralia.com>`_
770
+ | nicholas.car@surroundaustralia.com
771
+
772
+