pylode 2.8.3__tar.gz → 2.8.5__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.
Files changed (71) hide show
  1. {pyLODE-2.8.3 → pyLODE-2.8.5}/PKG-INFO +47 -19
  2. {pyLODE-2.8.3 → pyLODE-2.8.5}/README.rst +45 -17
  3. {pyLODE-2.8.3 → pyLODE-2.8.5}/pyLODE.egg-info/PKG-INFO +47 -19
  4. {pyLODE-2.8.3 → pyLODE-2.8.5}/pyLODE.egg-info/requires.txt +0 -5
  5. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/cli.py +9 -31
  6. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/common.py +16 -20
  7. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/profiles/base.py +2 -2
  8. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/profiles/ontdoc.py +6 -9
  9. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/profiles/prof.py +4 -5
  10. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/profiles/profile.py +12 -1
  11. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/profiles/vocpub.py +4 -7
  12. pyLODE-2.8.5/pylode/server.py +60 -0
  13. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/class.html +1 -1
  14. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/property.html +2 -2
  15. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/collection.html +2 -2
  16. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/concept.md +2 -2
  17. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/concepts.md +1 -1
  18. pyLODE-2.8.5/pylode/tests/test_ont_html_description.py +9 -0
  19. pyLODE-2.8.5/pylode/tests/test_skos.py +7 -0
  20. pyLODE-2.8.3/pylode/server.py +0 -24
  21. pyLODE-2.8.3/pylode/tests/test_ont_html_description.py +0 -7
  22. pyLODE-2.8.3/pylode/tests/test_skos.py +0 -8
  23. {pyLODE-2.8.3 → pyLODE-2.8.5}/LICENSE +0 -0
  24. {pyLODE-2.8.3 → pyLODE-2.8.5}/pyLODE.egg-info/SOURCES.txt +0 -0
  25. {pyLODE-2.8.3 → pyLODE-2.8.5}/pyLODE.egg-info/dependency_links.txt +0 -0
  26. {pyLODE-2.8.3 → pyLODE-2.8.5}/pyLODE.egg-info/entry_points.txt +0 -0
  27. {pyLODE-2.8.3 → pyLODE-2.8.5}/pyLODE.egg-info/top_level.txt +0 -0
  28. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/__init__.py +0 -0
  29. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/curies.py +0 -0
  30. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/profiles/__init__.py +0 -0
  31. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/style/pylode.css +0 -0
  32. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/agent.html +0 -0
  33. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/agent.md +0 -0
  34. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/namespaces.html +0 -0
  35. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/namespaces.md +0 -0
  36. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/class.md +0 -0
  37. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/classes.html +0 -0
  38. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/classes.md +0 -0
  39. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/document.html +0 -0
  40. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/document.md +0 -0
  41. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/metadata.html +0 -0
  42. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/metadata.md +0 -0
  43. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/named_individual.html +0 -0
  44. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/named_individual.md +0 -0
  45. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/named_individuals.html +0 -0
  46. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/named_individuals.md +0 -0
  47. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/properties.html +0 -0
  48. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/properties.md +0 -0
  49. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/ontdoc/property.md +0 -0
  50. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/orcid.html +0 -0
  51. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/orcid.md +0 -0
  52. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/prof/prof.html +0 -0
  53. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/prof/prof.md +0 -0
  54. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/prof/profile.html +0 -0
  55. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/prof/profile.md +0 -0
  56. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/prof/resource_descriptor.html +0 -0
  57. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/prof/resource_descriptor.md +0 -0
  58. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/collection.md +0 -0
  59. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/collections.html +0 -0
  60. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/collections.md +0 -0
  61. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/concept.html +0 -0
  62. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/concept_hierarchy.html +0 -0
  63. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/concept_scheme.html +0 -0
  64. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/concept_scheme.md +0 -0
  65. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/concepts.html +0 -0
  66. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/taxonomy.html +0 -0
  67. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/templates/vocpub/taxonomy.md +0 -0
  68. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/tests/__init__.py +0 -0
  69. {pyLODE-2.8.3 → pyLODE-2.8.5}/pylode/tests/tests_all.py +0 -0
  70. {pyLODE-2.8.3 → pyLODE-2.8.5}/setup.cfg +0 -0
  71. {pyLODE-2.8.3 → pyLODE-2.8.5}/setup.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyLODE
3
- Version: 2.8.3
3
+ Version: 2.8.5
4
4
  Summary: An OWL ontology documentation tool using Python and templating, based on LODE.
5
5
  Home-page: https://github.com/rdflib/pyLODE
6
6
  Author: Nicholas J. Car
7
7
  Author-email: nicholas.car@surroundaustralia.com
8
8
  License: LICENSE
9
- Download-URL: https://github.com/rdflib/pyLODE/archive/v2.8.3.tar.gz
9
+ Download-URL: https://github.com/rdflib/pyLODE/archive/v2.8.5.tar.gz
10
10
  Project-URL: Bug Reports, https://github.com/rdflib/pyLODE/issues
11
11
  Project-URL: Source, https://github.com/rdflib/pyLODE/
12
12
  Description: .. image:: img/pyLODE-250.png
@@ -66,7 +66,7 @@ Description: .. image:: img/pyLODE-250.png
66
66
  - via the popular `Falcon framework <https://falconframework.org/>`__.
67
67
  - see server.py in the main folder
68
68
  - as-a-service online
69
- - hosted at https://kurrawong.net/pylode-online
69
+ - hosted at https://pylode.surroundaustralia.com
70
70
 
71
71
 
72
72
  Examples
@@ -164,9 +164,11 @@ Description: .. image:: img/pyLODE-250.png
164
164
  * `pylode/bin/pylode.app <pylode/bin/pylode.app>`__ - MAC OS command line executable script
165
165
  * `pylode/bin/pylode.exe <pylode/bin/pylode.exe>`__ - Windows command line executable
166
166
 
167
+ All use the same command line arguments.
168
+
167
169
  Additionally, there is a `Falcon framework <https://falconframework.org/>`__ local HTTP server option.
168
170
 
169
- All use the same command line arguments.
171
+ Also, a web UI for pyLODE is available at `<https://pylode.surroundaustralia.com>`.
170
172
 
171
173
  Command line arguments
172
174
  ----------------------
@@ -176,8 +178,8 @@ Description: .. image:: img/pyLODE-250.png
176
178
  - 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
177
179
  - ``-u`` or ``--url``, *required if* ``-i`` *not used*
178
180
  - 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.
