linkml 1.5.5__tar.gz → 1.5.7__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 (114) hide show
  1. {linkml-1.5.5 → linkml-1.5.7}/PKG-INFO +2 -2
  2. {linkml-1.5.5 → linkml-1.5.7}/linkml/__init__.py +2 -6
  3. {linkml-1.5.5 → linkml-1.5.7}/linkml/_version.py +1 -1
  4. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/PythonGenNotes.md +4 -4
  5. linkml-1.5.7/linkml/generators/__init__.py +53 -0
  6. linkml-1.5.7/linkml/generators/common/type_designators.py +49 -0
  7. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/csvgen.py +4 -10
  8. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/class.md.jinja2 +7 -0
  9. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/class_diagram.md.jinja2 +0 -6
  10. linkml-1.5.7/linkml/generators/docgen/subset.md.jinja2 +106 -0
  11. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen.py +94 -92
  12. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/dotgen.py +5 -9
  13. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/erdiagramgen.py +58 -53
  14. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/excelgen.py +10 -16
  15. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/golanggen.py +11 -21
  16. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/golrgen.py +4 -13
  17. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/graphqlgen.py +3 -11
  18. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/javagen.py +8 -15
  19. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/jsonldcontextgen.py +7 -36
  20. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/jsonldgen.py +14 -12
  21. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/jsonschemagen.py +183 -136
  22. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/linkmlgen.py +1 -1
  23. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/markdowngen.py +40 -89
  24. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/namespacegen.py +1 -2
  25. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/oocodegen.py +22 -25
  26. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/owlgen.py +48 -49
  27. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/prefixmapgen.py +6 -14
  28. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/projectgen.py +7 -14
  29. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/protogen.py +3 -5
  30. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/pydanticgen.py +85 -73
  31. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/pythongen.py +89 -157
  32. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/rdfgen.py +5 -11
  33. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/shaclgen.py +32 -18
  34. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/shexgen.py +19 -24
  35. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/sparqlgen.py +5 -13
  36. linkml-1.5.7/linkml/generators/sqlalchemy/__init__.py +4 -0
  37. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/sqlalchemy/sqlalchemy_declarative_template.py +7 -7
  38. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/sqlalchemy/sqlalchemy_imperative_template.py +3 -3
  39. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/sqlalchemygen.py +29 -27
  40. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/sqlddlgen.py +34 -26
  41. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/sqltablegen.py +21 -21
  42. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/sssomgen.py +11 -13
  43. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/summarygen.py +2 -4
  44. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/terminusdbgen.py +7 -19
  45. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/typescriptgen.py +10 -18
  46. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/yamlgen.py +0 -2
  47. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/yumlgen.py +23 -71
  48. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/cli.py +4 -11
  49. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/config/datamodel/config.py +17 -47
  50. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/linter.py +2 -4
  51. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/rules.py +34 -48
  52. {linkml-1.5.5 → linkml-1.5.7}/linkml/reporting/__init__.py +2 -0
  53. {linkml-1.5.5 → linkml-1.5.7}/linkml/reporting/model.py +9 -24
  54. {linkml-1.5.5 → linkml-1.5.7}/linkml/transformers/relmodel_transformer.py +20 -33
  55. {linkml-1.5.5 → linkml-1.5.7}/linkml/transformers/schema_renamer.py +14 -10
  56. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/converter.py +15 -15
  57. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/datautils.py +9 -24
  58. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/datavalidator.py +2 -2
  59. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/execute_tutorial.py +10 -12
  60. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/generator.py +74 -92
  61. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/helpers.py +4 -2
  62. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/ifabsent_functions.py +23 -15
  63. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/mergeutils.py +19 -35
  64. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/rawloader.py +2 -6
  65. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/schema_builder.py +31 -19
  66. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/schema_fixer.py +28 -18
  67. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/schemaloader.py +44 -89
  68. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/schemasynopsis.py +50 -73
  69. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/sqlutils.py +40 -30
  70. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/typereferences.py +9 -6
  71. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/validation.py +4 -5
  72. {linkml-1.5.5 → linkml-1.5.7}/linkml/validators/__init__.py +2 -0
  73. linkml-1.5.7/linkml/validators/jsonschemavalidator.py +223 -0
  74. {linkml-1.5.5 → linkml-1.5.7}/linkml/validators/sparqlvalidator.py +5 -15
  75. {linkml-1.5.5 → linkml-1.5.7}/linkml/workspaces/datamodel/workspaces.py +13 -30
  76. {linkml-1.5.5 → linkml-1.5.7}/linkml/workspaces/example_runner.py +75 -68
  77. {linkml-1.5.5 → linkml-1.5.7}/pyproject.toml +69 -4
  78. {linkml-1.5.5 → linkml-1.5.7}/setup.py +2 -2
  79. linkml-1.5.5/linkml/generators/__init__.py +0 -32
  80. linkml-1.5.5/linkml/generators/common/type_designators.py +0 -44
  81. linkml-1.5.5/linkml/generators/docgen/subset.md.jinja2 +0 -65
  82. linkml-1.5.5/linkml/generators/sqlalchemy/__init__.py +0 -3
  83. linkml-1.5.5/linkml/validators/jsonschemavalidator.py +0 -172
  84. {linkml-1.5.5 → linkml-1.5.7}/LICENSE +0 -0
  85. {linkml-1.5.5 → linkml-1.5.7}/README.md +0 -0
  86. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/README.md +0 -0
  87. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/common/__init__.py +0 -0
  88. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/common_metadata.md.jinja2 +0 -0
  89. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/enum.md.jinja2 +0 -0
  90. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/index.md.jinja2 +0 -0
  91. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/index.tex.jinja2 +0 -0
  92. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/schema.md.jinja2 +0 -0
  93. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/slot.md.jinja2 +0 -0
  94. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/docgen/type.md.jinja2 +0 -0
  95. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/javagen/example_template.java.jinja2 +0 -0
  96. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/javagen/java_record_template.jinja2 +0 -0
  97. {linkml-1.5.5 → linkml-1.5.7}/linkml/generators/string_template.md +0 -0
  98. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/__init__.py +0 -0
  99. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/config/datamodel/.linkmllint.yaml +0 -0
  100. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/config/datamodel/__init__.py +0 -0
  101. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/config/datamodel/config.yaml +0 -0
  102. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/config/default.yaml +0 -0
  103. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/config/recommended.yaml +0 -0
  104. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/formatters/__init__.py +0 -0
  105. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/formatters/formatter.py +0 -0
  106. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/formatters/json_formatter.py +0 -0
  107. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/formatters/markdown_formatter.py +0 -0
  108. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/formatters/terminal_formatter.py +0 -0
  109. {linkml-1.5.5 → linkml-1.5.7}/linkml/linter/formatters/tsv_formatter.py +0 -0
  110. {linkml-1.5.5 → linkml-1.5.7}/linkml/transformers/__init__.py +0 -0
  111. {linkml-1.5.5 → linkml-1.5.7}/linkml/utils/__init__.py +0 -0
  112. {linkml-1.5.5 → linkml-1.5.7}/linkml/workspaces/__init__.py +0 -0
  113. {linkml-1.5.5 → linkml-1.5.7}/linkml/workspaces/datamodel/__init__.py +0 -0
  114. {linkml-1.5.5 → linkml-1.5.7}/linkml/workspaces/datamodel/workspaces.yaml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: linkml
