pylode 3.5.1__tar.gz → 3.5.2__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 (52) hide show
  1. {pylode-3.5.1 → pylode-3.5.2}/PKG-INFO +3 -5
  2. {pylode-3.5.1 → pylode-3.5.2}/README.md +2 -2
  3. {pylode-3.5.1 → pylode-3.5.2}/pylode/__init__.py +1 -1
  4. {pylode-3.5.1 → pylode-3.5.2}/pylode/cli.py +5 -2
  5. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/__init__.py +1 -0
  6. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/ontpub.py +22 -88
  7. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/query/__init__.py +9 -9
  8. pylode-3.5.2/pylode/profiles/valpub.py +421 -0
  9. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/vocpub.py +110 -174
  10. {pylode-3.5.1 → pylode-3.5.2}/pylode/pylode.css +17 -1
  11. pylode-3.5.1/pylode/rdf/ontdoc.ttl → pylode-3.5.2/pylode/rdf/ontpub.ttl +36 -32
  12. pylode-3.5.2/pylode/rdf/reg-statuses.ttl +188 -0
  13. pylode-3.5.2/pylode/rdf/shacl.ttl +2057 -0
  14. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf_elements.py +166 -84
  15. {pylode-3.5.1 → pylode-3.5.2}/pylode/utils.py +82 -64
  16. pylode-3.5.2/pyproject.toml +63 -0
  17. pylode-3.5.1/pyproject.toml → pylode-3.5.2/pyproject.toml.orig +1 -3
  18. {pylode-3.5.1 → pylode-3.5.2}/pylode/__main__.py +0 -0
  19. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/__init__.py +0 -0
  20. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/component/__init__.py +0 -0
  21. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/component/example.py +0 -0
  22. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/component/heading.py +0 -0
  23. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/component/link.py +0 -0
  24. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/component/preamble.py +0 -0
  25. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/component/properties_table.py +0 -0
  26. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/component/tooltip.py +0 -0
  27. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/dataset.py +0 -0
  28. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/fragment.py +0 -0
  29. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/html.py +0 -0
  30. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/loader.py +0 -0
  31. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/model.py +0 -0
  32. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/namespace.py +0 -0
  33. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/query/common.py +0 -0
  34. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/query/property_shape.py +0 -0
  35. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/random.py +0 -0
  36. {pylode-3.5.1 → pylode-3.5.2}/pylode/profiles/supermodel/state.py +0 -0
  37. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/dcterms-mod.ttl +0 -0
  38. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/licenses.ttl +0 -0
  39. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/owl.ttl +0 -0
  40. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/prov.ttl +0 -0
  41. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/rdf.ttl +0 -0
  42. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/rdfs-mod.ttl +0 -0
  43. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/sdo-mod.ttl +0 -0
  44. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/skos.ttl +0 -0
  45. {pylode-3.5.1 → pylode-3.5.2}/pylode/rdf/void.ttl +0 -0
  46. {pylode-3.5.1 → pylode-3.5.2}/pylode/server.py +0 -0
  47. {pylode-3.5.1 → pylode-3.5.2}/pylode/static/asciidoc.css +0 -0
  48. {pylode-3.5.1 → pylode-3.5.2}/pylode/static/hierarchy.css +0 -0
  49. {pylode-3.5.1 → pylode-3.5.2}/pylode/static/hierarchy.js +0 -0
  50. {pylode-3.5.1 → pylode-3.5.2}/pylode/static/property-table-row.js +0 -0
  51. {pylode-3.5.1 → pylode-3.5.2}/pylode/static/pylode.css +0 -0
  52. {pylode-3.5.1 → pylode-3.5.2}/pylode/version.py +0 -0
@@ -1,13 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pylode
3
- Version: 3.5.1
3
+ Version: 3.5.2
4
4
  Summary: An OWL ontology documentation tool using Python, based on LODE.
5
5
  Author: Nicholas Car
6
6
  Author-email: Nicholas Car <nick@kurrawong.ai>
7
7
  License-Expression: BSD-3-Clause
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
9
  Classifier: Programming Language :: Python :: 3.12
12
10
  Classifier: Programming Language :: Python :: 3.13
13
11
  Classifier: Programming Language :: Python :: 3.14
@@ -343,11 +341,11 @@ Nicholas Car
343
341
  2. pass all tests: `$ task test`
344
342
  3. increment version number in `pyproject.toml`
345
343
  4. commit all changes `$ git commit -a "..."`
346
- 5. tag with version number: `$git tag ...`
344
+ 5. tag with version number: `$ git tag ...`
347
345
  6. push changes `$ git push`
348
346
  7. push version `git push --tags`
349
347
  8. make a GitHub release
350
348
  * PyPI release is automated from this in `pypi.yml`
351
349
  9. increment version number to next release alpha in `pyproject.toml`