179
- - ``-c`` or ``--css``, *optional, default 'false'*
180
- - Whether (true) or not (false) to copy the default CSS file to the output directory.
181
+ - ``-c`` or ``--css``, *optional, default 'true'*
182
+ - Whether (true) or not (false) to include CSS in an HTML output.
181
183
  - ``-o`` or ``--outputfile``, *optional*
182
184
  - 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.
183
185
  - ``-f`` or ``--outputformat``, *optional, default 'html'*
@@ -189,18 +191,41 @@ Description: .. image:: img/pyLODE-250.png
189
191
 
190
192
  Example call
191
193
  ------------
192
- This call to the BASH script in `pylode/bin/ <pylode/bin/>`__ will
193
- create an HTML document for an ontology called ``placenames.html`` and
194
- save it with a basic CSS file into
195
- `pylode/output\_files/ <pylode/output_files/>`__:
194
+ This basic call to the BASH script in `pylode/bin/ <pylode/bin/>`__ will
195
+ print to standard out an HTML document for an ontology called ``placenames.html``.
196
196
 
197
197
  ::
198
198
 
199
- ./pylode -i ../example/prof.ttl --css true
199
+ ./pylode -i ../example/prof.ttl
200
+
201
+ An output file could be specified by using `-o`, rather than printing to standard out.
200
202
 
201
203
  Online Service
202
204
  --------------
203
- An online API to access pyLODE is now available in test mode at https://kurrawong.net/pylode-online.
205
+ An online version of pyLODE is now available at https://pylode.surroundaustralia.com/.
206
+
207
+ Docker
208
+ ------
209
+ Install locally by first building the container
210
+
211
+ ::
212
+
213
+ docker build -t pylode:latest --build-arg PYTHON_VERSION=3.8-slim .
214
+
215
+ Then run the container
216
+
217
+ ::
218
+
219
+ docker run -it -d -p 8000:8000 -e GTAGID=${Google TagID} pylode
220
+
221
+ N.B. The Google TagID is NOT required unless Google Analytics is required.
222
+ It looks as follows `GTAGID=UA-168806395-1`.
223
+
224
+ You can now access the service on localhost
225
+
226
+ ::
227
+
228
+ curl localhost:8000/lode?url=http://sweetontology.net/sweetAll.ttl
204
229
 
205
230
  Local server - Falcon
206
231
  ---------------------
@@ -208,13 +233,14 @@ Description: .. image:: img/pyLODE-250.png
208
233
 
209
234
  ::
210
235
 
211
- cd pylode && gunicorn --chdir /path/to/pyLODE/pylode server:api
236
+ gunicorn --chdir /path/to/pyLODE/pylode server:api
237
+
238
+ The server is then available at localhost:8000 and localhost:8000/pylode for the active endpoint. Note that the server must be fed a URL to an ontology to document supplied by a server capable of responding to Content Negotiation, i.e. it must supply RDF according to an HTTP `Accept` request for `text/turtle`, `application/rdf+xml` etc.
212
239
 
213
- Then, in another terminal:
214
240
 
215
241
  ::
216
242
 
217
- curl localhost:8000/lode?url=http://sweetontology.net/sweetAll.ttl
243
+ curl localhost:8000/pylode?url=http://sweetontology.net/sweetAll.ttl
218
244
 
219
245
  Windows
220
246
  -------
@@ -253,6 +279,7 @@ Description: .. image:: img/pyLODE-250.png
253
279
  -----
254
280
  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``.
255
281
 
282
+
256
283
  What pyLODE understands
257
284
  =======================
258
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.
@@ -534,7 +561,7 @@ Description: .. image:: img/pyLODE-250.png
534
561
  **Token** **URI**
535
562
  ========= ==========================================
536
563
  prof `<https://www.w3.org/TR/dx-prof/>`_
537
- ontdoc `<https://w3id.org/profile/ontdocp>`_
564
+ ontdoc `<https://w3id.org/profile/ontdoc>`_
538
565
  vocpub `<https://w3id.org/profile/vocpub>`_
539
566
  ========= ==========================================
540
567
 
@@ -670,7 +697,7 @@ Description: .. image:: img/pyLODE-250.png
670
697
  Current Release
671
698
  ---------------
672
699
 
673
- The current release, as of July 2020, is **2.8.3**.
700
+ The current release, as of January, 2021, is **2.8.5**.
674
701
 
675
702
  Release Schedule
676
703
  ----------------
@@ -679,8 +706,9 @@ Description: .. image:: img/pyLODE-250.png
679
706
  :header: "Version", "Date", "Description"
680
707
  :widths: 15, 10, 30
681
708
 
682
- 3.0, *June 2020*, "Will include pre-testing inputs with SHACL"
683
- **2.8.3**, **3 July 2020**, "Packaging bugfixes only"
709
+ 3.0, *?*, "Will include pre-testing inputs with SHACL"
710
+ **2.8.5**, **5 Jan 20201**, "Small enhancements to the Falcon server deployment option"
711
+ 2.8.3, 3 July 2020, "Packaging bugfixes only"
684
712
  2.7, 1 July 2020, "Much refactoring for new profile creation ease"
685
713
  2.6, June 2020, "Supports PROF profiles as well as taxonomies & ontologies"
686
714
  2.4, 27 May 2020, "Small improvements over 2.0"
@@ -55,7 +55,7 @@ The tool can be run as in these ways:
55
55
  - via the popular `Falcon framework <https://falconframework.org/>`__.
56
56
  - see server.py in the main folder
57
57
  - as-a-service online
58
- - hosted at https://kurrawong.net/pylode-online
58
+ - hosted at https://pylode.surroundaustralia.com
59
59
 
60
60
 
61
61
  Examples
@@ -153,9 +153,11 @@ pyLODE presents natively as a Python command-line utility,
153
153
  * `pylode/bin/pylode.app <pylode/bin/pylode.app>`__ - MAC OS command line executable script
154
154
  * `pylode/bin/pylode.exe <pylode/bin/pylode.exe>`__ - Windows command line executable
155
155
 
156
+ All use the same command line arguments.
157
+
156
158
  Additionally, there is a `Falcon framework <https://falconframework.org/>`__ local HTTP server option.
157
159
 
158
- All use the same command line arguments.
160
+ Also, a web UI for pyLODE is available at `<https://pylode.surroundaustralia.com>`.
159
161
 
160
162
  Command line arguments
161
163
  ----------------------
@@ -165,8 +167,8 @@ These are the command line arguments to run pyLODE as a BASH or Python script on
165
167
  - 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