3
- Version: 1.5.5
3
+ Version: 1.5.7
4
4
  Summary: Linked Open Data Modeling Language
5
5
  Home-page: https://linkml.io/linkml/
6
6
  Keywords: schema,linked data,data modeling,rdf,owl,biolink
@@ -33,7 +33,7 @@ Requires-Dist: jinja2 (>=3.1.0)
33
33
  Requires-Dist: jsonasobj2 (>=1.0.3,<2.0.0)
34
34
  Requires-Dist: jsonschema[format] (>=4.0.0)
35
35
  Requires-Dist: linkml-dataops
36
- Requires-Dist: linkml-runtime (>=1.5.3)
36
+ Requires-Dist: linkml-runtime (>=1.5.4)
37
37
  Requires-Dist: openpyxl
38
38
  Requires-Dist: parse
39
39
  Requires-Dist: prefixcommons (>=0.1.7)
@@ -20,9 +20,7 @@ MODULE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
20
20
  LOCAL_METAMODEL_YAML_FILE = linkml_files.LOCAL_PATH_FOR(Source.META, Format.YAML)
21
21
  LOCAL_TYPES_YAML_FILE = linkml_files.LOCAL_PATH_FOR(Source.TYPES, Format.YAML)
22
22
  LOCAL_MAPPINGS_YAML_FILE = linkml_files.LOCAL_PATH_FOR(Source.MAPPINGS, Format.YAML)