352
350
  10. commit all changes `$ git commit -a "..."`
353
- 1push changes `$ git push`
351
+ 11. push changes `$ git push`
@@ -312,11 +312,11 @@ Nicholas Car
312
312
  2. pass all tests: `$ task test`
313
313
  3. increment version number in `pyproject.toml`
314
314
  4. commit all changes `$ git commit -a "..."`
315
- 5. tag with version number: `$git tag ...`
315
+ 5. tag with version number: `$ git tag ...`
316
316
  6. push changes `$ git push`
317
317
  7. push version `git push --tags`
318
318
  8. make a GitHub release
319
319
  * PyPI release is automated from this in `pypi.yml`
320
320
  9. increment version number to next release alpha in `pyproject.toml`
321
321
  10. commit all changes `$ git commit -a "..."`
322
- 1push changes `$ git push`
322
+ 11. push changes `$ git push`
@@ -1,4 +1,4 @@
1
- from .profiles import OntPub, Supermodel, VocPub
1
+ from .profiles import OntPub, Supermodel, ValPub, VocPub
2
2
  from .rdf_elements import *
3
3
  from .utils import *
4
4
  from .utils import PylodeError
@@ -4,7 +4,7 @@ import sys
4
4
  from pathlib import Path
5
5
 
6
6
  sys.path.insert(0, str(Path(__file__).absolute().parent.parent))
7
- from pylode import OntPub, PylodeError, Supermodel, VocPub, __version__
7
+ from pylode import OntPub, PylodeError, Supermodel, ValPub, VocPub, __version__
8
8
 
9
9
  parser = argparse.ArgumentParser()
10
10
 
@@ -46,9 +46,10 @@ parser.add_argument(
46
46
  "--profile",
47
47
  help="Which profile to use to generate HTML. Must be one of "
48
48
  "'ontpub' (https://linked.data.gov.au/def/ontpub) - for ontologies, "
49
+ "'valpub' (https://linked.data.gov.au/def/valpub) - for SHACL Shapes Graphs, "
49
50
  "'vocpub' (https://linked.data.gov.au/def/vocpub) - for SKOS vocabularies, "
50
51
  "'supermodel' - for profiles of profiles",
51
- choices=["ontpub", "vocpub", "supermodel"],
52
+ choices=["ontpub", "valpub", "vocpub", "supermodel"],
52
53
  default="ontpub",
53
54
  )
54
55
 
@@ -79,6 +80,8 @@ def main():
79
80
  sort_subjects = args.sort
80
81
  if args.profile == "ontpub":
81
82
  html = OntPub(args.input, sort_subjects=sort_subjects)
83
+ elif args.profile == "valpub":
84
+ html = ValPub(args.input, sort_subjects=sort_subjects)
82
85
  elif args.profile == "vocpub":
83
86
  html = VocPub(args.input, sort_subjects=sort_subjects)
84
87
  elif args.profile == "supermodel":
@@ -1,3 +1,4 @@
1
1
  from .ontpub import OntPub
2
2
  from .supermodel import Supermodel
3
+ from .valpub import ValPub
3
4
  from .vocpub import VocPub
@@ -1,82 +1,18 @@
1
- import shutil
2
- from collections import defaultdict
3
- from itertools import chain
4
- from pathlib import Path
5
- from typing import Dict, Union
6
-
7
- import dominate
8
- from dominate.tags import (
9
- a,
10
- code,
11
- dd,
12
- div,
13
- dl,
14
- dt,
15
- h1,
16
- h2,
17
- h3,
18
- h4,
19
- h5,
20
- li,
21
- link,
22
- meta,
23
- script,
24
- section,
25
- strong,
26
- style,
27
- sup,
28
- table,
29
- td,
30
- tr,
31
- ul,
32
- )
33
- from dominate.util import raw
34
- from rdflib import Graph, Literal
35
- from rdflib.namespace import (
36
- DC,
37
- DCTERMS,
38
- FOAF,
39
- ORG,
40
- OWL,
41
- PROF,
42
- PROV,
43
- RDF,
44
- RDFS,
45
- SDO,
46
- SKOS,
47
- )
48
-
49
- from ..rdf_elements import AGENT_PROPS, CLASS_PROPS, ONT_PROPS, ONTDOC, PROP_PROPS
50
- from ..utils import (
51
- PylodeError,
52
- back_onts_label_props,
53
- get_ns,
54
- load_background_onts,
55
- load_background_onts_titles,
56
- load_ontology,
57
- make_pylode_logo,
58
- prop_obj_pair_html,
59
- section_html,
60
- sort_ontology,
61
- )
62
- from ..version import __version__
63
-
64
- RDF_FOLDER = Path(__file__).parent / "rdf"
1
+ from pylode.utils import *
65
2
 
66
3
 