166
168
  - ``-u`` or ``--url``, *required if* ``-i`` *not used*
167
169
  - 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.
168
- - ``-c`` or ``--css``, *optional, default 'false'*
169
- - Whether (true) or not (false) to copy the default CSS file to the output directory.
170
+ - ``-c`` or ``--css``, *optional, default 'true'*
171
+ - Whether (true) or not (false) to include CSS in an HTML output.
170
172
  - ``-o`` or ``--outputfile``, *optional*
171
173
  - 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.
172
174
  - ``-f`` or ``--outputformat``, *optional, default 'html'*
@@ -178,18 +180,41 @@ These are the command line arguments to run pyLODE as a BASH or Python script on
178
180
 
179
181
  Example call
180
182
  ------------
181
- This call to the BASH script in `pylode/bin/ <pylode/bin/>`__ will
182
- create an HTML document for an ontology called ``placenames.html`` and
183
- save it with a basic CSS file into
184
- `pylode/output\_files/ <pylode/output_files/>`__:
183
+ This basic call to the BASH script in `pylode/bin/ <pylode/bin/>`__ will
184
+ print to standard out an HTML document for an ontology called ``placenames.html``.
185
185
 
186
186
  ::
187
187
 
188
- ./pylode -i ../example/prof.ttl --css true
188
+ ./pylode -i ../example/prof.ttl
189
+
190
+ An output file could be specified by using `-o`, rather than printing to standard out.
189
191
 
190
192
  Online Service
191
193
  --------------
192
- An online API to access pyLODE is now available in test mode at https://kurrawong.net/pylode-online.
194
+ An online version of pyLODE is now available at https://pylode.surroundaustralia.com/.
195
+
196
+ Docker
197
+ ------
198
+ Install locally by first building the container
199
+
200
+ ::
201
+
202
+ docker build -t pylode:latest --build-arg PYTHON_VERSION=3.8-slim .
203
+
204
+ Then run the container
205
+
206
+ ::
207
+
208
+ docker run -it -d -p 8000:8000 -e GTAGID=${Google TagID} pylode
209
+
210
+ N.B. The Google TagID is NOT required unless Google Analytics is required.
211
+ It looks as follows `GTAGID=UA-168806395-1`.
212
+
213
+ You can now access the service on localhost
214
+
215
+ ::
216
+
217
+ curl localhost:8000/lode?url=http://sweetontology.net/sweetAll.ttl
193
218
 
194
219
  Local server - Falcon
195
220
  ---------------------
@@ -197,13 +222,14 @@ You can run pyLODE using your own, local, HTTP server like this:
197
222
 
198
223
  ::
199
224
 
200
- cd pylode && gunicorn --chdir /path/to/pyLODE/pylode server:api
225
+ gunicorn --chdir /path/to/pyLODE/pylode server:api
226
+
227
+ The server is then available at localhost:8000 and localhost:8000/pylode for the active endpoint. Note that the server must be fed a URL to an ontology to document supplied by a server capable of responding to Content Negotiation, i.e. it must supply RDF according to an HTTP `Accept` request for `text/turtle`, `application/rdf+xml` etc.
201
228
 
202
- Then, in another terminal:
203
229
 
204
230
  ::
205
231
 
206
- curl localhost:8000/lode?url=http://sweetontology.net/sweetAll.ttl
232
+ curl localhost:8000/pylode?url=http://sweetontology.net/sweetAll.ttl
207
233
 
208
234
  Windows
209
235
  -------
@@ -242,6 +268,7 @@ Linux
242
268
  -----
243
269
  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``.
244
270
 
271
+
245
272
  What pyLODE understands
246
273
  =======================
247
274
  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.
@@ -523,7 +550,7 @@ profiles include, see the profiles' definitions at:
523
550
  **Token** **URI**
524
551
  ========= ==========================================
525
552
  prof `<https://www.w3.org/TR/dx-prof/>`_
526
- ontdoc `<https://w3id.org/profile/ontdocp>`_
553
+ ontdoc `<https://w3id.org/profile/ontdoc>`_
527
554
  vocpub `<https://w3id.org/profile/vocpub>`_
528
555
  ========= ==========================================
529
556
 
@@ -659,7 +686,7 @@ and change/add development priorities.
659
686
  Current Release
660
687
  ---------------
661
688
 
662
- The current release, as of July 2020, is **2.8.3**.
689
+ The current release, as of January, 2021, is **2.8.5**.
663
690
 
664
691
  Release Schedule
665
692
  ----------------
@@ -668,8 +695,9 @@ Release Schedule
668
695
  :header: "Version", "Date", "Description"
669
696
  :widths: 15, 10, 30
670
697
 
671
- 3.0, *June 2020*, "Will include pre-testing inputs with SHACL"
672
- **2.8.3**, **3 July 2020**, "Packaging bugfixes only"
698
+ 3.0, *?*, "Will include pre-testing inputs with SHACL"
699
+ **2.8.5**, **5 Jan 20201**, "Small enhancements to the Falcon server deployment option"
700
+ 2.8.3, 3 July 2020, "Packaging bugfixes only"
673
701
  2.7, 1 July 2020, "Much refactoring for new profile creation ease"
674
702
  2.6, June 2020, "Supports PROF profiles as well as taxonomies & ontologies"
675
703
  2.4, 27 May 2020, "Small improvements over 2.0"
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyLODE
3
- Version: 2.8.3
3
+ Version: 2.8.5
4
4
  Summary: An OWL ontology documentation tool using Python and templating, based on LODE.
5
5
  Home-page: https://github.com/rdflib/pyLODE
6
6
  Author: Nicholas J. Car
7
7
  Author-email: nicholas.car@surroundaustralia.com
8
8
  License: LICENSE
9
- Download-URL: https://github.com/rdflib/pyLODE/archive/v2.8.3.tar.gz
9
+ Download-URL: https://github.com/rdflib/pyLODE/archive/v2.8.5.tar.gz
10
10
  Project-URL: Bug Reports, https://github.com/rdflib/pyLODE/issues
11
11
  Project-URL: Source, https://github.com/rdflib/pyLODE/
12
12
  Description: .. image:: img/pyLODE-250.png
@@ -66,7 +66,7 @@ Description: .. image:: img/pyLODE-250.png
66
66
  - via the popular `Falcon framework <https://falconframework.org/>`__.
67
67
  - see server.py in the main folder
68
68
  - as-a-service online
69
- - hosted at https://kurrawong.net/pylode-online
69
+ - hosted at https://pylode.surroundaustralia.com
70
70
 
71
71
 
72
72
  Examples