23
- LOCAL_ANNOTATIONS_YAML_FILE = linkml_files.LOCAL_PATH_FOR(
24
- Source.ANNOTATIONS, Format.YAML
25
- )
23
+ LOCAL_ANNOTATIONS_YAML_FILE = linkml_files.LOCAL_PATH_FOR(Source.ANNOTATIONS, Format.YAML)
26
24
  LOCAL_EXTENSIONS_YAML_FILE = linkml_files.LOCAL_PATH_FOR(Source.EXTENSIONS, Format.YAML)
27
25
 
28
26
  # Local location of jsonld and context.jsonld files
@@ -30,9 +28,7 @@ LOCAL_METAMODEL_LDCONTEXT_FILE = linkml_files.LOCAL_PATH_FOR(Source.META, Format
30
28
  LOCAL_METAMODEL_JSONLD_FILE = linkml_files.LOCAL_PATH_FOR(Source.META, Format.JSON)
31
29
  LOCAL_TYPES_LDCONTEXT_FILE = linkml_files.LOCAL_PATH_FOR(Source.TYPES, Format.JSONLD)
32
30
  LOCAL_TYPES_JSONLD_FILE = linkml_files.LOCAL_PATH_FOR(Source.TYPES, Format.JSON)
33
- LOCAL_MAPPINGS_LDCONTEXT_FILE = linkml_files.LOCAL_PATH_FOR(
34
- Source.MAPPINGS, Format.JSONLD
35
- )
31
+ LOCAL_MAPPINGS_LDCONTEXT_FILE = linkml_files.LOCAL_PATH_FOR(Source.MAPPINGS, Format.JSONLD)
36
32
  LOCAL_MAPPINGS_JSONLD_FILE = linkml_files.LOCAL_PATH_FOR(Source.MAPPINGS, Format.JSON)
37
33
 
38
34
  # Local location of metamodel shex file
@@ -3,7 +3,7 @@ try:
3
3
  except ImportError:
4
4
  # Python < 3.8
5
5
  import importlib_metadata as metadata # pragma: no cover
6
-
6
+
7
7
  try:
8
8
  __version__ = metadata.version(__package__)
9
9
  except metadata.PackageNotFoundError:
@@ -122,7 +122,7 @@ the builtin type `int`. Four class variables are included in the generation:
122
122
  * `type_name` - the non-mangled name assigned to the type in the original definition
123
123
  * `type_model_uri` - the URIRef of the type definition in the default LinkML namespace
124
124
 
125
- The python then emits a class definition for the `Integers` classe, where we have defined four slot type permutations:
125
+ The python then emits a class definition for the `Integers` class, where we have defined four slot type permutations:
126
126
 
127
127
  1) `mand_integer` - a single valued required type:
128
128
 
@@ -189,7 +189,7 @@ The python then emits a class definition for the `Integers` classe, where we hav
189
189
 
190
190
  `opt_multi_integer: Optional[Union[int, List[int]]] = empty_list()`
191
191
 
192
- * The absence of a list property is always represented as an emtpy list:
192
+ * The absence of a list property is always represented as an empty list:
193
193
  ```
194
194
  if self.opt_multi_integer is None:
195
195
  self.opt_multi_integer = []
@@ -1232,7 +1232,7 @@ dictionary. You can construct a list of integers with a single value:
1232
1232
  ```python
1233
1233
  my_entries = ListOfIntegers(17)
1234
1234
  ```
1235
- Which would, if the class `ListOfIntegers`'s first variable was a multivalued slot with a range of intgers, result in
1235
+ Which would, if the class `ListOfIntegers`'s first variable was a multivalued slot with a range of integers, result in
1236
1236
  `my_entries.v == [17]`. When dealing with classes, however, the following:
1237
1237
  ```python