67
4
  class OntPub:
68
- """Ontology Document class used to create HTML documentation
69
- from OWL Ontologies.
5
+ """Used to create HTML documentation from OWL Ontologies.
70
6
 
71
7
  Use:
72
8
  # initialise
73
- od = OntDoc(ontology="some-ontology-file.ttl")
9
+ x = OntPub(ontology="some-ontology-file.ttl")
74
10
 
75
11
  # produce HTML
76
- html = od.make_html()
12
+ html = x.make_html()
77
13
 
78
14
  # or save HTML to a file
79
- od.make_html(destination="some-resulting-html-file.html")
15
+ x.make_html(destination="some-resulting-html-file.html")
80
16
  """
81
17
 
82
18
  def __init__(self, ontology: Union[Graph, Path, str], sort_subjects: bool = False):
@@ -186,25 +122,25 @@ class OntPub:
186
122
  # we do these next few so we only need to loop through
187
123
  # Class & Property properties once: single subject
188
124
  for s_, o in g.subject_objects(RDFS.subClassOf):
189
- g.add((o, ONTDOC.superClassOf, s_))
125
+ g.add((o, ONTPUB.superClassOf, s_))
190
126
 
191
127
  for s_, o in g.subject_objects(RDFS.subPropertyOf):
192
- g.add((o, ONTDOC.superPropertyOf, s_))
128
+ g.add((o, ONTPUB.superPropertyOf, s_))
193
129
 
194
130
  for s_, o in g.subject_objects(RDFS.domain):
195
- g.add((o, ONTDOC.inDomainOf, s_))
131
+ g.add((o, ONTPUB.inDomainOf, s_))
196
132
 
197
133
  for s_, o in g.subject_objects(SDO.domainIncludes):
198
- g.add((o, ONTDOC.inDomainIncludesOf, s_))
134
+ g.add((o, ONTPUB.inDomainIncludesOf, s_))
199
135
 
200
136
  for s_, o in g.subject_objects(RDFS.range):
201
- g.add((o, ONTDOC.inRangeOf, s_))
137
+ g.add((o, ONTPUB.inRangeOf, s_))
202
138
 
203
139
  for s_, o in g.subject_objects(SDO.rangeIncludes):
204
- g.add((o, ONTDOC.inRangeIncludesOf, s_))
140
+ g.add((o, ONTPUB.inRangeIncludesOf, s_))
205
141
 
206
142
  for s_, o in g.subject_objects(RDF.type):
207
- g.add((o, ONTDOC.hasMember, s_))
143
+ g.add((o, ONTPUB.hasMember, s_))
208
144
 
209
145
  #
210
146
  # Agents
@@ -298,9 +234,7 @@ class OntPub:
298
234
  """Helper function for make_html(). Makes <body>???</body> content.
299
235
 