@@ -164,9 +164,11 @@ Description: .. image:: img/pyLODE-250.png
164
164
  * `pylode/bin/pylode.app <pylode/bin/pylode.app>`__ - MAC OS command line executable script
165
165
  * `pylode/bin/pylode.exe <pylode/bin/pylode.exe>`__ - Windows command line executable
166
166
 
167
+ All use the same command line arguments.
168
+
167
169
  Additionally, there is a `Falcon framework <https://falconframework.org/>`__ local HTTP server option.
168
170
 
169
- All use the same command line arguments.
171
+ Also, a web UI for pyLODE is available at `<https://pylode.surroundaustralia.com>`.
170
172
 
171
173
  Command line arguments
172
174
  ----------------------
@@ -176,8 +178,8 @@ Description: .. image:: img/pyLODE-250.png
176
178
  - 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
177
179
  - ``-u`` or ``--url``, *required if* ``-i`` *not used*
178
180
  - 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.
179
- - ``-c`` or ``--css``, *optional, default 'false'*
180
- - Whether (true) or not (false) to copy the default CSS file to the output directory.
181
+ - ``-c`` or ``--css``, *optional, default 'true'*
182
+ - Whether (true) or not (false) to include CSS in an HTML output.
181
183
  - ``-o`` or ``--outputfile``, *optional*
182
184
  - 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.
183
185
  - ``-f`` or ``--outputformat``, *optional, default 'html'*
@@ -189,18 +191,41 @@ Description: .. image:: img/pyLODE-250.png
189
191
 
190
192
  Example call
191
193
  ------------
192
- This call to the BASH script in `pylode/bin/ <pylode/bin/>`__ will
193
- create an HTML document for an ontology called ``placenames.html`` and
194
- save it with a basic CSS file into
195
- `pylode/output\_files/ <pylode/output_files/>`__:
194
+ This basic call to the BASH script in `pylode/bin/ <pylode/bin/>`__ will
195
+ print to standard out an HTML document for an ontology called ``placenames.html``.
196
196
 
197
197
  ::
198
198
 
199
- ./pylode -i ../example/prof.ttl --css true
199
+ ./pylode -i ../example/prof.ttl
200
+
201
+ An output file could be specified by using `-o`, rather than printing to standard out.
200
202
 
201
203
  Online Service
202
204
  --------------
203
- An online API to access pyLODE is now available in test mode at https://kurrawong.net/pylode-online.
205
+ An online version of pyLODE is now available at https://pylode.surroundaustralia.com/.
206
+
207
+ Docker
208
+ ------
209
+ Install locally by first building the container
210
+
211
+ ::
212
+
213
+ docker build -t pylode:latest --build-arg PYTHON_VERSION=3.8-slim .
214
+
215
+ Then run the container
216
+
217
+ ::
218
+
219
+ docker run -it -d -p 8000:8000 -e GTAGID=${Google TagID} pylode
220
+
221
+ N.B. The Google TagID is NOT required unless Google Analytics is required.
222
+ It looks as follows `GTAGID=UA-168806395-1`.
223
+
224
+ You can now access the service on localhost
225
+
226
+ ::
227
+
228
+ curl localhost:8000/lode?url=http://sweetontology.net/sweetAll.ttl
204
229
 
205
230
  Local server - Falcon
206
231
  ---------------------
@@ -208,13 +233,14 @@ Description: .. image:: img/pyLODE-250.png
208
233
 
209
234
  ::
210
235
 
211
- cd pylode && gunicorn --chdir /path/to/pyLODE/pylode server:api
236
+ gunicorn --chdir /path/to/pyLODE/pylode server:api
237
+
238
+ The server is then available at localhost:8000 and localhost:8000/pylode for the active endpoint. Note that the server must be fed a URL to an ontology to document supplied by a server capable of responding to Content Negotiation, i.e. it must supply RDF according to an HTTP `Accept` request for `text/turtle`, `application/rdf+xml` etc.
212
239
 
213
- Then, in another terminal:
214
240
 
215
241
  ::
216
242
 
217
- curl localhost:8000/lode?url=http://sweetontology.net/sweetAll.ttl
243
+ curl localhost:8000/pylode?url=http://sweetontology.net/sweetAll.ttl
218
244
 
219
245
  Windows
220
246
  -------
@@ -253,6 +279,7 @@ Description: .. image:: img/pyLODE-250.png
253
279
  -----
254
280
  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``.
255
281
 
282
+
256
283
  What pyLODE understands
257
284
  =======================
258
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.
@@ -534,7 +561,7 @@ Description: .. image:: img/pyLODE-250.png
534
561
  **Token** **URI**
535
562
  ========= ==========================================
536
563
  prof `<https://www.w3.org/TR/dx-prof/>`_
537
- ontdoc `<https://w3id.org/profile/ontdocp>`_
564
+ ontdoc `<https://w3id.org/profile/ontdoc>`_
538
565
  vocpub `<https://w3id.org/profile/vocpub>`_
539
566
  ========= ==========================================
540
567
 
@@ -670,7 +697,7 @@ Description: .. image:: img/pyLODE-250.png
670
697
  Current Release
671
698
  ---------------
672
699
 
673
- The current release, as of July 2020, is **2.8.3**.
700
+ The current release, as of January, 2021, is **2.8.5**.
674
701
 
675
702
  Release Schedule
676
703
  ----------------
@@ -679,8 +706,9 @@ Description: .. image:: img/pyLODE-250.png
679
706
  :header: "Version", "Date", "Description"
680
707
  :widths: 15, 10, 30
681
708
 
682
- 3.0, *June 2020*, "Will include pre-testing inputs with SHACL"
683
- **2.8.3**, **3 July 2020**, "Packaging bugfixes only"
709
+ 3.0, *?*, "Will include pre-testing inputs with SHACL"
710
+ **2.8.5**, **5 Jan 20201**, "Small enhancements to the Falcon server deployment option"
711
+ 2.8.3, 3 July 2020, "Packaging bugfixes only"
684
712
  2.7, 1 July 2020, "Much refactoring for new profile creation ease"
685
713
  2.6, June 2020, "Supports PROF profiles as well as taxonomies & ontologies"
686
714
  2.4, 27 May 2020, "Small improvements over 2.0"
@@ -1,10 +1,5 @@
1
- argparse
2
- falcon
3
- gunicorn
4
1
  jinja2
5
2
  markdown
6
- pytest
7
- python-dateutil
8
3
  rdflib>=5.0.0
9
4
  rdflib-jsonld>=0.5.0