1238
1238
  my_entries = ListOfClasses(dict(name='element1', value=17))
@@ -1243,7 +1243,7 @@ The final line in the `__post_init__` section:
1243
1243
  ```python
1244
1244
  self._normalize_inlined_slot(slot_name="v1", slot_type=IdentifiedThreeElementClass, key_name="name", inlined_as_list=True, keyed=True)
1245
1245
  ```
1246
- passes the remainder of the post initilization normalization to a function defined in `YAMLRoot`.
1246
+ passes the remainder of the post initialization normalization to a function defined in `YAMLRoot`.
1247
1247
 
1248
1248
 
1249
1249
  The final case, Case 2.4 (Inlined as dictionary) is essentially the same, with the exception that the target type is
@@ -0,0 +1,53 @@
1
+ """
2
+ Generators translate between a SchemaDefinition and an alternative
3
+ representation such as JsonSchema
4
+ """
5
+
6
+ from linkml.generators.javagen import JavaGenerator
7
+ from linkml.generators.jsonschemagen import JsonSchemaGenerator
8
+ from linkml.generators.owlgen import OwlSchemaGenerator
9
+ from linkml.generators.pydanticgen import PydanticGenerator
10
+ from linkml.generators.pythongen import PythonGenerator
11
+ from linkml.generators.shaclgen import ShaclGenerator
12
+ from linkml.generators.shexgen import ShExGenerator
13
+ from linkml.generators.sqlalchemygen import SQLAlchemyGenerator
14
+ from linkml.generators.sqltablegen import SQLTableGenerator
15
+
16
+ __all__ = [
17
+ "csvgen",
18
+ "dotgen",
19
+ "docgen",
20
+ "golrgen",
21
+ "graphqlgen",
22
+ "javagen",
23
+ "jsonldcontextgen",
24
+ "jsonldgen",
25
+ "jsonschemagen",
26
+ "markdowngen",
27
+ "namespacegen",
28
+ "owlgen",
29
+ "protogen",
30
+ "pythongen",
31
+ "pydanticgen",
32
+ "rdfgen",
33
+ "shexgen",
34
+ "shaclgen",
35
+ "sssomgen",
36
+ "summarygen",
37
+ "yamlgen",
38
+ "yumlgen",
39
+ "OwlSchemaGenerator",
40
+ "PydanticGenerator",
41
+ "PythonGenerator",
42
+ "JavaGenerator",
43
+ "JsonSchemaGenerator",
44
+ "ShaclGenerator",
45
+ "ShExGenerator",
46
+ "SQLAlchemyGenerator",
47
+ "SQLTableGenerator",
48
+ ]
49
+
50
+ # TODO: deprecate usage of these
51
+ # GENERATOR_BASE = "0.9"
52
+
53
+ # PYTHON_GEN_VERSION = GENERATOR_BASE + ".0"
@@ -0,0 +1,49 @@
1
+ from typing import List
2
+
3
+ from linkml_runtime.linkml_model.meta import ClassDefinition, SlotDefinition
4
+ from linkml_runtime.utils.schemaview import SchemaView
5
+
6
+
7
+ def get_type_designator_value(
8
+ sv: SchemaView, type_designator_slot: SlotDefinition, class_def: ClassDefinition
9
+ ) -> str:
10
+ """
11
+ returns the correct value for a type designator field for a given class, depending on its range
12
+ this implements the logic described in https://github.com/linkml/linkml/issues/945:
13
+ """
14
+ slot_types = set(sv.type_ancestors(type_designator_slot.range))
15
+ if "uri" in slot_types:
16
+ return sv.get_uri(class_def, expand=True, native=False)
17
+ elif "uriorcurie" in slot_types:
18
+ return sv.get_uri(class_def, expand=False, native=False)
19
+ elif "string" in slot_types:
20
+ return class_def.name
21
+ else:
22
+ return sv.get_uri(class_def, expand=False, native=False)
23
+
24
+
25
+ def get_accepted_type_designator_values(
26
+ sv: SchemaView, type_designator_slot: SlotDefinition, class_def: ClassDefinition
27
+ ) -> List[str]:
28
+ """
29
+ returns the accepted values for a type designator field for a given class, depending on its range
30
+ this implements the logic described in https://github.com/linkml/linkml/issues/945:
31
+ """
32
+ accepted_uri_values = [
33
+ sv.get_uri(class_def, expand=True, native=True),
34
+ sv.get_uri(class_def, expand=True, native=False),
35
+ sv.get_uri(class_def, expand=False, native=True),
36
+ sv.get_uri(class_def, expand=False, native=False),
37
+ ]
38
+ # unique, but with order preserved (https://stackoverflow.com/a/17016257)
39
+ accepted_uri_values = list(dict.fromkeys(accepted_uri_values))
40
+
41
+ slot_types = set(sv.type_ancestors(type_designator_slot.range))
42
+ uri_types = ["uri", "uriorcurie"]
43
+
44
+ if slot_types.intersection(uri_types):
45
+ return accepted_uri_values
46
+ elif type_designator_slot.range == "string":
47
+ return [class_def.name]
48
+ else:
49
+ return accepted_uri_values
@@ -5,12 +5,10 @@ import os
5
5
  import sys