300
236
  Just calls other helper functions in order"""
301
- make_pylode_logo(
302
- self.doc, __version__, "OntPub", "https://linked.data.gov.au/def/ontpub"
303
- )
237
+ make_pylode_logo(self.doc, "OntPub", "https://linked.data.gov.au/def/ontpub")
304
238
  self._make_metadata()
305
239
  self._make_main_sections()
306
240
  self._make_namespaces()
@@ -317,14 +251,14 @@ class OntPub:
317
251
  ):
318
252
  iri = s_
319
253
  for p_, o in self.ont.predicate_objects(s_):
320
- if p_ in ONT_PROPS:
254
+ if p_ in ONTOLOGY_PROPS:
321
255
  this_onts_props[p_].append(o)
322
256
 
323
257
  # make HTML for all props in order of ONT_PROPS
324
258
  sec = div(h1(this_onts_props[DCTERMS.title]), id="metadata", _class="section")
325
259
  sec.appendChild(h2("Metadata"))
326
260
  d = dl(div(dt(strong("IRI")), dd(code(str(iri)))))
327
- for prop in ONT_PROPS:
261
+ for prop in ONTOLOGY_PROPS:
328
262
  if prop in this_onts_props.keys():
329
263
  d.appendChild(
330
264
  prop_obj_pair_html(
@@ -608,7 +542,7 @@ class OntPub:
608
542
  )
609
543
  )
610
544
  with ul(_class="second"):
611
- for c in self.toc["classes"]:
545
+ for c in sorted(self.toc["classes"]):
612
546
  li(a(c[1], href=c[0]), style="margin-left:10px;")
613
547
 
614
548
  if (
@@ -618,7 +552,7 @@ class OntPub:
618
552
  with li():
619
553
  h4(a("Properties", href="#properties"))
620
554
  with ul(_class="second"):
621
- for c in self.toc["properties"]:
555
+ for c in sorted(self.toc["properties"]):
622
556
  li(a(c[1], href=c[0]))
623
557
 
624
558
  if (
@@ -642,7 +576,7 @@ class OntPub:
642
576
  )
643
577
  )
644
578
  with ul(_class="second"):
645
- for c in self.toc["objectproperties"]:
579
+ for c in sorted(self.toc["objectproperties"]):
646
580
  li(a(c[1], href=c[0]), style="margin-left:10px;")
647
581
 
648
582
  if (
@@ -652,7 +586,7 @@ class OntPub:
652
586
  with li():
653
587
  h4(a("Datatype Properties", href="#datatypeproperties"))
654
588
  with ul(_class="second"):
655
- for c in self.toc["datatypeproperties"]:
589
+ for c in sorted(self.toc["datatypeproperties"]):
656
590
  li(a(c[1], href=c[0]))
657
591
 
658
592
  if (
@@ -662,7 +596,7 @@ class OntPub:
662
596
  with li():
663
597
  h4(a("Annotation Properties", href="#annotationproperties"))
664
598
  with ul(_class="second"):
665
- for c in self.toc["annotationproperties"]:
599
+ for c in sorted(self.toc["annotationproperties"]):
666
600
  li(a(c[1], href=c[0]))
667
601
 
668
602
  if (
@@ -672,7 +606,7 @@ class OntPub:
672
606
  with li():
673
607
  h4(a("Functional Properties", href="#functionalproperties"))
674
608
  with ul(_class="second"):
675
- for c in self.toc["functionalproperties"]:
609
+ for c in sorted(self.toc["functionalproperties"]):
676
610
  li(a(c[1], href=c[0]))
677
611
 
678
612
  if (
@@ -682,7 +616,7 @@ class OntPub:
682
616
  with li():
683
617
  h4(a("Custom Datatypes", href="#datatypes"))
684
618
  with ul(_class="second"):
685
- for c in self.toc["datatypes"]:
619
+ for c in sorted(self.toc["datatypes"]):
686
620
  li(a(c[1], href=c[0]))
687
621
 
688
622
  with li():
@@ -50,7 +50,7 @@ from pylode.profiles.supermodel.query.common import (
50
50
  get_values,
51
51
  )
52
52
  from pylode.profiles.supermodel.query.property_shape import get_class_properties_by_sh
53
- from pylode.rdf_elements import AGENT_PROPS, ONT_PROPS, ONTDOC
53
+ from pylode.rdf_elements import AGENT_PROPS, ONTOLOGY_PROPS, ONTPUB
54
54
  from pylode.utils import (
55
55
  back_onts_label_props,
56
56
  load_background_onts,
@@ -493,7 +493,7 @@ class Query:
493
493
  this_onts_props = defaultdict(list)
494
494
  for s_ in self.graph.subjects(predicate=RDF.type, object=PROF.Profile):
495
495
  for p_, o in self.graph.predicate_objects(s_):
496
- if p_ in ONT_PROPS:
496
+ if p_ in ONTOLOGY_PROPS:
497
497
  this_onts_props[p_].append(o)
498
498
 
499
499
  return this_onts_props
@@ -569,25 +569,25 @@ class Query:
569
569
  # we do these next few so we only need to loop through
570
570
  # Class & Property properties once: single subject
571
571
  for s_, o in g.subject_objects(RDFS.subClassOf):
572
- g.add((o, ONTDOC.superClassOf, s_))
572
+ g.add((o, ONTPUB.superClassOf, s_))
573
573
 
574
574
  for s_, o in g.subject_objects(RDFS.subPropertyOf):
575
- g.add((o, ONTDOC.superPropertyOf, s_))
575
+ g.add((o, ONTPUB.superPropertyOf, s_))
576
576
 
577
577
  for s_, o in g.subject_objects(RDFS.domain):
578
- g.add((o, ONTDOC.inDomainOf, s_))
578
+ g.add((o, ONTPUB.inDomainOf, s_))
579
579
 
580
580
  for s_, o in g.subject_objects(SDO.domainIncludes):
581
- g.add((o, ONTDOC.inDomainIncludesOf, s_))
581
+ g.add((o, ONTPUB.inDomainIncludesOf, s_))
582
582
 
583
583
  for s_, o in g.subject_objects(RDFS.range):
584
- g.add((o, ONTDOC.inRangeOf, s_))
584
+ g.add((o, ONTPUB.inRangeOf, s_))
585
585
 
586
586
  for s_, o in g.subject_objects(SDO.rangeIncludes):
587
- g.add((o, ONTDOC.inRangeIncludesOf, s_))
587
+ g.add((o, ONTPUB.inRangeIncludesOf, s_))
588
588
 
589
589
  for s_, o in g.subject_objects(RDF.type):
590
- g.add((o, ONTDOC.hasMember, s_))
590
+ g.add((o, ONTPUB.hasMember, s_))
591
591
 
592
592
  #
593
593
  # Agents