10
5
  requests
@@ -63,17 +63,9 @@ def main(args=None):
63
63
  parser.add_argument(
64
64
  "-c",
65
65
  "--css",
66
- help="Whether (true) or not (false) to copy the default CSS file to the output directory.",
66
+ help="Whether (true) or not (false) to include CSS within an output HTML file.",
67
67
  choices=["true", "false"],
68
- default="false",
69
- )
70
-
71
- parser.add_argument(
72
- "-xc",
73
- "--excludecss",
74
- help="Whether (true) or not (false) to exclude the standard pyLODE CSS content from an HTML file output.",
75
- choices=["true", "false"],
76
- default="false",
68
+ default="true",
77
69
  )
78
70
 
79
71
  parser.add_argument(
@@ -117,10 +109,10 @@ def main(args=None):
117
109
  print(__version__)
118
110
  exit()
119
111
  elif args.inputfile or args.url:
120
- if args.excludecss == "true":
121
- exclude_css = True
112
+ if args.css == "true":
113
+ include_css = True
122
114
  else:
123
- exclude_css = False
115
+ include_css = False
124
116
 
125
117
  # args are present so getting RDF from input file or uri into an rdflib Graph
126
118
  if args.inputfile:
@@ -128,14 +120,14 @@ def main(args=None):
128
120
  input_data_file=args.inputfile,
129
121
  outputformat=args.outputformat,
130
122
  profile=args.profile,
131
- exclude_css=exclude_css
123
+ include_css=include_css
132
124
  )
133
125
  elif args.url:
134
126
  h = MakeDocco(
135
127
  input_uri=args.url,
136
128
  outputformat=args.outputformat,
137
129
  profile=args.profile,
138
- exclude_css=exclude_css
130
+ include_css=include_css
139
131
  )
140
132
  else:
141
133
  # we have neither an input file or a URI supplied
@@ -152,23 +144,9 @@ def main(args=None):
152
144
 
153
145
  # here we have a parsed graph from either a local file or a URI
154
146
 
155
- # set up output directories and resources
156
- main_dir = path.dirname(path.realpath(__file__))
157
- style_dir = path.join(main_dir, "style")
158
- if h.publication_dir == "":
159
- h.publication_dir = "."
160
- os.makedirs(h.publication_dir, exist_ok=True)
161
-
162
- # include CSS
163
- if args.css == "true":
164
- shutil.copyfile(
165
- path.join(style_dir, "pylode.css"), path.join(h.publication_dir, "style.css")
166
- )
167
-
147
+ # name the output file
168
148
  if args.outputfile is not None:
169
- output_file_name = (
170
- args.outputfile if args.outputfile else "doc.html"
171
- )
149
+ output_file_name = args.outputfile
172
150
 
173
151
  if args.outputformat == "html":
174
152
  if not output_file_name.endswith(".html"):
@@ -1,8 +1,8 @@
1
1
  from os import path
2
- import requests
2
+ from urllib import request
3
3
  from rdflib import util, Graph
4
4
 
5
- VERSION = "2.8.3"
5
+ VERSION = "2.8.5"
6
6
  APP_DIR = path.dirname(path.realpath(__file__))
7
7
  TEMPLATES_DIR = path.join(path.dirname(path.realpath(__file__)), "templates")
8
8
  STYLE_DIR = path.join(path.dirname(path.realpath(__file__)), "style")
@@ -30,7 +30,7 @@ from .profiles import OntDoc, Prof, VocPub, PROFILES
30
30
 
31
31
 
32
32
  class MakeDocco:
