linkml 1.8.7__tar.gz → 1.9.1__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.
- {linkml-1.8.7 → linkml-1.9.1}/PKG-INFO +6 -9
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/common/build.py +1 -7
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/common/ifabsent_processor.py +20 -20
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/common/lifecycle.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/common/naming.py +1 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/common/template.py +5 -5
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/common/type_designators.py +1 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/csvgen.py +3 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/class.md.jinja2 +1 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/enum.md.jinja2 +1 -1
- linkml-1.9.1/linkml/generators/docgen/schema.md.jinja2 +7 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/slot.md.jinja2 +4 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/subset.md.jinja2 +1 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/type.md.jinja2 +1 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen.py +20 -25
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/dotgen.py +4 -4
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/erdiagramgen.py +7 -7
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/excelgen.py +2 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/golanggen.py +2 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/golrgen.py +3 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/jsonldcontextgen.py +4 -4
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/jsonschemagen.py +5 -5
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/linkmlgen.py +10 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/markdowngen.py +8 -10
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/mermaidclassdiagramgen.py +2 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/oocodegen.py +10 -10
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/owlgen.py +19 -18
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/plantumlgen.py +15 -15
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/prefixmapgen.py +5 -5
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/projectgen.py +10 -10
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/array.py +15 -21
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/build.py +4 -4
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/includes.py +1 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/pydanticgen.py +24 -28
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/template.py +36 -36
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pythongen.py +21 -29
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/rdfgen.py +2 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/shaclgen.py +19 -10
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/shexgen.py +3 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/sparqlgen.py +3 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/sqlalchemygen.py +2 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/terminusdbgen.py +2 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/typescriptgen.py +3 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/yumlgen.py +13 -13
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/cli.py +1 -1
- linkml-1.9.1/linkml/linter/config/datamodel/config.py +469 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/config/datamodel/config.yaml +51 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/config/default.yaml +3 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/formatters/markdown_formatter.py +2 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/linter.py +4 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/rules.py +38 -19
- {linkml-1.8.7 → linkml-1.9.1}/linkml/reporting/model.py +11 -15
- {linkml-1.8.7 → linkml-1.9.1}/linkml/transformers/logical_model_transformer.py +9 -8
- {linkml-1.8.7 → linkml-1.9.1}/linkml/transformers/relmodel_transformer.py +6 -6
- {linkml-1.8.7 → linkml-1.9.1}/linkml/transformers/schema_renamer.py +2 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/converter.py +1 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/deprecation.py +3 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/execute_tutorial.py +5 -6
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/generator.py +17 -16
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/helpers.py +2 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/logictools.py +5 -4
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/mergeutils.py +51 -5
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/schema_builder.py +8 -8
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/schema_fixer.py +8 -8
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/schemaloader.py +16 -15
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/schemasynopsis.py +29 -29
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/sqlutils.py +5 -5
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/typereferences.py +5 -6
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/validation.py +2 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/cli.py +7 -6
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/loaders/delimited_file_loader.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/loaders/json_loader.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/loaders/loader.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/loaders/passthrough_loader.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/loaders/yaml_loader.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/plugins/jsonschema_validation_plugin.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/plugins/pydantic_validation_plugin.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/plugins/recommended_slots_plugin.py +3 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/plugins/shacl_validation_plugin.py +2 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/plugins/validation_plugin.py +1 -1
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/report.py +3 -3
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/validator.py +3 -2
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validators/jsonschemavalidator.py +6 -5
- {linkml-1.8.7 → linkml-1.9.1}/linkml/workspaces/datamodel/workspaces.py +21 -26
- {linkml-1.8.7 → linkml-1.9.1}/linkml/workspaces/example_runner.py +7 -6
- {linkml-1.8.7 → linkml-1.9.1}/pyproject.toml +14 -8
- linkml-1.8.7/linkml/generators/docgen/schema.md.jinja2 +0 -7
- linkml-1.8.7/linkml/linter/config/datamodel/config.py +0 -475
- linkml-1.8.7/setup.py +0 -141
- {linkml-1.8.7 → linkml-1.9.1}/LICENSE +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/README.md +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/_version.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/cli/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/cli/__main__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/cli/main.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/PythonGenNotes.md +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/README.md +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/common/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/dbmlgen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/class_diagram.md.jinja2 +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/common_metadata.md.jinja2 +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/index.md.jinja2 +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/docgen/index.tex.jinja2 +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/graphqlgen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/javagen/example_template.java.jinja2 +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/javagen/java_record_template.jinja2 +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/javagen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/jsonldgen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/legacy/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/namespacegen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/protogen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/black.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/attribute.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/base_model.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/class.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/conditional_import.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/enum.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/footer.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/imports.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/module.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/pydanticgen/templates/validator.py.jinja +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/python/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/python/python_ifabsent_processor.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/shacl/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/shacl/shacl_data_type.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/shacl/shacl_ifabsent_processor.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/sqlalchemy/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/sqlalchemy/sqlalchemy_declarative_template.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/sqlalchemy/sqlalchemy_imperative_template.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/sqltablegen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/sssomgen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/string_template.md +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/summarygen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/generators/yamlgen.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/config/datamodel/.linkmllint.yaml +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/config/datamodel/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/config/recommended.yaml +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/formatters/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/formatters/formatter.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/formatters/json_formatter.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/formatters/terminal_formatter.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/linter/formatters/tsv_formatter.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/reporting/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/transformers/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/transformers/model_transformer.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/cli_utils.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/datautils.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/datavalidator.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/exceptions.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/utils/rawloader.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/loaders/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/plugins/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validator/validation_context.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validators/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/validators/sparqlvalidator.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/workspaces/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/workspaces/datamodel/__init__.py +0 -0
- {linkml-1.8.7 → linkml-1.9.1}/linkml/workspaces/datamodel/workspaces.yaml +0 -0
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: linkml
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.9.1
|
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
|
7
7
|
Author: Chris Mungall
|
8
8
|
Author-email: cjmungall@lbl.gov
|
9
|
-
Requires-Python: >=3.
|
9
|
+
Requires-Python: >=3.9.0,<4.0.0
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
11
11
|
Classifier: Environment :: Console
|
12
12
|
Classifier: Intended Audience :: Developers
|
@@ -17,11 +17,9 @@ Classifier: Programming Language :: Python :: 3
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.9
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
20
|
-
Classifier: Programming Language :: Python :: 3.10
|
21
|
-
Classifier: Programming Language :: Python :: 3.11
|
22
20
|
Classifier: Programming Language :: Python :: 3.12
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
23
22
|
Classifier: Programming Language :: Python :: 3.8
|
24
|
-
Classifier: Programming Language :: Python :: 3.9
|
25
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
26
24
|
Provides-Extra: black
|
27
25
|
Provides-Extra: numpydantic
|
@@ -34,11 +32,10 @@ Requires-Dist: graphviz (>=0.10.1)
|
|
34
32
|
Requires-Dist: hbreader
|
35
33
|
Requires-Dist: isodate (>=0.6.0)
|
36
34
|
Requires-Dist: jinja2 (>=3.1.0)
|
37
|
-
Requires-Dist: jsonasobj2 (>=1.0.3,<2.
|
35
|
+
Requires-Dist: jsonasobj2 (>=1.0.3,<2.dev0)
|
38
36
|
Requires-Dist: jsonschema[format] (>=4.0.0)
|
39
|
-
Requires-Dist: linkml-
|
40
|
-
Requires-Dist:
|
41
|
-
Requires-Dist: numpydantic (>=1.6.1) ; (python_version >= "3.9") and (extra == "numpydantic" or extra == "tests")
|
37
|
+
Requires-Dist: linkml-runtime (>=1.9.1,<2.0.0)
|
38
|
+
Requires-Dist: numpydantic (>=1.6.1) ; extra == "numpydantic" or extra == "tests"
|
42
39
|
Requires-Dist: openpyxl
|
43
40
|
Requires-Dist: parse
|
44
41
|
Requires-Dist: prefixcommons (>=0.1.7)
|
@@ -5,13 +5,7 @@ Models for intermediate build results
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses
|
8
|
-
from typing import Any, TypeVar
|
9
|
-
|
10
|
-
try:
|
11
|
-
from typing import Annotated
|
12
|
-
except ImportError:
|
13
|
-
from typing_extensions import Annotated
|
14
|
-
|
8
|
+
from typing import Annotated, Any, TypeVar
|
15
9
|
|
16
10
|
from linkml_runtime.linkml_model import (
|
17
11
|
ClassDefinition,
|
@@ -2,7 +2,7 @@ import abc
|
|
2
2
|
import re
|
3
3
|
import sys
|
4
4
|
from abc import ABC
|
5
|
-
from typing import Any, Optional,
|
5
|
+
from typing import Any, Optional, Union
|
6
6
|
|
7
7
|
if sys.version_info < (3, 10):
|
8
8
|
from typing_extensions import TypeAlias
|
@@ -39,25 +39,25 @@ from linkml_runtime.linkml_model.types import (
|
|
39
39
|
)
|
40
40
|
|
41
41
|
TYPES_TYPE: TypeAlias = Union[
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
42
|
+
type[Boolean],
|
43
|
+
type[Curie],
|
44
|
+
type[Date],
|
45
|
+
type[DateOrDatetime],
|
46
|
+
type[Datetime],
|
47
|
+
type[Decimal],
|
48
|
+
type[Double],
|
49
|
+
type[Float],
|
50
|
+
type[Integer],
|
51
|
+
type[Jsonpath],
|
52
|
+
type[Jsonpointer],
|
53
|
+
type[Ncname],
|
54
|
+
type[Nodeidentifier],
|
55
|
+
type[Objectidentifier],
|
56
|
+
type[Sparqlpath],
|
57
|
+
type[String],
|
58
|
+
type[Time],
|
59
|
+
type[Uri],
|
60
|
+
type[Uriorcurie],
|
61
61
|
]
|
62
62
|
|
63
63
|
TYPES = [
|
@@ -10,7 +10,7 @@ class NamingProfiles(str, Enum):
|
|
10
10
|
graphql = "graphql"
|
11
11
|
|
12
12
|
|
13
|
-
class NameCompatibility
|
13
|
+
class NameCompatibility:
|
14
14
|
"""Make a name compatible to the given profile"""
|
15
15
|
|
16
16
|
# heading double underscores and digit reserved to names starting with a digit
|
@@ -5,7 +5,7 @@ See :mod:`.linkml.generators.pydanticgen.template` for example implementation
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
from copy import copy
|
8
|
-
from typing import Any, ClassVar,
|
8
|
+
from typing import Any, ClassVar, Optional, Union
|
9
9
|
|
10
10
|
from jinja2 import Environment
|
11
11
|
from pydantic import BaseModel
|
@@ -27,7 +27,7 @@ class TemplateModel(BaseModel):
|
|
27
27
|
template: ClassVar[str]
|
28
28
|
_environment: ClassVar[Environment]
|
29
29
|
|
30
|
-
meta_exclude: ClassVar[
|
30
|
+
meta_exclude: ClassVar[list[str]] = None
|
31
31
|
|
32
32
|
def render(self, environment: Optional[Environment] = None, **kwargs) -> str:
|
33
33
|
"""
|
@@ -62,7 +62,7 @@ class TemplateModel(BaseModel):
|
|
62
62
|
return copy(cls._environment)
|
63
63
|
|
64
64
|
@classmethod
|
65
|
-
def exclude_from_meta(cls: "TemplateModel") ->
|
65
|
+
def exclude_from_meta(cls: "TemplateModel") -> list[str]:
|
66
66
|
"""
|
67
67
|
Attributes in the source definition to exclude from linkml_meta
|
68
68
|
"""
|
@@ -73,9 +73,9 @@ class TemplateModel(BaseModel):
|
|
73
73
|
|
74
74
|
|
75
75
|
def _render(
|
76
|
-
item: Union[TemplateModel, Any,
|
76
|
+
item: Union[TemplateModel, Any, list[Union[Any, TemplateModel]], dict[str, Union[Any, TemplateModel]]],
|
77
77
|
environment: Environment,
|
78
|
-
) -> Union[str,
|
78
|
+
) -> Union[str, list[str], dict[str, str]]:
|
79
79
|
if isinstance(item, TemplateModel):
|
80
80
|
return item.render(environment)
|
81
81
|
elif isinstance(item, list):
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
from linkml_runtime.linkml_model.meta import ClassDefinition, SlotDefinition
|
4
2
|
from linkml_runtime.utils.schemaview import SchemaView
|
5
3
|
|
@@ -22,7 +20,7 @@ def get_type_designator_value(sv: SchemaView, type_designator_slot: SlotDefiniti
|
|
22
20
|
|
23
21
|
def get_accepted_type_designator_values(
|
24
22
|
sv: SchemaView, type_designator_slot: SlotDefinition, class_def: ClassDefinition
|
25
|
-
) ->
|
23
|
+
) -> list[str]:
|
26
24
|
"""
|
27
25
|
returns the accepted values for a type designator field for a given class, depending on its range
|
28
26
|
this implements the logic described in https://github.com/linkml/linkml/issues/945:
|
@@ -6,7 +6,7 @@ import os
|
|
6
6
|
from csv import DictWriter
|
7
7
|
from dataclasses import dataclass
|
8
8
|
from io import StringIO
|
9
|
-
from typing import
|
9
|
+
from typing import Optional
|
10
10
|
|
11
11
|
import click
|
12
12
|
from linkml_runtime.linkml_model.meta import ClassDefinition, ClassDefinitionName
|
@@ -36,7 +36,7 @@ class CsvGenerator(Generator):
|
|
36
36
|
sep: Optional[str] = None
|
37
37
|
"""Separator for columns"""
|
38
38
|
|
39
|
-
closure: Optional[
|
39
|
+
closure: Optional[set[ClassDefinitionName]] = None
|
40
40
|
"""List of classes to include in output"""
|
41
41
|
|
42
42
|
writer: Optional[DictWriter] = None
|
@@ -57,7 +57,7 @@ class CsvGenerator(Generator):
|
|
57
57
|
out = "\n".join([out, f"# version: {self.schema.version}"])
|
58
58
|
return out
|
59
59
|
|
60
|
-
def visit_schema(self, classes:
|
60
|
+
def visit_schema(self, classes: list[ClassDefinitionName] = None, **_) -> None:
|
61
61
|
# Note: classes comes from the "root" argument
|
62
62
|
self.closure = set()
|
63
63
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
{%- endif -%}
|
22
22
|
{% endmacro %}
|
23
23
|
|
24
|
-
# Slot: {{ title }}
|
24
|
+
# Slot: {{ title }} {% if element.deprecated %} <span style="color: red;"><strong> (DEPRECATED) </strong> {% endif %}
|
25
25
|
|
26
26
|
{%- if header -%}
|
27
27
|
{{header}}
|
@@ -40,6 +40,9 @@ _{{ element_description_line }}_
|
|
40
40
|
|
41
41
|
URI: {{ gen.uri_link(element) }}
|
42
42
|
|
43
|
+
{%- if element.alias %}
|
44
|
+
Alias: {{ element.alias }}
|
45
|
+
{% endif -%}
|
43
46
|
|
44
47
|
{% if schemaview.slot_parents(element.name) or schemaview.slot_children(element.name, mixins=False) %}
|
45
48
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import importlib.util
|
2
2
|
import logging
|
3
3
|
import os
|
4
|
+
from collections.abc import Iterable, Iterator
|
4
5
|
from copy import deepcopy
|
5
6
|
from dataclasses import dataclass, field
|
6
7
|
from enum import Enum
|
7
8
|
from pathlib import Path
|
8
|
-
from typing import
|
9
|
+
from typing import Optional, Union
|
9
10
|
|
10
11
|
import click
|
11
12
|
from jinja2 import Environment, FileSystemLoader, Template
|
@@ -135,7 +136,7 @@ class DocGenerator(Generator):
|
|
135
136
|
"""markdown dialect (e.g MyST, Python)"""
|
136
137
|
sort_by: str = "name"
|
137
138
|
visit_all_class_slots = False
|
138
|
-
template_mappings:
|
139
|
+
template_mappings: dict[str, str] = None
|
139
140
|
directory: str = None
|
140
141
|
"""directory in which to write documents"""
|
141
142
|
|
@@ -462,7 +463,7 @@ class DocGenerator(Generator):
|
|
462
463
|
else:
|
463
464
|
return e.name
|
464
465
|
|
465
|
-
def links(self, e_list:
|
466
|
+
def links(self, e_list: list[DefinitionName]) -> list[str]:
|
466
467
|
"""Render list of element documentation pages as hyperlinks.
|
467
468
|
|
468
469
|
:param e_list: list of elements
|
@@ -521,7 +522,7 @@ class DocGenerator(Generator):
|
|
521
522
|
mixins=True,
|
522
523
|
descriptions=False,
|
523
524
|
focus: DefinitionName = None,
|
524
|
-
) ->
|
525
|
+
) -> tuple[str, int]:
|
525
526
|
sv = self.schemaview
|
526
527
|
if element.is_a:
|
527
528
|
pre, depth = self._tree(
|
@@ -681,7 +682,7 @@ class DocGenerator(Generator):
|
|
681
682
|
else:
|
682
683
|
return "mermaid"
|
683
684
|
|
684
|
-
def mermaid_diagram(self, class_names:
|
685
|
+
def mermaid_diagram(self, class_names: list[Union[str, ClassDefinitionName]] = None) -> str:
|
685
686
|
"""
|
686
687
|
Render a mermaid diagram for a set of classes
|
687
688
|
|
@@ -750,8 +751,7 @@ class DocGenerator(Generator):
|
|
750
751
|
"""
|
751
752
|
elts = self.schemaview.class_induced_slots(class_name)
|
752
753
|
_ensure_ranked(elts)
|
753
|
-
|
754
|
-
yield e
|
754
|
+
yield from elts
|
755
755
|
|
756
756
|
def all_class_objects(self) -> Iterator[ClassDefinition]:
|
757
757
|
"""
|
@@ -762,8 +762,7 @@ class DocGenerator(Generator):
|
|
762
762
|
"""
|
763
763
|
elts = self.schemaview.all_classes(imports=self.render_imports).values()
|
764
764
|
_ensure_ranked(elts)
|
765
|
-
|
766
|
-
yield e
|
765
|
+
yield from elts
|
767
766
|
|
768
767
|
def all_slot_objects(self) -> Iterator[SlotDefinition]:
|
769
768
|
"""
|
@@ -774,8 +773,7 @@ class DocGenerator(Generator):
|
|
774
773
|
"""
|
775
774
|
elts = self.schemaview.all_slots(imports=self.render_imports).values()
|
776
775
|
_ensure_ranked(elts)
|
777
|
-
|
778
|
-
yield e
|
776
|
+
yield from elts
|
779
777
|
|
780
778
|
def all_type_objects(self) -> Iterator[TypeDefinition]:
|
781
779
|
"""
|
@@ -786,10 +784,9 @@ class DocGenerator(Generator):
|
|
786
784
|
"""
|
787
785
|
elts = self.schemaview.all_types(imports=self.render_imports).values()
|
788
786
|
_ensure_ranked(elts)
|
789
|
-
|
790
|
-
yield e
|
787
|
+
yield from elts
|
791
788
|
|
792
|
-
def all_type_object_names(self) ->
|
789
|
+
def all_type_object_names(self) -> list[TypeDefinitionName]:
|
793
790
|
return [t.name for t in list(self.all_type_objects())]
|
794
791
|
|
795
792
|
def all_enum_objects(self) -> Iterator[EnumDefinition]:
|
@@ -801,8 +798,7 @@ class DocGenerator(Generator):
|
|
801
798
|
"""
|
802
799
|
elts = self.schemaview.all_enums(imports=self.render_imports).values()
|
803
800
|
_ensure_ranked(elts)
|
804
|
-
|
805
|
-
yield e
|
801
|
+
yield from elts
|
806
802
|
|
807
803
|
def all_subset_objects(self) -> Iterator[SubsetDefinition]:
|
808
804
|
"""
|
@@ -813,10 +809,9 @@ class DocGenerator(Generator):
|
|
813
809
|
"""
|
814
810
|
elts = self.schemaview.all_subsets(imports=self.render_imports).values()
|
815
811
|
_ensure_ranked(elts)
|
816
|
-
|
817
|
-
yield e
|
812
|
+
yield from elts
|
818
813
|
|
819
|
-
def class_hierarchy_as_tuples(self) -> Iterator[
|
814
|
+
def class_hierarchy_as_tuples(self) -> Iterator[tuple[int, ClassDefinitionName]]:
|
820
815
|
"""
|
821
816
|
Generate a hierarchical representation of all classes in the schema
|
822
817
|
|
@@ -880,7 +875,7 @@ class DocGenerator(Generator):
|
|
880
875
|
return slot
|
881
876
|
|
882
877
|
@staticmethod
|
883
|
-
def get_direct_slot_names(cls: ClassDefinition) ->
|
878
|
+
def get_direct_slot_names(cls: ClassDefinition) -> list[SlotDefinitionName]:
|
884
879
|
"""Fetch list of all own attributes of a class, i.e.,
|
885
880
|
all slot names of slots that belong to the domain of a class.
|
886
881
|
|
@@ -889,7 +884,7 @@ class DocGenerator(Generator):
|
|
889
884
|
"""
|
890
885
|
return cls.slots + list(cls.attributes.keys())
|
891
886
|
|
892
|
-
def get_direct_slots(self, cls: ClassDefinition) ->
|
887
|
+
def get_direct_slots(self, cls: ClassDefinition) -> list[SlotDefinition]:
|
893
888
|
"""Fetch list of all own attributes of a class, i.e.,
|
894
889
|
all slots that belong to the domain of a class.
|
895
890
|
|
@@ -900,7 +895,7 @@ class DocGenerator(Generator):
|
|
900
895
|
self.inject_slot_info(self.schemaview.induced_slot(sn, cls.name)) for sn in self.get_direct_slot_names(cls)
|
901
896
|
]
|
902
897
|
|
903
|
-
def get_indirect_slots(self, cls: ClassDefinition) ->
|
898
|
+
def get_indirect_slots(self, cls: ClassDefinition) -> list[SlotDefinition]:
|
904
899
|
"""Fetch list of all inherited attributes of a class, i.e.,
|
905
900
|
all slots that belong to the domain of a class.
|
906
901
|
|
@@ -917,7 +912,7 @@ class DocGenerator(Generator):
|
|
917
912
|
|
918
913
|
def get_slot_inherited_from(
|
919
914
|
self, class_name: ClassDefinitionName, slot_name: SlotDefinitionName
|
920
|
-
) ->
|
915
|
+
) -> list[ClassDefinitionName]:
|
921
916
|
"""Get the name of the class that a given slot is inherited from.
|
922
917
|
|
923
918
|
:param class_name: name of the class whose slot we are checking
|
@@ -929,7 +924,7 @@ class DocGenerator(Generator):
|
|
929
924
|
ancestors = sv.class_ancestors(class_name)
|
930
925
|
return list(set(induced_slot.domain_of).intersection(ancestors))
|
931
926
|
|
932
|
-
def get_mixin_inherited_slots(self, cls: ClassDefinition) ->
|
927
|
+
def get_mixin_inherited_slots(self, cls: ClassDefinition) -> dict[str, list[str]]:
|
933
928
|
"""Fetch list of all slots acquired through mixing.
|
934
929
|
|
935
930
|
:param cls: class for which we want to determine the mixed in slots
|
@@ -944,7 +939,7 @@ class DocGenerator(Generator):
|
|
944
939
|
|
945
940
|
return mixed_in_slots
|
946
941
|
|
947
|
-
def example_object_blobs(self, class_name: str) ->
|
942
|
+
def example_object_blobs(self, class_name: str) -> list[tuple[str, str]]:
|
948
943
|
"""Fetch list of all examples of a class.
|
949
944
|
|
950
945
|
:param class_name: class for which we want to determine the examples
|
@@ -4,7 +4,7 @@ Generate dotfiles
|
|
4
4
|
|
5
5
|
import os
|
6
6
|
from dataclasses import dataclass
|
7
|
-
from typing import
|
7
|
+
from typing import Optional
|
8
8
|
|
9
9
|
import click
|
10
10
|
from deprecated.classic import deprecated
|
@@ -35,19 +35,19 @@ class DotGenerator(Generator):
|
|
35
35
|
uses_schemaloader = True
|
36
36
|
|
37
37
|
# ObjectVars
|
38
|
-
classnames: Optional[
|
38
|
+
classnames: Optional[list[str]] = None
|
39
39
|
filename: Optional[str] = None
|
40
40
|
dirname: Optional[str] = None
|
41
41
|
filedot: Optional[Digraph] = None
|
42
42
|
classdot: Optional[Digraph] = None
|
43
43
|
cls_subj: Optional[SlotDefinition] = None
|
44
44
|
cls_obj: Optional[SlotDefinition] = None
|
45
|
-
classname: Optional[
|
45
|
+
classname: Optional[list[str]] = None
|
46
46
|
directory: Optional[str] = None
|
47
47
|
|
48
48
|
def visit_schema(
|
49
49
|
self,
|
50
|
-
classname: Optional[
|
50
|
+
classname: Optional[list[str]] = None,
|
51
51
|
directory: Optional[str] = None,
|
52
52
|
filename: Optional[str] = None,
|
53
53
|
**_,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
from dataclasses import dataclass
|
3
3
|
from enum import Enum
|
4
|
-
from typing import
|
4
|
+
from typing import Optional, Union
|
5
5
|
|
6
6
|
import click
|
7
7
|
import pydantic
|
@@ -75,7 +75,7 @@ class Entity(pydantic.BaseModel):
|
|
75
75
|
"""Entity in an ER diagram."""
|
76
76
|
|
77
77
|
name: str
|
78
|
-
attributes:
|
78
|
+
attributes: list[Attribute] = []
|
79
79
|
|
80
80
|
def __str__(self):
|
81
81
|
attrs = "\n".join([str(a) for a in self.attributes])
|
@@ -97,8 +97,8 @@ class Relationship(pydantic.BaseModel):
|
|
97
97
|
class ERDiagram(pydantic.BaseModel):
|
98
98
|
"""Represents an Diagram of Entities and Relationships"""
|
99
99
|
|
100
|
-
entities:
|
101
|
-
relationships:
|
100
|
+
entities: list[Entity] = []
|
101
|
+
relationships: list[Relationship] = []
|
102
102
|
|
103
103
|
def __str__(self):
|
104
104
|
ents = "\n".join([str(e) for e in self.entities])
|
@@ -160,7 +160,7 @@ class ERDiagramGenerator(Generator):
|
|
160
160
|
|
161
161
|
def serialize_classes(
|
162
162
|
self,
|
163
|
-
class_names:
|
163
|
+
class_names: list[Union[str, ClassDefinitionName]],
|
164
164
|
follow_references=False,
|
165
165
|
max_hops: int = None,
|
166
166
|
include_upstream: bool = False,
|
@@ -220,7 +220,7 @@ class ERDiagramGenerator(Generator):
|
|
220
220
|
else:
|
221
221
|
return er
|
222
222
|
|
223
|
-
def add_upstream_class(self, class_name: ClassDefinitionName, targets:
|
223
|
+
def add_upstream_class(self, class_name: ClassDefinitionName, targets: set[str], diagram: ERDiagram) -> None:
|
224
224
|
sv = self.schemaview
|
225
225
|
cls = sv.get_class(class_name)
|
226
226
|
entity = Entity(name=camelcase(cls.name))
|
@@ -316,7 +316,7 @@ class ERDiagramGenerator(Generator):
|
|
316
316
|
@click.command(name="erdiagram")
|
317
317
|
def cli(
|
318
318
|
yamlfile,
|
319
|
-
classes:
|
319
|
+
classes: list[str],
|
320
320
|
max_hops: Optional[int],
|
321
321
|
follow_references: bool,
|
322
322
|
include_upstream: bool = False,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import logging
|
2
2
|
from dataclasses import dataclass
|
3
3
|
from pathlib import Path
|
4
|
-
from typing import List
|
5
4
|
|
6
5
|
import click
|
7
6
|
from linkml_runtime.utils.schemaview import SchemaView
|
@@ -42,7 +41,7 @@ class ExcelGenerator(Generator):
|
|
42
41
|
workbook.save(workbook_path)
|
43
42
|
return workbook
|
44
43
|
|
45
|
-
def create_workbook_and_worksheets(self, output_path: Path, classes:
|
44
|
+
def create_workbook_and_worksheets(self, output_path: Path, classes: list[str]) -> None:
|
46
45
|
"""
|
47
46
|
Creates a workbook with worksheets for each class.
|
48
47
|
|
@@ -89,7 +88,7 @@ class ExcelGenerator(Generator):
|
|
89
88
|
self.logger.info(f"The Excel workbooks have been written to {output_path}")
|
90
89
|
|
91
90
|
@staticmethod
|
92
|
-
def add_columns_to_worksheet(workbook: Workbook, worksheet_name: str, sheet_headings:
|
91
|
+
def add_columns_to_worksheet(workbook: Workbook, worksheet_name: str, sheet_headings: list[str]) -> None:
|
93
92
|
"""
|
94
93
|
Get a worksheet by name and add a column to it in an existing workbook.
|
95
94
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
import os
|
3
3
|
from dataclasses import dataclass
|
4
|
-
from typing import
|
4
|
+
from typing import Optional
|
5
5
|
|
6
6
|
import click
|
7
7
|
from jinja2 import Template
|
@@ -181,7 +181,7 @@ class GolangGenerator(Generator):
|
|
181
181
|
return "string"
|
182
182
|
|
183
183
|
@staticmethod
|
184
|
-
def parents(cls: ClassDefinition) ->
|
184
|
+
def parents(cls: ClassDefinition) -> list[ClassDefinitionName]:
|
185
185
|
if cls.is_a:
|
186
186
|
parents = [cls.is_a]
|
187
187
|
else:
|
@@ -9,7 +9,7 @@ See the golr-views directory in this repo for examples
|
|
9
9
|
|
10
10
|
import os
|
11
11
|
from dataclasses import dataclass
|
12
|
-
from typing import
|
12
|
+
from typing import Optional
|
13
13
|
|
14
14
|
import click
|
15
15
|
from linkml_runtime.linkml_model.meta import ClassDefinition, SlotDefinition
|
@@ -26,7 +26,7 @@ class GOLRField(YAMLRoot):
|
|
26
26
|
id: str
|
27
27
|
description: str
|
28
28
|
display_name: str
|
29
|
-
property:
|
29
|
+
property: list = empty_list()
|
30
30
|
cardinality: Optional[str] = None
|
31
31
|
|
32
32
|
|
@@ -38,7 +38,7 @@ class GOLRClass(YAMLRoot):
|
|
38
38
|
display_name: str
|
39
39
|
document_category: str
|
40
40
|
weight: int
|
41
|
-
fields:
|
41
|
+
fields: list[GOLRField] = empty_list()
|
42
42
|
|
43
43
|
|
44
44
|
@dataclass
|
@@ -6,7 +6,7 @@ Generate JSON-LD contexts
|
|
6
6
|
import os
|
7
7
|
import re
|
8
8
|
from dataclasses import dataclass, field
|
9
|
-
from typing import Any,
|
9
|
+
from typing import Any, Optional, Union
|
10
10
|
|
11
11
|
import click
|
12
12
|
from jsonasobj2 import JsonObj, as_json
|
@@ -39,10 +39,10 @@ class ContextGenerator(Generator):
|
|
39
39
|
file_extension = "context.jsonld"
|
40
40
|
|
41
41
|
# ObjectVars
|
42
|
-
emit_prefixes:
|
42
|
+
emit_prefixes: set[str] = field(default_factory=lambda: set())
|
43
43
|
default_ns: str = None
|
44
|
-
context_body:
|
45
|
-
slot_class_maps:
|
44
|
+
context_body: dict = field(default_factory=lambda: dict())
|
45
|
+
slot_class_maps: dict = field(default_factory=lambda: dict())
|
46
46
|
emit_metadata: bool = False
|
47
47
|
model: Optional[bool] = True
|
48
48
|
base: Optional[Union[str, Namespace]] = None
|
@@ -3,7 +3,7 @@ import logging
|
|
3
3
|
import os
|
4
4
|
from copy import deepcopy
|
5
5
|
from dataclasses import dataclass
|
6
|
-
from typing import Any,
|
6
|
+
from typing import Any, Optional, Union
|
7
7
|
|
8
8
|
import click
|
9
9
|
from linkml_runtime.linkml_model.meta import (
|
@@ -33,7 +33,7 @@ logger = logging.getLogger(__name__)
|
|
33
33
|
# Note: The underlying types are a union of any built-in python datatype + any type defined in
|
34
34
|
# linkml-runtime/utils/metamodelcore.py
|
35
35
|
# Note the keys are all lower case
|
36
|
-
json_schema_types:
|
36
|
+
json_schema_types: dict[str, tuple[str, Optional[str]]] = {
|
37
37
|
"int": ("integer", None),
|
38
38
|
"integer": ("integer", None),
|
39
39
|
"bool": ("boolean", None),
|
@@ -69,7 +69,7 @@ class JsonSchema(dict):
|
|
69
69
|
identifier_name = self._lax_forward_refs.pop(canonical_name)
|
70
70
|
self.add_lax_def(canonical_name, identifier_name)
|
71
71
|
|
72
|
-
def add_lax_def(self, names: Union[str,
|
72
|
+
def add_lax_def(self, names: Union[str, list[str]], identifier_name: str) -> None:
|
73
73
|
# JSON-Schema does not have inheritance,
|
74
74
|
# so we duplicate slots from inherited parents and mixins
|
75
75
|
# Maps e.g. Person --> Person__identifier_optional
|
@@ -147,7 +147,7 @@ class JsonSchema(dict):
|
|
147
147
|
return json.dumps(self, **kwargs)
|
148
148
|
|
149
149
|
@classmethod
|
150
|
-
def ref_for(cls, class_name: Union[str,
|
150
|
+
def ref_for(cls, class_name: Union[str, list[str]], identifier_optional: bool = False, required: bool = True):
|
151
151
|
def _ref(class_name):
|
152
152
|
def_name = camelcase(class_name)
|
153
153
|
def_suffix = cls.OPTIONAL_IDENTIFIER_SUFFIX if identifier_optional else ""
|
@@ -459,7 +459,7 @@ class JsonSchemaGenerator(Generator, LifecycleMixin):
|
|
459
459
|
|
460
460
|
def get_type_info_for_slot_subschema(
|
461
461
|
self, slot: Union[SlotDefinition, AnonymousSlotExpression]
|
462
|
-
) ->
|
462
|
+
) -> tuple[str, str, Union[str, list[str]]]:
|
463
463
|
# JSON Schema type (https://json-schema.org/understanding-json-schema/reference/type.html)
|
464
464
|
typ = None
|
465
465
|
# Reference to a JSON schema entity (https://json-schema.org/understanding-json-schema/structuring.html#ref)
|