6
6
  from csv import DictWriter
7
7
  from dataclasses import dataclass
8
- from typing import List, Optional, Set, TextIO, Union
8
+ from typing import List, Optional, Set
9
9
 
10
10
  import click
11
- from linkml_runtime.linkml_model.meta import (ClassDefinition,
12
- ClassDefinitionName,
13
- SchemaDefinition)
11
+ from linkml_runtime.linkml_model.meta import ClassDefinition, ClassDefinitionName
14
12
  from linkml_runtime.utils.formatutils import be, underscore
15
13
 
16
14
  from linkml._version import __version__
@@ -37,9 +35,7 @@ class CsvGenerator(Generator):
37
35
  sep: Optional[str] = None
38
36
  """Separator for columns"""
39
37
 
40
- closure: Optional[
41
- Set[ClassDefinitionName]
42
- ] = None
38
+ closure: Optional[Set[ClassDefinitionName]] = None
43
39
  """List of classes to include in output"""
44
40
 
45
41
  writer: Optional[DictWriter] = None
@@ -69,9 +65,7 @@ class CsvGenerator(Generator):
69
65
  self.closure.update(self.ancestors(self.schema.classes[clsname]))
70
66
 
71
67
  dialect: str = "excel" if self.format == "csv" else "excel-tab"
72
- self.writer = DictWriter(
73
- sys.stdout, ["id", "mappings", "description"], dialect=dialect
74
- )
68
+ self.writer = DictWriter(sys.stdout, ["id", "mappings", "description"], dialect=dialect)
75
69
  self.writer.writeheader()
76
70
 
77
71
  def visit_class(self, cls: ClassDefinition) -> bool:
@@ -18,7 +18,14 @@ _{{ element_description_line }}_
18
18
 
19
19
  URI: {{ gen.uri_link(element) }}
20
20
 
21
+
22
+ {% if diagram_type == "er_diagram" %}
23
+ ```{{ gen.mermaid_directive() }}
24
+ {{ gen.mermaid_diagram([element.name]) }}
25
+ ```
26
+ {% else %}
21
27
  {% include "class_diagram.md.jinja2" %}
28
+ {% endif %}
22
29
 
23
30
  {% if schemaview.class_parents(element.name) or schemaview.class_children(element.name, mixins=False) %}
24
31
 
@@ -1,8 +1,3 @@
1
- {% if diagram_type == "er_diagram" %}
2
- ```{{ gen.mermaid_directive() }}
3
- {{ gen.mermaid_diagram([element.name]) }}
4
- ```
5
- {% else %}
6
1
  {% if schemaview.class_parents(element.name) and schemaview.class_children(element.name) %}
7
2
  ```{{ gen.mermaid_directive() }}
8
3
  classDiagram
@@ -61,5 +56,4 @@
61
56
  {% endif %}
62
57
  {% endfor %}
63
58
  ```
64
- {% endif %}
65
59
  {% endif %}