33
- def __init__(self, input_data_file=None, input_uri=None, data=None, outputformat="html", exclude_css=False, get_curies_online=False, profile="ontdoc"):
33
+ def __init__(self, input_data_file=None, input_uri=None, data=None, outputformat="html", include_css=True, get_curies_online=False, profile="ontdoc"):
34
34
  """This class receives all of the variables needed to specify how to make documentation from an input RDF source
35
35
 
36
36
  :param input_data_file: An RDF file
@@ -41,8 +41,8 @@ class MakeDocco:
41
41
  :type data: Python varaible (string)
42
42
  :param outputformat: The desired output format form the list of supported formats (currently either "html" (default) or "md" for Markdown
43
43
  :type outputformat: string (one of "html" or "md")
44
- :param exclude_css: Whether (True, default) or not (False) to include styling CSS within HTML outputs (as oposed to producing a separate style.css file)
45
- :type exclude_css: boolean
44
+ :param include_css: Whether (True, default) or not (False) to include styling CSS within HTML outputs
45
+ :type include_css: boolean
46
46
  :param get_curies_online: Whether (True) or not (False, default) to search prefix.cc online for additional URI prefixes
47
47
  :type get_curies_online: boolean
48
48
  :param profile: When document profile, from a supported set, to use. Currently supported is "ontdoc" (profile of OWL) or "skosp" (profile of SKOS). See `list_profiles()` for full list of profiles.
@@ -55,7 +55,7 @@ class MakeDocco:
55
55
  else:
56
56
  self.outputformat = outputformat
57
57
 
58
- self.exclude_css = exclude_css
58
+ self.include_css = include_css
59
59
  self.get_curies_online = get_curies_online
60
60
 
61
61
  if profile not in PROFILES.keys():
@@ -97,14 +97,12 @@ class MakeDocco:
97
97
 
98
98
  self.G = Graph().parse(file_name, format=fmt)
99
99
  self.source_info = (file_name, fmt)
100
- self.publication_dir = path.dirname(file_name)
101
100
 
102
101
  def _parse_input_uri(self, uri):
103
- r = requests.get(
104
- uri, headers={"Accept": ", ".join(RDF_SERIALIZER_MAP.keys())}
105
- )
102
+ headers = {"Accept": ", ".join(RDF_SERIALIZER_MAP.keys())}
103
+ resp = request.urlopen(request.Request(uri, None, headers))
106
104
  # get RDF format from Media Type
107
- media_type = r.headers.get("Content-Type").split(";")[0] # splitting off any ;charset=...
105
+ media_type = resp.headers["Content-Type"].split(";")[0] # splitting off any ;charset=...
108
106
  if RDF_SERIALIZER_MAP.get(media_type):
109
107
  fmt = RDF_SERIALIZER_MAP.get(media_type)
110
108
  else:
@@ -121,16 +119,12 @@ class MakeDocco:
121
119
  "({} was given) or from a file extension".format(media_type)
122
120
  )
123
121
 
124
- self.G = Graph().parse(data=r.text, format=fmt)
122
+ self.G = Graph().parse(data=resp.read().decode(), format=fmt)
125
123
  self.source_info = (uri, fmt)
126
- self.publication_dir = path.join(
127
- path.dirname(path.realpath(__file__)), "output_files"
128
- )
129
124
 
130
125
  def _parse_data(self, data):
131
126
  self.G = Graph().parse(data=data, format="turtle")
132
127
  self.source_info = ("input.ttl", "turtle")
133
- self.publication_dir = path.dirname(path.realpath(__file__))
134
128
 
135
129
  @classmethod
136
130
  def list_profiles(cls):
@@ -155,7 +149,7 @@ class MakeDocco:
155
149
  self.G,
156
150
  self.source_info,
157
151
  outputformat=self.outputformat,
158
- exclude_css=self.exclude_css,
152
+ include_css=self.include_css,
159
153
  default_language="en",
160
154
  get_curies_online=self.get_curies_online
161
155
  )
@@ -164,7 +158,7 @@ class MakeDocco:
164
158
  self.G,
165
159
  self.source_info,
166
160
  outputformat=self.outputformat,
167
- exclude_css=self.exclude_css,
161
+ include_css=self.include_css,
168
162
  default_language="en",
169
163
  get_curies_online=self.get_curies_online
170
164
  )
@@ -173,7 +167,7 @@ class MakeDocco:
173
167
  self.G,
174
168
  self.source_info,
175
169
  outputformat=self.outputformat,
176
- exclude_css=self.exclude_css,
170
+ include_css=self.include_css,
177
171
  default_language="en",
178
172
  get_curies_online=self.get_curies_online
179
173
  )
@@ -185,7 +179,9 @@ class MakeDocco:
185
179
  f.write(doc)
186
180
  except Exception as e:
187
181
  print(e)
188
- raise Exception("The file you specified as 'destination' could not be written to. You specified {}.".format(destination))
182
+ raise Exception(
183
+ "The file you specified as 'destination' could not be written to. You specified {}."
184
+ .format(destination))
189
185
 
190
186
  else:
191
187
  return p.generate_document()
@@ -8,9 +8,9 @@ from pylode.common import TEMPLATES_DIR
8
8
 
9
9
 
10
10
  class BaseProfile:
11
- def __init__(self, g, source_info, outputformat="html", exclude_css=False, default_language="en", get_curies_online=False):
11
+ def __init__(self, g, source_info, outputformat="html", include_css=False, default_language="en", get_curies_online=False):
12
12
  self.outputformat = outputformat
13
- self.exclude_css = exclude_css
13
+ self.include_css = include_css
14
14
  self.default_language = default_language
15
15
  self.get_curies_online = get_curies_online
16
16
  self.default_namespace = None
@@ -2,7 +2,6 @@ from os import path
2
2
  from pylode.common import VERSION, TEMPLATES_DIR, STYLE_DIR
3
3
  import collections
4
4
  from os import path
5
- import dateutil.parser
6
5
  from itertools import chain
7
6
  import markdown
8
7
  from jinja2 import Environment, FileSystemLoader
@@ -13,8 +12,8 @@ from pylode.profiles.base import BaseProfile
13
12
 
14
13
 
15
14
  class OntDoc(BaseProfile):
16
- def __init__(self, g, source_info, outputformat="html", exclude_css=False, default_language="en", get_curies_online=False):
17
- super().__init__(g, source_info, outputformat=outputformat, exclude_css=exclude_css, get_curies_online=False, default_language=default_language)
15
+ def __init__(self, g, source_info, outputformat="html", include_css=False, default_language="en", get_curies_online=False):
16
+ super().__init__(g, source_info, outputformat=outputformat, include_css=include_css, get_curies_online=False, default_language=default_language)
18
17
  self.G.bind("prov", PROV)
19
18
  self.CLASSES = collections.OrderedDict()
20
19
  self.PROPERTIES = collections.OrderedDict()
@@ -363,9 +362,7 @@ class OntDoc(BaseProfile):
363
362
  # dates
364
363
  if p in [DCTERMS.created, DCTERMS.modified, DCTERMS.issued]:
365
364
  date_type = p.split("/")[-1]
366
- self.METADATA[date_type] = dateutil.parser.parse(str(o)).strftime(
367
- "%Y-%m-%d"
368
- )
365
+ self.METADATA[date_type] = str(o)
369
366
 
370
367
  if p == DCTERMS.source:
371
368
  if str(o).startswith('http'):
@@ -464,7 +461,7 @@ class OntDoc(BaseProfile):
464
461
  self.CLASSES[cls]["description"] = markdown.markdown(str(o))
465
462
 
466
463
  if p == SKOS.scopeNote:
467
- self.CLASSES[cls]["scopeNote"] = str(o)
464
+ self.CLASSES[cls]["scopeNote"] = markdown.markdown(str(o))
468
465
 
469
466
  if p == SKOS.example:
470
467
  self.CLASSES[cls]["example"] = str(o)
@@ -652,7 +649,7 @@ class OntDoc(BaseProfile):
652
649
  if p == RDFS.label:
653
650
  self.PROPERTIES[prop]["title"] = str(o)
654
651
 
655
- if p == RDFS.comment:
652
+ if p == DCTERMS.description:
656
653
  self.PROPERTIES[prop]["description"] = str(o)
657
654
 
658
655
  if p == SKOS.scopeNote:
@@ -1090,7 +1087,7 @@ class OntDoc(BaseProfile):
1090
1087
  def _make_document(self):
1091
1088
  css = None
1092
1089
  if self.outputformat == "html":
1093
- if not self.exclude_css:
1090
+ if self.include_css:
1094
1091
  css = open(path.join(STYLE_DIR, "pylode.css")).read()
1095
1092
 
1096
1093
  return self._load_template("document." + self.outputformat).render(
@@ -3,7 +3,6 @@ import collections
3
3
  from os import path
4
4
  from rdflib import URIRef, BNode, Literal
5
5
  from rdflib.namespace import DC, DCTERMS, OWL, PROF, RDF, RDFS, SDO, SKOS
6
- import dateutil.parser
7
6
  from itertools import chain
8
7
  import markdown
9
8
  from jinja2 import Environment, FileSystemLoader
@@ -12,8 +11,8 @@ from pylode.profiles.base import BaseProfile
12
11
 
13
12
 
14
13
  class Prof(BaseProfile):
15
- def __init__(self, g, source_info, outputformat="html", exclude_css=False, default_language="en", get_curies_online=False):
16
- super().__init__(g, source_info, outputformat=outputformat, exclude_css=exclude_css, get_curies_online=False, default_language=default_language)
14
+ def __init__(self, g, source_info, outputformat="html", include_css=False, default_language="en", get_curies_online=False):
15
+ super().__init__(g, source_info, outputformat=outputformat, include_css=include_css, get_curies_online=False, default_language=default_language)
17
16
  self.RESOURCE_DESCRIPTORS = collections.OrderedDict()
18
17
 
19
18
  def _load_template(self, template_file):
@@ -164,7 +163,7 @@ class Prof(BaseProfile):
164
163
  # dates
165
164
  if p in [DCTERMS.created, DCTERMS.modified, DCTERMS.issued]:
166
165
  date_type = p.split("/")[-1]
167
- self.METADATA[date_type] = dateutil.parser.parse(str(o)).strftime("%Y-%m-%d")
166
+ self.METADATA[date_type] = str(o)
168
167
 
169
168
  if p == OWL.versionIRI:
170
169
  self.METADATA["versionIRI"] = self._make_formatted_uri(o)
@@ -252,7 +251,7 @@ class Prof(BaseProfile):
252
251
  def _make_document(self):
253
252
  css = None
254
253
  if self.outputformat == "html":
255
- if not self.exclude_css:
254
+ if self.include_css:
256
255
  css = open(path.join(STYLE_DIR, "pylode.css")).read()
257
256
 
258
257
  return self._load_template("prof." + self.outputformat).render(
@@ -71,6 +71,17 @@ PROF_PROFILE = Profile(
71
71
  languages=["en"],
72
72
  default_language="en"
73
73
  )
74
+ PROF_FLAT_PROFILE = Profile(
75
+ "https://w3id.org/profile/prof-flat",
76
+ "Flattened PROF Hierarchy",
77
+ "A profile of the Profiles Vocabulary for documentation purposes that requires all details of profiles within a "
78
+ "profile hierarchy to be documented be present within a single graph (or file)."
79
+ "through profile hierarchy.",
80
+ [HTML_MEDIA_TYPE, "text/markdown"],
81
+ HTML_MEDIA_TYPE,
82
+ languages=["en"],
83
+ default_language="en"
84
+ )
74
85
  OWL_PROFILE = Profile(
75
86
  "https://www.w3.org/TR/owl2-rdf-based-semantics/",
76
87
  "Web Ontology Language (OWL)",
@@ -83,7 +94,7 @@ OWL_PROFILE = Profile(
83
94
  default_language="en"
84
95
  )
85
96
  ONT_DOC_PROFILE = Profile(
86
- "https://w3id.org/profile/ontdocp",
97
+ "https://w3id.org/profile/ontdoc",
87
98
  "Ontology Documentation Profile",
88
99
  "OWL Classes and Properties as well as additional SKOS, Dublin Core Terms and schema.org annotation "
89
100
  "properties to be used to document ontologies.",
@@ -3,7 +3,6 @@ import collections
3
3
  from os import path
4
4
  from rdflib import URIRef, BNode, Literal
5
5
  from rdflib.namespace import DC, DCTERMS, DOAP, OWL, PROV, RDF, RDFS, SDO, SKOS
6
- import dateutil.parser
7
6
  from itertools import chain
8
7
  import markdown
9
8
  from jinja2 import Environment, FileSystemLoader
@@ -12,8 +11,8 @@ from pylode.profiles.base import BaseProfile
12
11
 
13
12
 
14
13
  class VocPub(BaseProfile):
15
- def __init__(self, g, source_info, outputformat="html", exclude_css=False, default_language="en", get_curies_online=False):
16
- super().__init__(g, source_info, outputformat=outputformat, exclude_css=exclude_css, get_curies_online=False, default_language=default_language)
14
+ def __init__(self, g, source_info, outputformat="html", include_css=False, default_language="en", get_curies_online=False):
15
+ super().__init__(g, source_info, outputformat=outputformat, include_css=include_css, get_curies_online=False, default_language=default_language)
17
16
  self.CONCEPTS = collections.OrderedDict()
18
17
  self.COLLECTIONS = collections.OrderedDict()
19
18
 
@@ -359,9 +358,7 @@ class VocPub(BaseProfile):
359
358
  # dates
360
359
  if p in [DCTERMS.created, DCTERMS.modified, DCTERMS.issued]:
361
360
  date_type = p.split("/")[-1]
362
- self.METADATA[date_type] = dateutil.parser.parse(str(o)).strftime(
363
- "%Y-%m-%d"
364
- )
361
+ self.METADATA[date_type] = str(o)
365
362
 
366
363
  if p == DCTERMS.source:
367
364
  if str(o).startswith('http'):
@@ -573,7 +570,7 @@ class VocPub(BaseProfile):
573
570
  def _make_document(self):
574
571
  css = None
575
572
  if self.outputformat == "html":
576
- if not self.exclude_css:
573
+ if self.include_css:
577
574
  css = open(path.join(STYLE_DIR, "pylode.css")).read()
578
575
 
579
576
  return self._load_template("taxonomy." + self.outputformat).render(
@@ -0,0 +1,60 @@
1
+ from bs4 import BeautifulSoup as Soup
2
+ import falcon
3
+ import os
4
+ import subprocess
5
+
6
+
7
+ class InfoResource:
8
+ def on_get(self, req, resp):
9
+ resp.body = """<h3>pyLODE Server</h3>
10
+ <p>This is <a href=\"https://github.com/rdflib/pyLODE/\">pyLODE</a> online via Falcon.</p>
11
+ <p>To use this server to document ontologies, supply an ontology RDF file to it via the See <a href=\"/pylode\">/pylode</a> endpoint.</p>
12
+ <p>For example, to document the PHS ontology, do this:</p>
13
+ <ul>
14
+ <li><code>http://localhost:8000/pylode?url=https://linked.data.gov.au/def/phs</code></li>
15
+ </ul>
16
+ <p>Note that this server will use <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation">Content Negotiation</a> to try and get an RDF response from the URI supplied so the ontology must be served with the apprpriate Media Type.</p>
17
+ """
18
+ resp.set_header("Powered-By", "Falcon")
19
+ resp.set_header("content-type", "text/html")
20
+ resp.status = falcon.HTTP_200
21
+
22
+
23
+ class DocResource:
24
+ def on_get(self, req, resp):
25
+ """Handles GET requests"""
26
+ url = req.get_param("url")
27
+ if url is not None:
28
+ cmd = "cd ./bin && ./pylode.sh -u {url} -c true".format(url=url)
29
+
30
+ # remove Overview image placeholder, if present
31
+ raw_html = subprocess.check_output(cmd, shell=True)
32
+ processed_html = raw_html.decode().replace(
33
+ '<section id="overview">', '<section id="overview" style="display:none;">')
34
+ soup = Soup(processed_html, features="html.parser")
35
+ if os.getenv('GTAGID') is not None:
36
+ tag = os.getenv('GTAGID')
37
+ title = soup.find('title')
38
+ async_tag = soup.new_tag("script")
39
+ async_tag['async src'] = "https://www.googletagmanager.com/gtag/js?id=%s" % tag
40
+ title.insert_after(async_tag)
41
+ gtag = soup.new_tag('script')
42
+ gtag.string = """window.dataLayer = window.dataLayer || [];\n
43
+ function gtag(){dataLayer.push(arguments);}\n
44
+ gtag('js', new Date());\n
45
+ gtag('config', '%s');\n""" % tag
46
+ async_tag.insert_after(gtag)
47
+ resp.body = soup
48
+
49
+ resp.set_header("Powered-By", "Falcon")
50
+ resp.set_header("content-type", "text/html")
51
+ resp.status = falcon.HTTP_200
52
+ else:
53
+ resp.body = "<h3>USER ERROR</h3><p>For this endpoint, you must supply a Query String Argument of <code>url</code>, e.g. <code>/pylode?url={URL_OF_AN_RDF_FILE}</code>.</p>"
54
+ resp.set_header("content-type", "text/html")
55
+ resp.status = falcon.HTTP_400
56
+
57
+
58
+ api = falcon.API()
59
+ api.add_route("/", InfoResource())
60
+ api.add_route("/pylode", DocResource())
@@ -42,7 +42,7 @@
42
42
  <th>Example</th>
43
43
  <td>
44
44
  <pre>
45
- {{ example }}
45
+ {{ example }}
46
46
  </pre>
47
47
  </td>
48
48
  </tr>
@@ -54,7 +54,7 @@
54
54
  <th>Example</th>
55
55
  <td>
56
56
  <pre>
57
- {{ example }}
57
+ {{ example }}
58
58
  </pre>
59
59
  </td>
60
60
  </tr>
@@ -126,4 +126,4 @@
126
126
  </tr>
127
127
  {%- endif %}
128
128
  </table>
129
- </div>
129
+ </div>
@@ -1,5 +1,5 @@
1
1
  <div class="entity collection" id="{{ fid }}">
2
- <h3>{{ prefLabels[0][0] }}<sup title="Collection" class="sup-cp">cp</sup></h3>
2
+ <h3>{{ prefLabels[0][0] }}<sup title="Collection" class="sup-cl">cl</sup></h3>
3
3
  {%- if prefLabels|length > 1 %}
4
4
  <h4>
5
5
  {%- for prefLabel in prefLabels %}
@@ -48,4 +48,4 @@
48
48
  </tr>
49
49
  {% endif %}
50
50
  </table>
51
- </div>
51
+ </div>
@@ -8,8 +8,8 @@ Preferred Labels | {%- for prefLabel in prefLabels %}{{ prefLabel[0] }} ({{ pref
8
8
  {%- if altLabels|length > 0 %}
9
9
  Alternate Labels | {%- for altLabel in altLabels %}{{ altLabel }}<br />{%- endfor %}
10
10
  {%- endif %}
11
- {%- if descriptions|length > 0 %}
12
- Description | {%- for description in descriptions %}{{ descriptions }}<br />{%- endfor %}
11
+ {%- if definitions|length > 0 %}
12
+ Definitions | {%- for definition in definitions %}{{ definitions }}<br />{%- endfor %}
13
13
  {%- endif %}
14
14
  {%- if scopeNotes|length > 0 %}
15
15
  Scope Notes | {%- for scopeNote in scopeNotes %}{{ scopeNote }}<br />{%- endfor %}
@@ -1,4 +1,4 @@
1
- ## Classes
1
+ ## Concepts
2
2
  {%- if concept_hierarchy is not none %}
3
3
  {{ concept_hierarchy|safe }}
4
4
  {%- endif %}
@@ -0,0 +1,9 @@
1
+ from pylode import MakeDocco
2
+ from os.path import join, dirname, abspath
3
+ TESTS_DIR = dirname(abspath(__file__))
4
+
5
+
6
+ h = MakeDocco(input_data_file=join(TESTS_DIR, "test_ont_html_description.ttl"))
7
+ # generate the HTML doc
8
+ h.document(destination="test_ont_html_description.html")
9
+
@@ -0,0 +1,7 @@
1
+ from pylode import MakeDocco
2
+ from os.path import join, dirname, abspath
3
+ TESTS_DIR = dirname(abspath(__file__))
4
+
5
+ h = MakeDocco(input_data_file=join(TESTS_DIR, "test_skos_cif.ttl"), profile='skos')
6
+ # generate the HTML doc
7
+ h.document(destination=join(TESTS_DIR, "test_skos_cif.html"))
@@ -1,24 +0,0 @@
1
- import falcon
2
- import subprocess
3
-
4
-
5
- class DocResource:
6
- def on_get(self, req, resp):
7
- """Handles GET requests"""
8
- url = req.get_param("url")
9
- if url is not None:
10
- cmd = "cd ./bin && ./pylode.sh -u {url} -c true".format(url=url)
11
-
12
- # remove Overview image placeholder, if present
13
- raw_html = subprocess.check_output(cmd, shell=True)
14
- processed_html = raw_html.decode().replace(
15
- '<section id="overview">', '<section id="overview" style="display:none;">').encode()
16
- resp.body = processed_html
17
-
18
- resp.set_header("Powered-By", "Falcon")
19
- resp.set_header("content-type", "text/html")
20
- resp.status = falcon.HTTP_200
21
-
22
-
23
- api = falcon.API()
24
- api.add_route("/lode", DocResource())
@@ -1,7 +0,0 @@
1
- from makedocco import MakeDocco
2
-
3
-
4
- h = MakeDocco(input_data_file="test_ont_html_description.ttl")
5
- # generate the HTML doc
6
- h.document(destination="test_ont_html_description.html")
7
-
@@ -1,8 +0,0 @@
1
- from makedocco import MakeDocco
2
-
3
-
4
- h = MakeDocco(profile='skos')
5
- source_info = ("test_skos_cif.ttl", "turtle")
6
- # generate the HTML doc
7
- with open("test_skos_cif.html", "w") as f:
8
- f.write(h.document(source_info))
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