cognite-neat 0.121.0__py3-none-any.whl → 0.121.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cognite-neat might be problematic. Click here for more details.
- cognite/neat/_version.py +1 -1
- cognite/neat/core/_constants.py +2 -2
- cognite/neat/core/{_rules → _data_model}/_constants.py +2 -2
- cognite/neat/core/{_rules → _data_model}/_shared.py +9 -9
- cognite/neat/core/{_rules → _data_model}/analysis/_base.py +33 -29
- cognite/neat/core/{_rules → _data_model}/exporters/_base.py +1 -1
- cognite/neat/core/{_rules → _data_model}/exporters/_rules2dms.py +1 -1
- cognite/neat/core/{_rules → _data_model}/exporters/_rules2excel.py +15 -10
- cognite/neat/core/{_rules → _data_model}/exporters/_rules2instance_template.py +9 -7
- cognite/neat/core/{_rules → _data_model}/exporters/_rules2ontology.py +24 -21
- cognite/neat/core/{_rules → _data_model}/exporters/_rules2yaml.py +1 -1
- cognite/neat/core/{_rules → _data_model}/exporters/_validation.py +5 -5
- cognite/neat/core/{_rules → _data_model}/importers/__init__.py +1 -3
- cognite/neat/core/{_rules → _data_model}/importers/_base.py +1 -1
- cognite/neat/core/{_rules → _data_model}/importers/_dms2rules.py +37 -33
- cognite/neat/core/{_rules → _data_model}/importers/_dtdl2rules/dtdl_converter.py +25 -25
- cognite/neat/core/{_rules → _data_model}/importers/_dtdl2rules/dtdl_importer.py +14 -14
- cognite/neat/core/{_rules → _data_model}/importers/_dtdl2rules/spec.py +1 -1
- cognite/neat/core/{_rules → _data_model}/importers/_rdf/_base.py +11 -9
- cognite/neat/core/{_rules → _data_model}/importers/_rdf/_imf2rules.py +2 -2
- cognite/neat/core/{_rules → _data_model}/importers/_rdf/_inference2rules.py +24 -24
- cognite/neat/core/{_rules → _data_model}/importers/_rdf/_owl2rules.py +2 -2
- cognite/neat/core/{_rules → _data_model}/importers/_spreadsheet2rules.py +7 -36
- cognite/neat/core/{_rules → _data_model}/importers/_yaml2rules.py +2 -2
- cognite/neat/core/_data_model/models/__init__.py +36 -0
- cognite/neat/core/{_rules/models/_base_input.py → _data_model/models/_base_unverified.py} +11 -11
- cognite/neat/core/{_rules/models/_base_rules.py → _data_model/models/_base_verified.py} +10 -10
- cognite/neat/core/{_rules → _data_model}/models/_types.py +7 -7
- cognite/neat/core/_data_model/models/conceptual/__init__.py +25 -0
- cognite/neat/core/{_rules/models/information/_rules_input.py → _data_model/models/conceptual/_unverified.py} +31 -28
- cognite/neat/core/{_rules/models/information → _data_model/models/conceptual}/_validation.py +9 -5
- cognite/neat/core/{_rules/models/information/_rules.py → _data_model/models/conceptual/_verified.py} +40 -42
- cognite/neat/core/{_rules → _data_model}/models/data_types.py +2 -2
- cognite/neat/core/{_rules → _data_model}/models/dms/_exporter.py +14 -14
- cognite/neat/core/{_rules → _data_model}/models/dms/_rules.py +15 -15
- cognite/neat/core/{_rules → _data_model}/models/dms/_rules_input.py +15 -12
- cognite/neat/core/{_rules → _data_model}/models/dms/_validation.py +7 -6
- cognite/neat/core/{_rules → _data_model}/models/entities/_loaders.py +1 -1
- cognite/neat/core/{_rules → _data_model}/models/entities/_multi_value.py +2 -2
- cognite/neat/core/{_rules → _data_model}/models/entities/_single_value.py +1 -1
- cognite/neat/core/{_rules → _data_model}/models/mapping/_classic2core.py +4 -4
- cognite/neat/core/{_rules → _data_model}/transformers/_base.py +6 -3
- cognite/neat/core/{_rules → _data_model}/transformers/_converters.py +117 -103
- cognite/neat/core/{_rules → _data_model}/transformers/_mapping.py +8 -8
- cognite/neat/core/{_rules → _data_model}/transformers/_verification.py +14 -14
- cognite/neat/core/{_graph → _instances}/extractors/_base.py +2 -2
- cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_base.py +1 -1
- cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_classic.py +13 -7
- cognite/neat/core/{_graph → _instances}/extractors/_dms_graph.py +10 -10
- cognite/neat/core/{_graph → _instances}/extractors/_mock_graph_generator.py +14 -14
- cognite/neat/core/{_graph → _instances}/extractors/_rdf_file.py +2 -2
- cognite/neat/core/{_graph → _instances}/loaders/_rdf2dms.py +12 -10
- cognite/neat/core/{_graph → _instances}/transformers/_classic_cdf.py +1 -1
- cognite/neat/core/_issues/_base.py +2 -2
- cognite/neat/core/_issues/warnings/__init__.py +2 -0
- cognite/neat/core/_issues/warnings/_properties.py +7 -0
- cognite/neat/core/_store/_graph_store.py +4 -4
- cognite/neat/core/_store/_rules_store.py +31 -31
- cognite/neat/core/_store/exceptions.py +3 -3
- cognite/neat/core/_utils/spreadsheet.py +1 -1
- cognite/neat/core/_utils/text.py +1 -1
- cognite/neat/session/_base.py +10 -8
- cognite/neat/session/_drop.py +1 -1
- cognite/neat/session/_fix.py +2 -2
- cognite/neat/session/_mapping.py +3 -3
- cognite/neat/session/_prepare.py +4 -4
- cognite/neat/session/_read.py +13 -13
- cognite/neat/session/_set.py +3 -3
- cognite/neat/session/_show.py +1 -1
- cognite/neat/session/_state.py +6 -6
- cognite/neat/session/_subset.py +3 -3
- cognite/neat/session/_template.py +10 -10
- cognite/neat/session/_to.py +8 -8
- cognite/neat/session/_wizard.py +1 -1
- {cognite_neat-0.121.0.dist-info → cognite_neat-0.121.1.dist-info}/METADATA +1 -1
- cognite_neat-0.121.1.dist-info/RECORD +187 -0
- cognite/neat/core/_rules/models/__init__.py +0 -34
- cognite/neat/core/_rules/models/information/__init__.py +0 -20
- cognite_neat-0.121.0.dist-info/RECORD +0 -187
- /cognite/neat/core/{_graph → _data_model}/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/analysis/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/catalog/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/catalog/classic_model.xlsx +0 -0
- /cognite/neat/core/{_rules → _data_model}/catalog/hello_world_pump.xlsx +0 -0
- /cognite/neat/core/{_rules → _data_model}/catalog/info-rules-imf.xlsx +0 -0
- /cognite/neat/core/{_rules → _data_model}/exporters/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/importers/_dtdl2rules/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/importers/_dtdl2rules/_unit_lookup.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/importers/_rdf/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/importers/_rdf/_shared.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/models/dms/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/models/entities/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/models/entities/_constants.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/models/entities/_types.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/models/entities/_wrapped.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/models/mapping/__init__.py +0 -0
- /cognite/neat/core/{_rules → _data_model}/models/mapping/_classic2core.yaml +0 -0
- /cognite/neat/core/{_rules → _data_model}/transformers/__init__.py +0 -0
- /cognite/neat/core/{_graph/extractors/_classic_cdf → _instances}/__init__.py +0 -0
- /cognite/neat/core/{_graph → _instances}/_shared.py +0 -0
- /cognite/neat/core/{_graph → _instances}/_tracking/__init__.py +0 -0
- /cognite/neat/core/{_graph → _instances}/_tracking/base.py +0 -0
- /cognite/neat/core/{_graph → _instances}/_tracking/log.py +0 -0
- /cognite/neat/core/{_graph → _instances}/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/core/{_graph → _instances}/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/core/{_graph → _instances}/examples/__init__.py +0 -0
- /cognite/neat/core/{_graph → _instances}/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/__init__.py +0 -0
- /cognite/neat/core/{_rules → _instances/extractors/_classic_cdf}/__init__.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_assets.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_data_sets.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_events.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_files.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_labels.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_relationships.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_sequences.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_classic_cdf/_timeseries.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_dict.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_dms.py +0 -0
- /cognite/neat/core/{_graph → _instances}/extractors/_raw.py +0 -0
- /cognite/neat/core/{_graph → _instances}/loaders/__init__.py +0 -0
- /cognite/neat/core/{_graph → _instances}/loaders/_base.py +0 -0
- /cognite/neat/core/{_graph → _instances}/queries/__init__.py +0 -0
- /cognite/neat/core/{_graph → _instances}/queries/_base.py +0 -0
- /cognite/neat/core/{_graph → _instances}/queries/_queries.py +0 -0
- /cognite/neat/core/{_graph → _instances}/queries/_select.py +0 -0
- /cognite/neat/core/{_graph → _instances}/queries/_update.py +0 -0
- /cognite/neat/core/{_graph → _instances}/transformers/__init__.py +0 -0
- /cognite/neat/core/{_graph → _instances}/transformers/_base.py +0 -0
- /cognite/neat/core/{_graph → _instances}/transformers/_prune_graph.py +0 -0
- /cognite/neat/core/{_graph → _instances}/transformers/_rdfpath.py +0 -0
- /cognite/neat/core/{_graph → _instances}/transformers/_value_type.py +0 -0
- {cognite_neat-0.121.0.dist-info → cognite_neat-0.121.1.dist-info}/WHEEL +0 -0
- {cognite_neat-0.121.0.dist-info → cognite_neat-0.121.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
from collections import Counter
|
|
2
2
|
from collections.abc import Callable, Sequence
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core.
|
|
5
|
-
from cognite.neat.core._issues.errors import (
|
|
6
|
-
PropertyTypeNotSupportedError,
|
|
7
|
-
ResourceMissingIdentifierError,
|
|
8
|
-
ResourceNotFoundError,
|
|
9
|
-
)
|
|
10
|
-
from cognite.neat.core._issues.warnings import (
|
|
11
|
-
PropertyTypeNotSupportedWarning,
|
|
12
|
-
ResourceTypeNotSupportedWarning,
|
|
13
|
-
)
|
|
14
|
-
from cognite.neat.core._rules.importers._dtdl2rules.spec import (
|
|
4
|
+
from cognite.neat.core._data_model.importers._dtdl2rules.spec import (
|
|
15
5
|
DTMI,
|
|
16
6
|
Command,
|
|
17
7
|
CommandV2,
|
|
@@ -28,24 +18,34 @@ from cognite.neat.core._rules.importers._dtdl2rules.spec import (
|
|
|
28
18
|
Telemetry,
|
|
29
19
|
TelemetryV2,
|
|
30
20
|
)
|
|
31
|
-
from cognite.neat.core.
|
|
21
|
+
from cognite.neat.core._data_model.models.conceptual import (
|
|
22
|
+
UnverifiedConceptualClass,
|
|
23
|
+
UnverifiedConceptualProperty,
|
|
24
|
+
)
|
|
25
|
+
from cognite.neat.core._data_model.models.data_types import (
|
|
32
26
|
_DATA_TYPE_BY_NAME,
|
|
33
27
|
DataType,
|
|
34
28
|
Json,
|
|
35
29
|
String,
|
|
36
30
|
)
|
|
37
|
-
from cognite.neat.core.
|
|
38
|
-
from cognite.neat.core.
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
from cognite.neat.core._data_model.models.entities import ClassEntity
|
|
32
|
+
from cognite.neat.core._issues import IssueList
|
|
33
|
+
from cognite.neat.core._issues.errors import (
|
|
34
|
+
PropertyTypeNotSupportedError,
|
|
35
|
+
ResourceMissingIdentifierError,
|
|
36
|
+
ResourceNotFoundError,
|
|
37
|
+
)
|
|
38
|
+
from cognite.neat.core._issues.warnings import (
|
|
39
|
+
PropertyTypeNotSupportedWarning,
|
|
40
|
+
ResourceTypeNotSupportedWarning,
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
class _DTDLConverter:
|
|
45
45
|
def __init__(self, issues: IssueList | None = None) -> None:
|
|
46
46
|
self.issues = IssueList(issues or [])
|
|
47
|
-
self.properties: list[
|
|
48
|
-
self.classes: list[
|
|
47
|
+
self.properties: list[UnverifiedConceptualProperty] = []
|
|
48
|
+
self.classes: list[UnverifiedConceptualClass] = []
|
|
49
49
|
self._item_by_id: dict[DTMI, DTDLBase] = {}
|
|
50
50
|
|
|
51
51
|
self._method_by_type = {
|
|
@@ -103,7 +103,7 @@ class _DTDLConverter:
|
|
|
103
103
|
)
|
|
104
104
|
|
|
105
105
|
def convert_interface(self, item: Interface, _: str | None) -> None:
|
|
106
|
-
class_ =
|
|
106
|
+
class_ = UnverifiedConceptualClass(
|
|
107
107
|
class_=item.id_.as_class_id(),
|
|
108
108
|
name=item.display_name,
|
|
109
109
|
description=item.description,
|
|
@@ -137,7 +137,7 @@ class _DTDLConverter:
|
|
|
137
137
|
if value_type is None:
|
|
138
138
|
return None
|
|
139
139
|
|
|
140
|
-
prop =
|
|
140
|
+
prop = UnverifiedConceptualProperty(
|
|
141
141
|
class_=ClassEntity.load(parent),
|
|
142
142
|
property_=item.name,
|
|
143
143
|
name=item.display_name,
|
|
@@ -182,7 +182,7 @@ class _DTDLConverter:
|
|
|
182
182
|
value_type = self.schema_to_value_type(item.request.schema_, item)
|
|
183
183
|
if value_type is None:
|
|
184
184
|
return
|
|
185
|
-
prop =
|
|
185
|
+
prop = UnverifiedConceptualProperty(
|
|
186
186
|
class_=ClassEntity.load(parent),
|
|
187
187
|
property_=item.name,
|
|
188
188
|
name=item.display_name,
|
|
@@ -201,7 +201,7 @@ class _DTDLConverter:
|
|
|
201
201
|
value_type = self.schema_to_value_type(item.schema_, item)
|
|
202
202
|
if value_type is None:
|
|
203
203
|
return
|
|
204
|
-
prop =
|
|
204
|
+
prop = UnverifiedConceptualProperty(
|
|
205
205
|
class_=ClassEntity.load(parent),
|
|
206
206
|
property_=item.name,
|
|
207
207
|
name=item.display_name,
|
|
@@ -230,7 +230,7 @@ class _DTDLConverter:
|
|
|
230
230
|
)
|
|
231
231
|
value_type = Json()
|
|
232
232
|
|
|
233
|
-
prop =
|
|
233
|
+
prop = UnverifiedConceptualProperty(
|
|
234
234
|
class_=ClassEntity.load(parent),
|
|
235
235
|
property_=item.name,
|
|
236
236
|
name=item.display_name,
|
|
@@ -254,7 +254,7 @@ class _DTDLConverter:
|
|
|
254
254
|
)
|
|
255
255
|
return None
|
|
256
256
|
|
|
257
|
-
class_ =
|
|
257
|
+
class_ = UnverifiedConceptualClass(
|
|
258
258
|
class_=item.id_.as_class_id(),
|
|
259
259
|
name=item.display_name,
|
|
260
260
|
description=item.description,
|
|
@@ -265,7 +265,7 @@ class _DTDLConverter:
|
|
|
265
265
|
value_type = self.schema_to_value_type(field_.schema_, item)
|
|
266
266
|
if value_type is None:
|
|
267
267
|
continue
|
|
268
|
-
prop =
|
|
268
|
+
prop = UnverifiedConceptualProperty(
|
|
269
269
|
class_=class_.class_,
|
|
270
270
|
name=field_.name,
|
|
271
271
|
description=field_.description,
|
|
@@ -5,6 +5,16 @@ from pathlib import Path
|
|
|
5
5
|
|
|
6
6
|
from pydantic import ValidationError
|
|
7
7
|
|
|
8
|
+
from cognite.neat.core._data_model._shared import ReadRules
|
|
9
|
+
from cognite.neat.core._data_model.importers._base import BaseImporter
|
|
10
|
+
from cognite.neat.core._data_model.importers._dtdl2rules.dtdl_converter import _DTDLConverter
|
|
11
|
+
from cognite.neat.core._data_model.importers._dtdl2rules.spec import (
|
|
12
|
+
DTDL_CLS_BY_TYPE_BY_SPEC,
|
|
13
|
+
DTDLBase,
|
|
14
|
+
Interface,
|
|
15
|
+
)
|
|
16
|
+
from cognite.neat.core._data_model.models import UnverifiedConceptualDataModel
|
|
17
|
+
from cognite.neat.core._data_model.models.conceptual import UnverifiedConceptualMetadata
|
|
8
18
|
from cognite.neat.core._issues import IssueList, MultiValueError, NeatIssue
|
|
9
19
|
from cognite.neat.core._issues.warnings import (
|
|
10
20
|
FileItemNotSupportedWarning,
|
|
@@ -13,20 +23,10 @@ from cognite.neat.core._issues.warnings import (
|
|
|
13
23
|
FileTypeUnexpectedWarning,
|
|
14
24
|
NeatValueWarning,
|
|
15
25
|
)
|
|
16
|
-
from cognite.neat.core._rules._shared import ReadRules
|
|
17
|
-
from cognite.neat.core._rules.importers._base import BaseImporter
|
|
18
|
-
from cognite.neat.core._rules.importers._dtdl2rules.dtdl_converter import _DTDLConverter
|
|
19
|
-
from cognite.neat.core._rules.importers._dtdl2rules.spec import (
|
|
20
|
-
DTDL_CLS_BY_TYPE_BY_SPEC,
|
|
21
|
-
DTDLBase,
|
|
22
|
-
Interface,
|
|
23
|
-
)
|
|
24
|
-
from cognite.neat.core._rules.models import InformationInputRules
|
|
25
|
-
from cognite.neat.core._rules.models.information import InformationInputMetadata
|
|
26
26
|
from cognite.neat.core._utils.text import humanize_collection, to_pascal_case
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
class DTDLImporter(BaseImporter[
|
|
29
|
+
class DTDLImporter(BaseImporter[UnverifiedConceptualDataModel]):
|
|
30
30
|
"""Importer from Azure Digital Twin - DTDL (Digital Twin Definition Language).
|
|
31
31
|
|
|
32
32
|
This importer supports DTDL v2.0 and v3.0.
|
|
@@ -126,7 +126,7 @@ class DTDLImporter(BaseImporter[InformationInputRules]):
|
|
|
126
126
|
items.append(item)
|
|
127
127
|
return cls(items, zip_file.stem, read_issues=issues)
|
|
128
128
|
|
|
129
|
-
def to_rules(self) -> ReadRules[
|
|
129
|
+
def to_rules(self) -> ReadRules[UnverifiedConceptualDataModel]:
|
|
130
130
|
converter = _DTDLConverter(self._read_issues)
|
|
131
131
|
|
|
132
132
|
converter.convert(self._items)
|
|
@@ -143,8 +143,8 @@ class DTDLImporter(BaseImporter[InformationInputRules]):
|
|
|
143
143
|
else:
|
|
144
144
|
metadata["space"] = most_common_prefix
|
|
145
145
|
|
|
146
|
-
rules =
|
|
147
|
-
metadata=
|
|
146
|
+
rules = UnverifiedConceptualDataModel(
|
|
147
|
+
metadata=UnverifiedConceptualMetadata.load(metadata),
|
|
148
148
|
properties=converter.properties,
|
|
149
149
|
classes=converter.classes,
|
|
150
150
|
)
|
|
@@ -15,7 +15,7 @@ from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeAlias
|
|
|
15
15
|
from pydantic import BaseModel, Field, field_validator, model_serializer, model_validator
|
|
16
16
|
from pydantic.fields import FieldInfo
|
|
17
17
|
|
|
18
|
-
from cognite.neat.core.
|
|
18
|
+
from cognite.neat.core._data_model.models.entities import ClassEntity
|
|
19
19
|
|
|
20
20
|
if TYPE_CHECKING:
|
|
21
21
|
from pydantic.type_adapter import IncEx
|
|
@@ -7,15 +7,17 @@ from rdflib import Graph, Namespace, URIRef
|
|
|
7
7
|
from typing_extensions import Self
|
|
8
8
|
|
|
9
9
|
from cognite.neat.core._constants import get_default_prefixes_and_namespaces
|
|
10
|
+
from cognite.neat.core._data_model._shared import ReadRules
|
|
11
|
+
from cognite.neat.core._data_model.importers._base import BaseImporter
|
|
12
|
+
from cognite.neat.core._data_model.models._base_verified import RoleTypes
|
|
13
|
+
from cognite.neat.core._data_model.models.conceptual import (
|
|
14
|
+
UnverifiedConceptualDataModel,
|
|
15
|
+
)
|
|
16
|
+
from cognite.neat.core._data_model.models.data_types import AnyURI
|
|
17
|
+
from cognite.neat.core._data_model.models.entities import UnknownEntity
|
|
10
18
|
from cognite.neat.core._issues import IssueList, MultiValueError
|
|
11
19
|
from cognite.neat.core._issues.errors import FileReadError
|
|
12
20
|
from cognite.neat.core._issues.errors._general import NeatValueError
|
|
13
|
-
from cognite.neat.core._rules._shared import ReadRules
|
|
14
|
-
from cognite.neat.core._rules.importers._base import BaseImporter
|
|
15
|
-
from cognite.neat.core._rules.models._base_rules import RoleTypes
|
|
16
|
-
from cognite.neat.core._rules.models.data_types import AnyURI
|
|
17
|
-
from cognite.neat.core._rules.models.entities import UnknownEntity
|
|
18
|
-
from cognite.neat.core._rules.models.information import InformationInputRules
|
|
19
21
|
from cognite.neat.core._store import NeatGraphStore
|
|
20
22
|
from cognite.neat.core._utils.rdf_ import get_namespace
|
|
21
23
|
|
|
@@ -25,7 +27,7 @@ DEFAULT_NON_EXISTING_NODE_TYPE = AnyURI()
|
|
|
25
27
|
DEFAULT_RDF_DATA_MODEL_ID = ("neat_space", "RDFDataModel", "rdf")
|
|
26
28
|
|
|
27
29
|
|
|
28
|
-
class BaseRDFImporter(BaseImporter[
|
|
30
|
+
class BaseRDFImporter(BaseImporter[UnverifiedConceptualDataModel]):
|
|
29
31
|
"""Baser RDF importers used for all rules importers that are using RDF as input.
|
|
30
32
|
|
|
31
33
|
Args:
|
|
@@ -115,7 +117,7 @@ class BaseRDFImporter(BaseImporter[InformationInputRules]):
|
|
|
115
117
|
|
|
116
118
|
def to_rules(
|
|
117
119
|
self,
|
|
118
|
-
) -> ReadRules[
|
|
120
|
+
) -> ReadRules[UnverifiedConceptualDataModel]:
|
|
119
121
|
"""
|
|
120
122
|
Creates `Rules` object from the data for target role.
|
|
121
123
|
"""
|
|
@@ -126,7 +128,7 @@ class BaseRDFImporter(BaseImporter[InformationInputRules]):
|
|
|
126
128
|
|
|
127
129
|
rules_dict = self._to_rules_components()
|
|
128
130
|
|
|
129
|
-
rules =
|
|
131
|
+
rules = UnverifiedConceptualDataModel.load(rules_dict)
|
|
130
132
|
self.issue_list.trigger_warnings()
|
|
131
133
|
return ReadRules(rules, {})
|
|
132
134
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""This module performs importing of various formats to one of serializations for which
|
|
2
2
|
there are loaders to TransformationRules pydantic class."""
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core.
|
|
5
|
-
from cognite.neat.core.
|
|
4
|
+
from cognite.neat.core._data_model.importers._rdf._base import BaseRDFImporter
|
|
5
|
+
from cognite.neat.core._data_model.importers._rdf._shared import (
|
|
6
6
|
parse_classes,
|
|
7
7
|
parse_properties,
|
|
8
8
|
)
|
|
@@ -12,18 +12,18 @@ from rdflib import Literal as RdfLiteral
|
|
|
12
12
|
|
|
13
13
|
from cognite.neat.core._config import GLOBAL_CONFIG
|
|
14
14
|
from cognite.neat.core._constants import NEAT, get_default_prefixes_and_namespaces
|
|
15
|
+
from cognite.neat.core._data_model.analysis import RulesAnalysis
|
|
16
|
+
from cognite.neat.core._data_model.models import ConceptualDataModel, data_types
|
|
17
|
+
from cognite.neat.core._data_model.models.conceptual import (
|
|
18
|
+
ConceptualClass,
|
|
19
|
+
ConceptualMetadata,
|
|
20
|
+
UnverifiedConceptualClass,
|
|
21
|
+
UnverifiedConceptualProperty,
|
|
22
|
+
)
|
|
23
|
+
from cognite.neat.core._data_model.models.data_types import AnyURI
|
|
24
|
+
from cognite.neat.core._data_model.models.entities._single_value import UnknownEntity
|
|
15
25
|
from cognite.neat.core._issues import IssueList
|
|
16
26
|
from cognite.neat.core._issues.warnings import PropertyValueTypeUndefinedWarning
|
|
17
|
-
from cognite.neat.core._rules.analysis import RulesAnalysis
|
|
18
|
-
from cognite.neat.core._rules.models import InformationRules, data_types
|
|
19
|
-
from cognite.neat.core._rules.models.data_types import AnyURI
|
|
20
|
-
from cognite.neat.core._rules.models.entities._single_value import UnknownEntity
|
|
21
|
-
from cognite.neat.core._rules.models.information import (
|
|
22
|
-
InformationClass,
|
|
23
|
-
InformationInputClass,
|
|
24
|
-
InformationInputProperty,
|
|
25
|
-
InformationMetadata,
|
|
26
|
-
)
|
|
27
27
|
from cognite.neat.core._store import NeatGraphStore
|
|
28
28
|
from cognite.neat.core._store._provenance import INSTANCES_ENTITY
|
|
29
29
|
from cognite.neat.core._utils.collection_ import iterate_progress_bar
|
|
@@ -272,7 +272,7 @@ class InferenceImporter(BaseRDFImporter):
|
|
|
272
272
|
|
|
273
273
|
def _default_metadata(self) -> dict[str, Any]:
|
|
274
274
|
now = datetime.now(timezone.utc)
|
|
275
|
-
return
|
|
275
|
+
return ConceptualMetadata(
|
|
276
276
|
space=self.data_model_id.space,
|
|
277
277
|
external_id=self.data_model_id.external_id,
|
|
278
278
|
version=cast(str, self.data_model_id.version),
|
|
@@ -357,7 +357,7 @@ class SubclassInferenceImporter(BaseRDFImporter):
|
|
|
357
357
|
self,
|
|
358
358
|
issue_list: IssueList,
|
|
359
359
|
graph: Graph,
|
|
360
|
-
rules:
|
|
360
|
+
rules: ConceptualDataModel | None = None,
|
|
361
361
|
data_model_id: dm.DataModelId | tuple[str, str, str] | None = None,
|
|
362
362
|
non_existing_node_type: UnknownEntity | AnyURI = DEFAULT_NON_EXISTING_NODE_TYPE,
|
|
363
363
|
) -> None:
|
|
@@ -399,13 +399,13 @@ class SubclassInferenceImporter(BaseRDFImporter):
|
|
|
399
399
|
|
|
400
400
|
def _create_classes_properties(
|
|
401
401
|
self, read_properties: list[_ReadProperties], prefixes: dict[str, Namespace]
|
|
402
|
-
) -> tuple[list[
|
|
402
|
+
) -> tuple[list[UnverifiedConceptualClass], list[UnverifiedConceptualProperty]]:
|
|
403
403
|
if self._rules:
|
|
404
404
|
existing_classes = {class_.class_.suffix: class_ for class_ in self._rules.classes}
|
|
405
405
|
else:
|
|
406
406
|
existing_classes = {}
|
|
407
|
-
classes: list[
|
|
408
|
-
properties_by_class_suffix_by_property_id: dict[str, dict[str,
|
|
407
|
+
classes: list[UnverifiedConceptualClass] = []
|
|
408
|
+
properties_by_class_suffix_by_property_id: dict[str, dict[str, UnverifiedConceptualProperty]] = {}
|
|
409
409
|
|
|
410
410
|
# Help for IDE
|
|
411
411
|
type_uri: URIRef
|
|
@@ -429,9 +429,9 @@ class SubclassInferenceImporter(BaseRDFImporter):
|
|
|
429
429
|
parent_suffix = remove_namespace_from_uri(parent_uri)
|
|
430
430
|
self._add_uri_namespace_to_prefixes(parent_uri, prefixes)
|
|
431
431
|
if parent_suffix not in existing_classes:
|
|
432
|
-
classes.append(
|
|
432
|
+
classes.append(UnverifiedConceptualClass(class_=parent_suffix))
|
|
433
433
|
else:
|
|
434
|
-
classes.append(
|
|
434
|
+
classes.append(UnverifiedConceptualClass.load(existing_classes[parent_suffix].model_dump()))
|
|
435
435
|
else:
|
|
436
436
|
shared_property_uris = set()
|
|
437
437
|
shared_properties: dict[URIRef, list[_ReadProperties]] = defaultdict(list)
|
|
@@ -441,16 +441,16 @@ class SubclassInferenceImporter(BaseRDFImporter):
|
|
|
441
441
|
|
|
442
442
|
if class_suffix not in existing_classes:
|
|
443
443
|
classes.append(
|
|
444
|
-
|
|
444
|
+
UnverifiedConceptualClass(
|
|
445
445
|
class_=class_suffix,
|
|
446
446
|
implements=parent_suffix,
|
|
447
447
|
instance_source=type_uri,
|
|
448
448
|
)
|
|
449
449
|
)
|
|
450
450
|
else:
|
|
451
|
-
classes.append(
|
|
451
|
+
classes.append(UnverifiedConceptualClass.load(existing_classes[class_suffix].model_dump()))
|
|
452
452
|
|
|
453
|
-
properties_by_id: dict[str,
|
|
453
|
+
properties_by_id: dict[str, UnverifiedConceptualProperty] = {}
|
|
454
454
|
for property_uri, read_properties in properties_by_property_uri.items():
|
|
455
455
|
if property_uri in shared_property_uris:
|
|
456
456
|
shared_properties[property_uri].extend(read_properties)
|
|
@@ -523,7 +523,7 @@ class SubclassInferenceImporter(BaseRDFImporter):
|
|
|
523
523
|
existing_class_properties = {}
|
|
524
524
|
existing_classes = {}
|
|
525
525
|
properties_by_class_by_subclass: list[_ReadProperties] = []
|
|
526
|
-
existing_class:
|
|
526
|
+
existing_class: ConceptualClass | None
|
|
527
527
|
total_instance_count = sum(count_by_type.values())
|
|
528
528
|
iterable = count_by_type.items()
|
|
529
529
|
if GLOBAL_CONFIG.use_iterate_bar_threshold and total_instance_count > GLOBAL_CONFIG.use_iterate_bar_threshold:
|
|
@@ -577,10 +577,10 @@ class SubclassInferenceImporter(BaseRDFImporter):
|
|
|
577
577
|
property_uri: URIRef,
|
|
578
578
|
property_id: str,
|
|
579
579
|
prefixes: dict[str, Namespace],
|
|
580
|
-
) ->
|
|
580
|
+
) -> UnverifiedConceptualProperty:
|
|
581
581
|
first = read_properties[0]
|
|
582
582
|
value_type = self._get_value_type(read_properties, prefixes)
|
|
583
|
-
return
|
|
583
|
+
return UnverifiedConceptualProperty(
|
|
584
584
|
class_=class_suffix,
|
|
585
585
|
property_=property_id,
|
|
586
586
|
max_count=first.max_occurrence,
|
|
@@ -606,7 +606,7 @@ class SubclassInferenceImporter(BaseRDFImporter):
|
|
|
606
606
|
|
|
607
607
|
def _default_metadata(self) -> dict[str, Any]:
|
|
608
608
|
now = datetime.now(timezone.utc)
|
|
609
|
-
return
|
|
609
|
+
return ConceptualMetadata(
|
|
610
610
|
space=self.data_model_id.space,
|
|
611
611
|
external_id=self.data_model_id.external_id,
|
|
612
612
|
version=cast(str, self.data_model_id.version),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""This module performs importing of various formats to one of serializations for which
|
|
2
2
|
there are loaders to TransformationRules pydantic class."""
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core.
|
|
5
|
-
from cognite.neat.core.
|
|
4
|
+
from cognite.neat.core._data_model.importers._rdf._base import BaseRDFImporter
|
|
5
|
+
from cognite.neat.core._data_model.importers._rdf._shared import (
|
|
6
6
|
parse_classes,
|
|
7
7
|
parse_properties,
|
|
8
8
|
)
|
|
@@ -9,10 +9,16 @@ from pathlib import Path
|
|
|
9
9
|
from typing import Literal, cast
|
|
10
10
|
|
|
11
11
|
import pandas as pd
|
|
12
|
-
from cognite.client.utils._importing import local_import
|
|
13
12
|
from pandas import ExcelFile
|
|
14
13
|
from rdflib import Namespace, URIRef
|
|
15
14
|
|
|
15
|
+
from cognite.neat.core._data_model._shared import ReadRules, T_InputRules
|
|
16
|
+
from cognite.neat.core._data_model.models import (
|
|
17
|
+
INPUT_RULES_BY_ROLE,
|
|
18
|
+
VERIFIED_RULES_BY_ROLE,
|
|
19
|
+
RoleTypes,
|
|
20
|
+
SchemaCompleteness,
|
|
21
|
+
)
|
|
16
22
|
from cognite.neat.core._issues import IssueList, MultiValueError
|
|
17
23
|
from cognite.neat.core._issues.errors import (
|
|
18
24
|
FileMissingRequiredFieldError,
|
|
@@ -20,13 +26,6 @@ from cognite.neat.core._issues.errors import (
|
|
|
20
26
|
FileReadError,
|
|
21
27
|
)
|
|
22
28
|
from cognite.neat.core._issues.warnings import FileMissingRequiredFieldWarning
|
|
23
|
-
from cognite.neat.core._rules._shared import ReadRules, T_InputRules
|
|
24
|
-
from cognite.neat.core._rules.models import (
|
|
25
|
-
INPUT_RULES_BY_ROLE,
|
|
26
|
-
VERIFIED_RULES_BY_ROLE,
|
|
27
|
-
RoleTypes,
|
|
28
|
-
SchemaCompleteness,
|
|
29
|
-
)
|
|
30
29
|
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead, read_individual_sheet
|
|
31
30
|
from cognite.neat.core._utils.text import humanize_collection
|
|
32
31
|
|
|
@@ -285,31 +284,3 @@ class ExcelImporter(BaseImporter[T_InputRules]):
|
|
|
285
284
|
@property
|
|
286
285
|
def source_uri(self) -> URIRef:
|
|
287
286
|
return URIRef(f"file://{self.filepath.name}")
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
class GoogleSheetImporter(BaseImporter[T_InputRules]):
|
|
291
|
-
"""Import rules from a Google Sheet.
|
|
292
|
-
|
|
293
|
-
.. warning::
|
|
294
|
-
|
|
295
|
-
This importer is experimental and may not work as expected.
|
|
296
|
-
|
|
297
|
-
Args:
|
|
298
|
-
sheet_id (str): The Google Sheet ID.
|
|
299
|
-
skiprows (int): The number of rows to skip when reading the Google Sheet.
|
|
300
|
-
"""
|
|
301
|
-
|
|
302
|
-
def __init__(self, sheet_id: str, skiprows: int = 1):
|
|
303
|
-
self.sheet_id = sheet_id
|
|
304
|
-
self.skiprows = skiprows
|
|
305
|
-
|
|
306
|
-
def to_rules(self) -> ReadRules[T_InputRules]:
|
|
307
|
-
raise NotImplementedError("Google Sheet Importer is not yet implemented.")
|
|
308
|
-
|
|
309
|
-
def _get_sheets(self) -> dict[str, pd.DataFrame]:
|
|
310
|
-
local_import("gspread", "google")
|
|
311
|
-
import gspread # type: ignore[import]
|
|
312
|
-
|
|
313
|
-
client_google = gspread.service_account()
|
|
314
|
-
google_sheet = client_google.open_by_key(self.sheet_id)
|
|
315
|
-
return {worksheet.title: pd.DataFrame(worksheet.get_all_records()) for worksheet in google_sheet.worksheets()}
|
|
@@ -3,6 +3,8 @@ from typing import Any, cast
|
|
|
3
3
|
|
|
4
4
|
import yaml
|
|
5
5
|
|
|
6
|
+
from cognite.neat.core._data_model._shared import ReadRules, T_InputRules
|
|
7
|
+
from cognite.neat.core._data_model.models import INPUT_RULES_BY_ROLE, RoleTypes
|
|
6
8
|
from cognite.neat.core._issues import IssueList, MultiValueError, NeatIssue
|
|
7
9
|
from cognite.neat.core._issues.errors import (
|
|
8
10
|
FileMissingRequiredFieldError,
|
|
@@ -12,8 +14,6 @@ from cognite.neat.core._issues.errors import (
|
|
|
12
14
|
FileTypeUnexpectedError,
|
|
13
15
|
)
|
|
14
16
|
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
15
|
-
from cognite.neat.core._rules._shared import ReadRules, T_InputRules
|
|
16
|
-
from cognite.neat.core._rules.models import INPUT_RULES_BY_ROLE, RoleTypes
|
|
17
17
|
|
|
18
18
|
from ._base import BaseImporter
|
|
19
19
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
2
|
+
from cognite.neat.core._data_model.models.conceptual._unverified import (
|
|
3
|
+
UnverifiedConceptualDataModel,
|
|
4
|
+
)
|
|
5
|
+
from cognite.neat.core._data_model.models.conceptual._verified import (
|
|
6
|
+
ConceptualDataModel,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from ._base_verified import DataModelType, ExtensionCategory, RoleTypes, SchemaCompleteness, SheetList, SheetRow
|
|
10
|
+
from .dms._rules import DMSRules
|
|
11
|
+
from .dms._rules_input import DMSInputRules
|
|
12
|
+
|
|
13
|
+
INPUT_RULES_BY_ROLE: dict[RoleTypes, type[UnverifiedConceptualDataModel] | type[DMSInputRules]] = {
|
|
14
|
+
RoleTypes.information: UnverifiedConceptualDataModel,
|
|
15
|
+
RoleTypes.dms: DMSInputRules,
|
|
16
|
+
}
|
|
17
|
+
VERIFIED_RULES_BY_ROLE: dict[RoleTypes, type[ConceptualDataModel] | type[DMSRules]] = {
|
|
18
|
+
RoleTypes.information: ConceptualDataModel,
|
|
19
|
+
RoleTypes.dms: DMSRules,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"INPUT_RULES_BY_ROLE",
|
|
25
|
+
"ConceptualDataModel",
|
|
26
|
+
"DMSInputRules",
|
|
27
|
+
"DMSRules",
|
|
28
|
+
"DMSSchema",
|
|
29
|
+
"DataModelType",
|
|
30
|
+
"ExtensionCategory",
|
|
31
|
+
"RoleTypes",
|
|
32
|
+
"SchemaCompleteness",
|
|
33
|
+
"SheetList",
|
|
34
|
+
"SheetRow",
|
|
35
|
+
"UnverifiedConceptualDataModel",
|
|
36
|
+
]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"""Module for base classes for the
|
|
1
|
+
"""Module for base classes for the unverified models.
|
|
2
2
|
|
|
3
|
-
The philosophy of the
|
|
3
|
+
The philosophy of the unverified data models is:
|
|
4
4
|
|
|
5
|
-
* Provide an easy way to
|
|
6
|
-
Enum.
|
|
5
|
+
* Provide an easy way to read data model into neat. The type hints are made to be human-friendly,
|
|
6
|
+
for example, Literal instead of Enum.
|
|
7
7
|
* The .dump() method should fill out defaults and have shortcuts. For example, if the prefix is not provided for
|
|
8
8
|
a class, then the prefix from the metadata is used. For views, if the class is not provided, it is assumed to
|
|
9
9
|
be the same as the view.
|
|
10
10
|
|
|
11
|
-
The base classes are to make it easy to create the
|
|
12
|
-
testing to ensure that
|
|
11
|
+
The base classes are to make it easy to create the unverified data models with default behavior.
|
|
12
|
+
They are also used for testing to ensure that unverified models correctly map to the verified models.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
import sys
|
|
@@ -20,19 +20,19 @@ from typing import Any, Generic, TypeVar, Union, cast, get_args, get_origin, ove
|
|
|
20
20
|
|
|
21
21
|
import pandas as pd
|
|
22
22
|
|
|
23
|
-
from .
|
|
23
|
+
from ._base_verified import BaseVerifiedDataModel, SchemaModel
|
|
24
24
|
|
|
25
25
|
if sys.version_info >= (3, 11):
|
|
26
26
|
from typing import Self
|
|
27
27
|
else:
|
|
28
28
|
from typing_extensions import Self
|
|
29
29
|
|
|
30
|
-
T_BaseRules = TypeVar("T_BaseRules", bound=
|
|
30
|
+
T_BaseRules = TypeVar("T_BaseRules", bound=BaseVerifiedDataModel)
|
|
31
31
|
T_RuleModel = TypeVar("T_RuleModel", bound=SchemaModel)
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
@dataclass
|
|
35
|
-
class
|
|
35
|
+
class UnverifiedDataModel(Generic[T_BaseRules], ABC):
|
|
36
36
|
"""Input rules are raw data that is not yet validated."""
|
|
37
37
|
|
|
38
38
|
@classmethod
|
|
@@ -127,11 +127,11 @@ class InputRules(Generic[T_BaseRules], ABC):
|
|
|
127
127
|
return output
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
T_InputRules = TypeVar("T_InputRules", bound=
|
|
130
|
+
T_InputRules = TypeVar("T_InputRules", bound=UnverifiedDataModel)
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
@dataclass
|
|
134
|
-
class
|
|
134
|
+
class UnverifiedComponent(ABC, Generic[T_RuleModel]):
|
|
135
135
|
@classmethod
|
|
136
136
|
@abstractmethod
|
|
137
137
|
def _get_verified_cls(cls) -> type[T_RuleModel]:
|
|
@@ -27,7 +27,7 @@ from pydantic_core import core_schema
|
|
|
27
27
|
from rdflib import Namespace, URIRef
|
|
28
28
|
|
|
29
29
|
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
30
|
-
from cognite.neat.core.
|
|
30
|
+
from cognite.neat.core._data_model.models._types import (
|
|
31
31
|
ContainerEntityType,
|
|
32
32
|
DataModelExternalIdType,
|
|
33
33
|
DmsPropertyType,
|
|
@@ -37,8 +37,8 @@ from cognite.neat.core._rules.models._types import (
|
|
|
37
37
|
VersionType,
|
|
38
38
|
ViewEntityType,
|
|
39
39
|
)
|
|
40
|
-
from cognite.neat.core.
|
|
41
|
-
from cognite.neat.core.
|
|
40
|
+
from cognite.neat.core._data_model.models.data_types import DataType
|
|
41
|
+
from cognite.neat.core._data_model.models.entities import (
|
|
42
42
|
EdgeEntity,
|
|
43
43
|
ReverseConnectionEntity,
|
|
44
44
|
ViewEntity,
|
|
@@ -99,7 +99,7 @@ class DataModelType(StrEnum):
|
|
|
99
99
|
enterprise = "enterprise"
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
class
|
|
102
|
+
class DataModelLevel(StrEnum):
|
|
103
103
|
conceptual = "conceptual"
|
|
104
104
|
logical = "logical"
|
|
105
105
|
physical = "physical"
|
|
@@ -134,13 +134,13 @@ class SchemaModel(BaseModel):
|
|
|
134
134
|
return value
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
class
|
|
137
|
+
class BaseVerifiedMetadata(SchemaModel):
|
|
138
138
|
"""
|
|
139
139
|
Metadata model for data model
|
|
140
140
|
"""
|
|
141
141
|
|
|
142
142
|
role: ClassVar[RoleTypes] = Field(description="Role of the person creating the data model")
|
|
143
|
-
|
|
143
|
+
level: ClassVar[DataModelLevel] = Field(description="Aspect of the data model")
|
|
144
144
|
space: SpaceType = Field(description="The space where the data model is defined")
|
|
145
145
|
external_id: DataModelExternalIdType = Field(
|
|
146
146
|
alias="externalId", description="External identifier for the data model"
|
|
@@ -223,7 +223,7 @@ class BaseMetadata(SchemaModel):
|
|
|
223
223
|
Unlike namespace, the identifier does not end with "/" or "#".
|
|
224
224
|
|
|
225
225
|
"""
|
|
226
|
-
return DEFAULT_NAMESPACE[f"data-model/verified/{self.
|
|
226
|
+
return DEFAULT_NAMESPACE[f"data-model/verified/{self.level}/{self.space}/{self.external_id}/{self.version}"]
|
|
227
227
|
|
|
228
228
|
@property
|
|
229
229
|
def namespace(self) -> Namespace:
|
|
@@ -237,7 +237,7 @@ class BaseMetadata(SchemaModel):
|
|
|
237
237
|
return repr(self.as_data_model_id())
|
|
238
238
|
|
|
239
239
|
@classmethod
|
|
240
|
-
def default(cls) -> "
|
|
240
|
+
def default(cls) -> "BaseVerifiedMetadata":
|
|
241
241
|
"""Returns a default instance of the metadata model."""
|
|
242
242
|
now = datetime.now()
|
|
243
243
|
return cls(
|
|
@@ -252,7 +252,7 @@ class BaseMetadata(SchemaModel):
|
|
|
252
252
|
)
|
|
253
253
|
|
|
254
254
|
|
|
255
|
-
class
|
|
255
|
+
class BaseVerifiedDataModel(SchemaModel, ABC):
|
|
256
256
|
"""
|
|
257
257
|
Rules is a core concept in `neat`. This represents fusion of data model
|
|
258
258
|
definitions and (optionally) the transformation rules used to transform the data/graph
|
|
@@ -265,7 +265,7 @@ class BaseRules(SchemaModel, ABC):
|
|
|
265
265
|
metadata: Data model metadata
|
|
266
266
|
"""
|
|
267
267
|
|
|
268
|
-
metadata:
|
|
268
|
+
metadata: BaseVerifiedMetadata
|
|
269
269
|
|
|
270
270
|
@classmethod
|
|
271
271
|
def headers_by_sheet(cls, by_alias: bool = False) -> dict[str, list[str]]:
|