@@ -0,0 +1,106 @@
1
+ # Subset: {{ gen.name(element) }}
2
+
3
+ {%- if header -%}
4
+ {{ header }}
5
+ {%- endif -%}
6
+
7
+ {% if element.description %}
8
+ {% set element_description_lines = element.description.split('\n') %}
9
+ {% for element_description_line in element_description_lines %}
10
+ _{{ element_description_line }}_
11
+ {% endfor %}
12
+ {% endif %}
13
+
14
+ URI: {{ gen.uri_link(element) }}
15
+
16
+ {% include "common_metadata.md.jinja2" %}
17
+
18
+ {% set classes_in_subset = [] %}
19
+ {% set slots_in_subset = [] %}
20
+ {% set enums_in_subset = [] %}
21
+
22
+ {# Collect classes, slots, and enumerations in subset #}
23
+ {% for c in gen.all_class_objects()|sort(attribute=sort_by) %}
24
+ {%- if element.name in c.in_subset %}
25
+ {% set _ = classes_in_subset.append(c) %}
26
+ {%- endif %}
27
+ {% endfor %}
28
+
29
+ {% for s in gen.all_slot_objects()|sort(attribute=sort_by) %}
30
+ {%- if element.name in s.in_subset %}
31
+ {% set _ = slots_in_subset.append(s) %}
32
+ {%- endif %}
33
+ {% endfor %}
34
+
35
+ {% for e in schemaview.all_enums().values() %}
36
+ {%- if element.name in e.in_subset %}
37
+ {% set _ = enums_in_subset.append(e) %}
38
+ {%- endif %}
39
+ {% endfor %}
40
+
41
+ {% if classes_in_subset %}
42
+ ## Classes in subset
43
+
44
+ | Class | Description |
45
+ | --- | --- |
46
+ {% for c in gen.all_class_objects()|sort(attribute=sort_by) -%}
47
+ {%- if element.name in c.in_subset -%}
48
+ | {{gen.link(c)}} | {{c.description|enshorten}} |
49
+ {% endif -%}
50
+ {% endfor %}
51
+
52
+ {% for c in gen.all_class_objects()|sort(attribute=sort_by) -%}
53
+ {%- if element.name in c.in_subset -%}
54
+ ### {{ gen.name(c) }}
55
+
56
+ {{c.description}}
57
+
58
+ {%- set filtered_slots = [] -%}
59
+
60
+ {%- for s in induced_slots|sort(attribute=sort_by) -%}
61
+ {%- if element.name in s.in_subset or element.name in schemaview.get_slot(s.name).in_subset -%}
62
+ {% set _ = filtered_slots.append(s) %}
63
+ {%- endif -%}
64
+ {%- endfor %}
65
+
66
+ {%- if filtered_slots|length > 0 -%}
67
+ | Name | Cardinality and Range | Description |
68
+ | --- | --- | --- |
69
+ {% for s in filtered_slots -%}
70
+ | {{gen.link(s)}} | {{ gen.cardinality(s) }} <br/> {{gen.link(s.range)}} | {{s.description|enshorten}} {% if s.identifier %}**identifier**{% endif %} |
71
+ {% endfor %}
72
+ {%- endif %}
73
+
74
+
75
+ {%- endif %}
76
+ {% endfor %}
77
+
78
+ {%- endif %}
79
+
80
+
81
+ {% if slots_in_subset %}
82
+ ## Slots in subset
83
+
84
+ | Slot | Description |
85
+ | --- | --- |
86
+ {% for s in slots_in_subset|sort(attribute=sort_by) -%}
87
+ {%- if element.name in s.in_subset -%}
88
+ | {{ gen.link(s) }} | {{ s.description|enshorten }} |
89
+ {%- endif %}
90
+ {% endfor %}
91
+
92
+ {%- endif %}
93
+
94
+
95
+ {% if enums_in_subset %}
96
+ ## Enumerations in subset
97
+
98
+ | Enumeration | Description |
99
+ | --- | --- |
100
+ {% for e in enums_in_subset|sort(attribute='name') -%}
101
+ {%- if element.name in e.in_subset %}
102
+ | {{ gen.link(e) }} | {{ e.description|enshorten }} |
103
+ {%- endif %}
104
+ {% endfor %}
105
+
106
+ {%- endif %}