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
cognite/neat/_version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.121.
|
|
1
|
+
__version__ = "0.121.1"
|
|
2
2
|
__engine__ = "^2.0.4"
|
cognite/neat/core/_constants.py
CHANGED
|
@@ -12,7 +12,7 @@ from cognite import neat
|
|
|
12
12
|
from cognite.neat.core._issues.errors._general import NeatValueError
|
|
13
13
|
|
|
14
14
|
if TYPE_CHECKING:
|
|
15
|
-
from cognite.neat.core.
|
|
15
|
+
from cognite.neat.core._data_model.models.dms import DMSProperty
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def _is_in_notebook() -> bool:
|
|
@@ -198,7 +198,7 @@ BASE_MODEL = Literal["CogniteCore"]
|
|
|
198
198
|
|
|
199
199
|
def get_asset_read_only_properties_with_connection() -> "list[DMSProperty]":
|
|
200
200
|
"""Gets the asset read-only properties with connection, i.e. Root and Path."""
|
|
201
|
-
from cognite.neat.core.
|
|
201
|
+
from cognite.neat.core._data_model.models.dms import DMSProperty
|
|
202
202
|
|
|
203
203
|
return [DMSProperty.model_validate(item) for item in (_ASSET_ROOT_PROPERTY, _ASSET_PATH_PROPERTY)]
|
|
204
204
|
|
|
@@ -18,7 +18,7 @@ class EntityTypes(StrEnum):
|
|
|
18
18
|
parent_class = "parent_class"
|
|
19
19
|
property_ = "property"
|
|
20
20
|
dms_property = "dms_property"
|
|
21
|
-
|
|
21
|
+
conceptual_property = "conceptual_property"
|
|
22
22
|
object_property = "ObjectProperty"
|
|
23
23
|
data_property = "DatatypeProperty"
|
|
24
24
|
annotation_property = "AnnotationProperty"
|
|
@@ -161,7 +161,7 @@ class _Patterns:
|
|
|
161
161
|
if entity == EntityTypes.class_:
|
|
162
162
|
return self.class_id_compliance
|
|
163
163
|
|
|
164
|
-
elif entity == EntityTypes.
|
|
164
|
+
elif entity == EntityTypes.conceptual_property:
|
|
165
165
|
return self.information_property_id_compliance
|
|
166
166
|
|
|
167
167
|
elif entity == EntityTypes.view:
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic, TypeAlias, TypeVar
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core.
|
|
4
|
+
from cognite.neat.core._data_model.models import (
|
|
5
|
+
ConceptualDataModel,
|
|
5
6
|
DMSRules,
|
|
6
|
-
InformationRules,
|
|
7
7
|
)
|
|
8
|
-
from cognite.neat.core.
|
|
9
|
-
|
|
10
|
-
InformationInputRules,
|
|
8
|
+
from cognite.neat.core._data_model.models.conceptual._unverified import (
|
|
9
|
+
UnverifiedConceptualDataModel,
|
|
11
10
|
)
|
|
11
|
+
from cognite.neat.core._data_model.models.dms._rules_input import DMSInputRules
|
|
12
12
|
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead
|
|
13
13
|
|
|
14
|
-
VerifiedRules: TypeAlias =
|
|
14
|
+
VerifiedRules: TypeAlias = ConceptualDataModel | DMSRules
|
|
15
15
|
|
|
16
16
|
T_VerifiedRules = TypeVar("T_VerifiedRules", bound=VerifiedRules)
|
|
17
|
-
InputRules: TypeAlias = DMSInputRules |
|
|
17
|
+
InputRules: TypeAlias = DMSInputRules | UnverifiedConceptualDataModel
|
|
18
18
|
T_InputRules = TypeVar("T_InputRules", bound=InputRules)
|
|
19
19
|
|
|
20
20
|
|
|
@@ -36,8 +36,8 @@ class ReadRules(Generic[T_InputRules]):
|
|
|
36
36
|
return self.rules.display_name
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
ReadInputRules: TypeAlias = ReadRules[DMSInputRules] | ReadRules[
|
|
39
|
+
ReadInputRules: TypeAlias = ReadRules[DMSInputRules] | ReadRules[UnverifiedConceptualDataModel]
|
|
40
40
|
T_ReadInputRules = TypeVar("T_ReadInputRules", bound=ReadInputRules)
|
|
41
41
|
|
|
42
|
-
Rules: TypeAlias =
|
|
42
|
+
Rules: TypeAlias = ConceptualDataModel | DMSRules | ReadRules[DMSInputRules] | ReadRules[UnverifiedConceptualDataModel]
|
|
43
43
|
T_Rules = TypeVar("T_Rules", bound=Rules)
|
|
@@ -11,23 +11,23 @@ import pandas as pd
|
|
|
11
11
|
from cognite.client import data_modeling as dm
|
|
12
12
|
from rdflib import URIRef
|
|
13
13
|
|
|
14
|
-
from cognite.neat.core.
|
|
15
|
-
from cognite.neat.core.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
from cognite.neat.core.
|
|
14
|
+
from cognite.neat.core._data_model.models import ConceptualDataModel, DMSRules
|
|
15
|
+
from cognite.neat.core._data_model.models.conceptual import (
|
|
16
|
+
ConceptualClass,
|
|
17
|
+
ConceptualProperty,
|
|
18
|
+
)
|
|
19
|
+
from cognite.neat.core._data_model.models.dms import DMSProperty
|
|
20
|
+
from cognite.neat.core._data_model.models.dms._rules import DMSView
|
|
21
|
+
from cognite.neat.core._data_model.models.entities import (
|
|
20
22
|
ClassEntity,
|
|
21
23
|
MultiValueTypeInfo,
|
|
22
24
|
ViewEntity,
|
|
23
25
|
)
|
|
24
|
-
from cognite.neat.core.
|
|
26
|
+
from cognite.neat.core._data_model.models.entities._single_value import (
|
|
25
27
|
UnknownEntity,
|
|
26
28
|
)
|
|
27
|
-
from cognite.neat.core.
|
|
28
|
-
|
|
29
|
-
InformationProperty,
|
|
30
|
-
)
|
|
29
|
+
from cognite.neat.core._issues.errors import NeatValueError
|
|
30
|
+
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
31
31
|
|
|
32
32
|
T_Hashable = TypeVar("T_Hashable", bound=Hashable)
|
|
33
33
|
|
|
@@ -111,12 +111,16 @@ class ViewQueryDict(dict, MutableMapping[dm.ViewId, ViewQuery]):
|
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
class RulesAnalysis:
|
|
114
|
-
def __init__(
|
|
114
|
+
def __init__(
|
|
115
|
+
self,
|
|
116
|
+
information: ConceptualDataModel | None = None,
|
|
117
|
+
dms: DMSRules | None = None,
|
|
118
|
+
) -> None:
|
|
115
119
|
self._information = information
|
|
116
120
|
self._dms = dms
|
|
117
121
|
|
|
118
122
|
@property
|
|
119
|
-
def information(self) ->
|
|
123
|
+
def information(self) -> ConceptualDataModel:
|
|
120
124
|
if self._information is None:
|
|
121
125
|
raise NeatValueError("Information rules are required for this analysis")
|
|
122
126
|
return self._information
|
|
@@ -171,7 +175,7 @@ class RulesAnalysis:
|
|
|
171
175
|
|
|
172
176
|
def properties_by_class(
|
|
173
177
|
self, include_ancestors: bool = False, include_different_space: bool = False
|
|
174
|
-
) -> dict[ClassEntity, list[
|
|
178
|
+
) -> dict[ClassEntity, list[ConceptualProperty]]:
|
|
175
179
|
"""Get a dictionary of classes and their properties.
|
|
176
180
|
|
|
177
181
|
Args:
|
|
@@ -182,7 +186,7 @@ class RulesAnalysis:
|
|
|
182
186
|
dict[ClassEntity, list[InformationProperty]]: Values properties with class as key.
|
|
183
187
|
|
|
184
188
|
"""
|
|
185
|
-
properties_by_classes: dict[ClassEntity, list[
|
|
189
|
+
properties_by_classes: dict[ClassEntity, list[ConceptualProperty]] = defaultdict(list)
|
|
186
190
|
for prop in self.information.properties:
|
|
187
191
|
properties_by_classes[prop.class_].append(prop)
|
|
188
192
|
|
|
@@ -268,16 +272,16 @@ class RulesAnalysis:
|
|
|
268
272
|
}
|
|
269
273
|
|
|
270
274
|
@property
|
|
271
|
-
def _class_by_neat_id(self) -> dict[URIRef,
|
|
275
|
+
def _class_by_neat_id(self) -> dict[URIRef, ConceptualClass]:
|
|
272
276
|
"""Get a dictionary of class neat IDs to
|
|
273
277
|
class entities."""
|
|
274
278
|
|
|
275
279
|
return {cls.neatId: cls for cls in self.information.classes if cls.neatId}
|
|
276
280
|
|
|
277
|
-
def class_by_suffix(self) -> dict[str,
|
|
281
|
+
def class_by_suffix(self) -> dict[str, ConceptualClass]:
|
|
278
282
|
"""Get a dictionary of class suffixes to class entities."""
|
|
279
283
|
# TODO: Remove this method
|
|
280
|
-
class_dict: dict[str,
|
|
284
|
+
class_dict: dict[str, ConceptualClass] = {}
|
|
281
285
|
for definition in self.information.classes:
|
|
282
286
|
entity = definition.class_
|
|
283
287
|
if entity.suffix in class_dict:
|
|
@@ -293,7 +297,7 @@ class RulesAnalysis:
|
|
|
293
297
|
return class_dict
|
|
294
298
|
|
|
295
299
|
@property
|
|
296
|
-
def class_by_class_entity(self) -> dict[ClassEntity,
|
|
300
|
+
def class_by_class_entity(self) -> dict[ClassEntity, ConceptualClass]:
|
|
297
301
|
"""Get a dictionary of class entities to class entities."""
|
|
298
302
|
rules = self.information
|
|
299
303
|
return {cls.class_: cls for cls in rules.classes}
|
|
@@ -304,9 +308,9 @@ class RulesAnalysis:
|
|
|
304
308
|
rules = self.dms
|
|
305
309
|
return {view.view: view for view in rules.views}
|
|
306
310
|
|
|
307
|
-
def property_by_id(self) -> dict[str, list[
|
|
311
|
+
def property_by_id(self) -> dict[str, list[ConceptualProperty]]:
|
|
308
312
|
"""Get a dictionary of property IDs to property entities."""
|
|
309
|
-
property_dict: dict[str, list[
|
|
313
|
+
property_dict: dict[str, list[ConceptualProperty]] = defaultdict(list)
|
|
310
314
|
for prop in self.information.properties:
|
|
311
315
|
property_dict[prop.property_].append(prop)
|
|
312
316
|
return property_dict
|
|
@@ -315,11 +319,11 @@ class RulesAnalysis:
|
|
|
315
319
|
self,
|
|
316
320
|
has_instance_source: bool = False,
|
|
317
321
|
include_ancestors: bool = False,
|
|
318
|
-
) -> dict[ClassEntity, dict[str,
|
|
322
|
+
) -> dict[ClassEntity, dict[str, ConceptualProperty]]:
|
|
319
323
|
"""Get a dictionary of class entities to dictionaries of property IDs to property entities."""
|
|
320
|
-
class_property_pairs: dict[ClassEntity, dict[str,
|
|
324
|
+
class_property_pairs: dict[ClassEntity, dict[str, ConceptualProperty]] = {}
|
|
321
325
|
for class_, properties in self.properties_by_class(include_ancestors).items():
|
|
322
|
-
processed_properties: dict[str,
|
|
326
|
+
processed_properties: dict[str, ConceptualProperty] = {}
|
|
323
327
|
for prop in properties:
|
|
324
328
|
if prop.property_ in processed_properties:
|
|
325
329
|
warnings.warn(
|
|
@@ -372,7 +376,7 @@ class RulesAnalysis:
|
|
|
372
376
|
|
|
373
377
|
properties_by_class = self.properties_by_class(include_ancestors)
|
|
374
378
|
|
|
375
|
-
prop:
|
|
379
|
+
prop: ConceptualProperty
|
|
376
380
|
for prop in itertools.chain.from_iterable(properties_by_class.values()):
|
|
377
381
|
if not isinstance(prop.value_type, ClassEntity):
|
|
378
382
|
continue
|
|
@@ -419,14 +423,14 @@ class RulesAnalysis:
|
|
|
419
423
|
return sym_pairs
|
|
420
424
|
|
|
421
425
|
@overload
|
|
422
|
-
def _properties_by_neat_id(self, format: Literal["info"] = "info") -> dict[URIRef,
|
|
426
|
+
def _properties_by_neat_id(self, format: Literal["info"] = "info") -> dict[URIRef, ConceptualProperty]: ...
|
|
423
427
|
|
|
424
428
|
@overload
|
|
425
429
|
def _properties_by_neat_id(self, format: Literal["dms"] = "dms") -> dict[URIRef, DMSProperty]: ...
|
|
426
430
|
|
|
427
431
|
def _properties_by_neat_id(
|
|
428
432
|
self, format: Literal["info", "dms"] = "info"
|
|
429
|
-
) -> dict[URIRef,
|
|
433
|
+
) -> dict[URIRef, ConceptualProperty] | dict[URIRef, DMSProperty]:
|
|
430
434
|
if format == "info":
|
|
431
435
|
return {prop.neatId: prop for prop in self.information.properties if prop.neatId}
|
|
432
436
|
elif format == "dms":
|
|
@@ -435,11 +439,11 @@ class RulesAnalysis:
|
|
|
435
439
|
raise NeatValueError(f"Invalid format: {format}")
|
|
436
440
|
|
|
437
441
|
@property
|
|
438
|
-
def classes_by_neat_id(self) -> dict[URIRef,
|
|
442
|
+
def classes_by_neat_id(self) -> dict[URIRef, ConceptualClass]:
|
|
439
443
|
return {class_.neatId: class_ for class_ in self.information.classes if class_.neatId}
|
|
440
444
|
|
|
441
445
|
@property
|
|
442
|
-
def multi_value_properties(self) -> list[
|
|
446
|
+
def multi_value_properties(self) -> list[ConceptualProperty]:
|
|
443
447
|
return [prop_ for prop_ in self.information.properties if isinstance(prop_.value_type, MultiValueTypeInfo)]
|
|
444
448
|
|
|
445
449
|
@property
|
|
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Generic, TypeVar, Union, get_args, get_origin
|
|
|
7
7
|
|
|
8
8
|
from cognite.neat.core._client import NeatClient
|
|
9
9
|
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
10
|
-
from cognite.neat.core.
|
|
10
|
+
from cognite.neat.core._data_model._shared import T_VerifiedRules
|
|
11
11
|
from cognite.neat.core._utils.auxiliary import class_html_doc
|
|
12
12
|
from cognite.neat.core._utils.upload import UploadResult, UploadResultList
|
|
13
13
|
|
|
@@ -28,12 +28,12 @@ from cognite.neat.core._client.data_classes.data_modeling import (
|
|
|
28
28
|
ViewApplyDict,
|
|
29
29
|
)
|
|
30
30
|
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
31
|
+
from cognite.neat.core._data_model.models.dms import DMSRules
|
|
31
32
|
from cognite.neat.core._issues import IssueList
|
|
32
33
|
from cognite.neat.core._issues.warnings import (
|
|
33
34
|
PrincipleOneModelOneSpaceWarning,
|
|
34
35
|
ResourceRetrievalWarning,
|
|
35
36
|
)
|
|
36
|
-
from cognite.neat.core._rules.models.dms import DMSRules
|
|
37
37
|
from cognite.neat.core._shared import T_ID
|
|
38
38
|
from cognite.neat.core._utils.upload import UploadResult
|
|
39
39
|
|
|
@@ -15,17 +15,22 @@ from openpyxl.worksheet.worksheet import Worksheet
|
|
|
15
15
|
from rdflib import Namespace
|
|
16
16
|
|
|
17
17
|
from cognite.neat.core._constants import BASE_MODEL, get_base_concepts
|
|
18
|
-
from cognite.neat.core.
|
|
19
|
-
from cognite.neat.core.
|
|
20
|
-
from cognite.neat.core.
|
|
18
|
+
from cognite.neat.core._data_model._constants import get_internal_properties
|
|
19
|
+
from cognite.neat.core._data_model._shared import VerifiedRules
|
|
20
|
+
from cognite.neat.core._data_model.models import (
|
|
21
21
|
SheetRow,
|
|
22
22
|
)
|
|
23
|
-
from cognite.neat.core.
|
|
24
|
-
|
|
23
|
+
from cognite.neat.core._data_model.models._base_verified import (
|
|
24
|
+
BaseVerifiedMetadata,
|
|
25
|
+
RoleTypes,
|
|
26
|
+
)
|
|
27
|
+
from cognite.neat.core._data_model.models.conceptual._verified import (
|
|
28
|
+
ConceptualDataModel,
|
|
29
|
+
)
|
|
30
|
+
from cognite.neat.core._data_model.models.data_types import (
|
|
25
31
|
_DATA_TYPE_BY_DMS_TYPE,
|
|
26
32
|
)
|
|
27
|
-
from cognite.neat.core.
|
|
28
|
-
from cognite.neat.core._rules.models.information._rules import InformationRules
|
|
33
|
+
from cognite.neat.core._data_model.models.dms._rules import DMSRules
|
|
29
34
|
from cognite.neat.core._utils.spreadsheet import (
|
|
30
35
|
find_column_with_value,
|
|
31
36
|
generate_data_validation,
|
|
@@ -140,14 +145,14 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
|
|
|
140
145
|
# Remove default sheet named "Sheet"
|
|
141
146
|
workbook.remove(workbook["Sheet"])
|
|
142
147
|
|
|
143
|
-
rules_model = DMSRules if role == RoleTypes.dms else
|
|
148
|
+
rules_model = DMSRules if role == RoleTypes.dms else ConceptualDataModel
|
|
144
149
|
|
|
145
150
|
headers_by_sheet = rules_model.headers_by_sheet(by_alias=True)
|
|
146
151
|
headers_by_sheet.pop("Metadata")
|
|
147
152
|
|
|
148
153
|
self._write_metadata_sheet(
|
|
149
154
|
workbook,
|
|
150
|
-
cast(
|
|
155
|
+
cast(BaseVerifiedMetadata, rules_model.model_fields["metadata"].annotation).default().model_dump(),
|
|
151
156
|
)
|
|
152
157
|
|
|
153
158
|
for sheet_name, headers in headers_by_sheet.items():
|
|
@@ -185,7 +190,7 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
|
|
|
185
190
|
self._write_sheets(workbook, dumped_reference_rules, reference_rules, sheet_prefix=prefix)
|
|
186
191
|
self._write_metadata_sheet(workbook, dumped_reference_rules["Metadata"], sheet_prefix=prefix)
|
|
187
192
|
|
|
188
|
-
if isinstance(rules,
|
|
193
|
+
if isinstance(rules, ConceptualDataModel) and rules.prefixes:
|
|
189
194
|
self._write_prefixes_sheet(workbook, rules.prefixes)
|
|
190
195
|
|
|
191
196
|
if self._styling_level > 0:
|
|
@@ -8,15 +8,17 @@ from openpyxl.styles import Alignment, Border, Font, NamedStyle, PatternFill, Si
|
|
|
8
8
|
from openpyxl.utils import get_column_letter
|
|
9
9
|
from openpyxl.worksheet.datavalidation import DataValidation
|
|
10
10
|
|
|
11
|
-
from cognite.neat.core.
|
|
12
|
-
from cognite.neat.core.
|
|
13
|
-
from cognite.neat.core.
|
|
14
|
-
|
|
11
|
+
from cognite.neat.core._data_model._constants import EntityTypes
|
|
12
|
+
from cognite.neat.core._data_model.analysis import RulesAnalysis
|
|
13
|
+
from cognite.neat.core._data_model.models.conceptual._verified import (
|
|
14
|
+
ConceptualDataModel,
|
|
15
|
+
)
|
|
16
|
+
from cognite.neat.core._data_model.models.entities._single_value import ClassEntity
|
|
15
17
|
|
|
16
18
|
from ._base import BaseExporter
|
|
17
19
|
|
|
18
20
|
|
|
19
|
-
class InstanceTemplateExporter(BaseExporter[
|
|
21
|
+
class InstanceTemplateExporter(BaseExporter[ConceptualDataModel, Workbook]):
|
|
20
22
|
"""
|
|
21
23
|
Converts Information Rules to a templated spreadsheet meant for capturing
|
|
22
24
|
instances based on class definitions in the rules.
|
|
@@ -48,7 +50,7 @@ class InstanceTemplateExporter(BaseExporter[InformationRules, Workbook]):
|
|
|
48
50
|
|
|
49
51
|
def export(
|
|
50
52
|
self,
|
|
51
|
-
rules:
|
|
53
|
+
rules: ConceptualDataModel,
|
|
52
54
|
) -> Workbook:
|
|
53
55
|
workbook = Workbook()
|
|
54
56
|
|
|
@@ -83,7 +85,7 @@ class InstanceTemplateExporter(BaseExporter[InformationRules, Workbook]):
|
|
|
83
85
|
|
|
84
86
|
return workbook
|
|
85
87
|
|
|
86
|
-
def export_to_file(self, rules:
|
|
88
|
+
def export_to_file(self, rules: ConceptualDataModel, filepath: Path) -> None:
|
|
87
89
|
"""Exports graph capturing sheet to excel file."""
|
|
88
90
|
data = self.export(rules)
|
|
89
91
|
try:
|
|
@@ -9,21 +9,21 @@ from rdflib import DCTERMS, OWL, RDF, RDFS, XSD, BNode, Graph, Literal, Namespac
|
|
|
9
9
|
from rdflib.collection import Collection as GraphCollection
|
|
10
10
|
|
|
11
11
|
from cognite.neat.core._constants import DEFAULT_NAMESPACE as NEAT_NAMESPACE
|
|
12
|
+
from cognite.neat.core._data_model._constants import EntityTypes
|
|
13
|
+
from cognite.neat.core._data_model.analysis import RulesAnalysis
|
|
14
|
+
from cognite.neat.core._data_model.models.conceptual import (
|
|
15
|
+
ConceptualClass,
|
|
16
|
+
ConceptualDataModel,
|
|
17
|
+
ConceptualMetadata,
|
|
18
|
+
ConceptualProperty,
|
|
19
|
+
)
|
|
20
|
+
from cognite.neat.core._data_model.models.data_types import DataType
|
|
21
|
+
from cognite.neat.core._data_model.models.entities import ClassEntity
|
|
12
22
|
from cognite.neat.core._issues import MultiValueError
|
|
13
23
|
from cognite.neat.core._issues.errors import (
|
|
14
24
|
PropertyDefinitionDuplicatedError,
|
|
15
25
|
)
|
|
16
26
|
from cognite.neat.core._issues.warnings import PropertyDefinitionDuplicatedWarning
|
|
17
|
-
from cognite.neat.core._rules._constants import EntityTypes
|
|
18
|
-
from cognite.neat.core._rules.analysis import RulesAnalysis
|
|
19
|
-
from cognite.neat.core._rules.models.data_types import DataType
|
|
20
|
-
from cognite.neat.core._rules.models.entities import ClassEntity
|
|
21
|
-
from cognite.neat.core._rules.models.information import (
|
|
22
|
-
InformationClass,
|
|
23
|
-
InformationMetadata,
|
|
24
|
-
InformationProperty,
|
|
25
|
-
InformationRules,
|
|
26
|
-
)
|
|
27
27
|
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri
|
|
28
28
|
|
|
29
29
|
from ._base import BaseExporter
|
|
@@ -35,15 +35,15 @@ else:
|
|
|
35
35
|
from typing_extensions import Self
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
class GraphExporter(BaseExporter[
|
|
39
|
-
def export_to_file(self, rules:
|
|
38
|
+
class GraphExporter(BaseExporter[ConceptualDataModel, Graph], ABC):
|
|
39
|
+
def export_to_file(self, rules: ConceptualDataModel, filepath: Path) -> None:
|
|
40
40
|
self.export(rules).serialize(destination=filepath, encoding=self._encoding, newline=self._new_line)
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
class OWLExporter(GraphExporter):
|
|
44
44
|
"""Exports verified information rules to an OWL ontology."""
|
|
45
45
|
|
|
46
|
-
def export(self, rules:
|
|
46
|
+
def export(self, rules: ConceptualDataModel) -> Graph:
|
|
47
47
|
return Ontology.from_rules(rules).as_owl()
|
|
48
48
|
|
|
49
49
|
@property
|
|
@@ -54,7 +54,7 @@ class OWLExporter(GraphExporter):
|
|
|
54
54
|
class SHACLExporter(GraphExporter):
|
|
55
55
|
"""Exports rules to a SHACL graph."""
|
|
56
56
|
|
|
57
|
-
def export(self, rules:
|
|
57
|
+
def export(self, rules: ConceptualDataModel) -> Graph:
|
|
58
58
|
return Ontology.from_rules(rules).as_shacl()
|
|
59
59
|
|
|
60
60
|
@property
|
|
@@ -65,7 +65,7 @@ class SHACLExporter(GraphExporter):
|
|
|
65
65
|
class SemanticDataModelExporter(GraphExporter):
|
|
66
66
|
"""Exports verified information model to a semantic data model."""
|
|
67
67
|
|
|
68
|
-
def export(self, rules:
|
|
68
|
+
def export(self, rules: ConceptualDataModel) -> Graph:
|
|
69
69
|
return Ontology.from_rules(rules).as_semantic_data_model()
|
|
70
70
|
|
|
71
71
|
@property
|
|
@@ -96,7 +96,7 @@ class Ontology(OntologyModel):
|
|
|
96
96
|
prefixes: dict[str, Namespace]
|
|
97
97
|
|
|
98
98
|
@classmethod
|
|
99
|
-
def from_rules(cls, rules:
|
|
99
|
+
def from_rules(cls, rules: ConceptualDataModel) -> Self:
|
|
100
100
|
"""
|
|
101
101
|
Generates an ontology from a set of transformation rules.
|
|
102
102
|
|
|
@@ -225,7 +225,7 @@ class Ontology(OntologyModel):
|
|
|
225
225
|
return (self.as_owl() + self.as_shacl()).serialize()
|
|
226
226
|
|
|
227
227
|
|
|
228
|
-
class OWLMetadata(
|
|
228
|
+
class OWLMetadata(ConceptualMetadata):
|
|
229
229
|
@property
|
|
230
230
|
def triples(self) -> list[tuple]:
|
|
231
231
|
# Mandatory triples originating from Metadata mandatory fields
|
|
@@ -259,7 +259,7 @@ class OWLClass(OntologyModel):
|
|
|
259
259
|
namespace: Namespace
|
|
260
260
|
|
|
261
261
|
@classmethod
|
|
262
|
-
def from_class(cls, definition:
|
|
262
|
+
def from_class(cls, definition: ConceptualClass, namespace: Namespace, prefixes: dict) -> Self:
|
|
263
263
|
if definition.implements and isinstance(definition.implements, list):
|
|
264
264
|
sub_class_of = []
|
|
265
265
|
for parent_class in definition.implements:
|
|
@@ -333,7 +333,7 @@ class OWLProperty(OntologyModel):
|
|
|
333
333
|
namespace: Namespace
|
|
334
334
|
|
|
335
335
|
@classmethod
|
|
336
|
-
def from_list_of_properties(cls, definitions: list[
|
|
336
|
+
def from_list_of_properties(cls, definitions: list[ConceptualProperty], namespace: Namespace) -> "OWLProperty":
|
|
337
337
|
"""Here list of properties is a list of properties with the same id, but different definitions."""
|
|
338
338
|
property_ids = {definition.property_ for definition in definitions}
|
|
339
339
|
if len(property_ids) != 1:
|
|
@@ -573,7 +573,10 @@ class SHACLNodeShape(OntologyModel):
|
|
|
573
573
|
|
|
574
574
|
@classmethod
|
|
575
575
|
def from_rules(
|
|
576
|
-
cls,
|
|
576
|
+
cls,
|
|
577
|
+
class_definition: ConceptualClass,
|
|
578
|
+
property_definitions: list[ConceptualProperty],
|
|
579
|
+
namespace: Namespace,
|
|
577
580
|
) -> "SHACLNodeShape":
|
|
578
581
|
if class_definition.implements:
|
|
579
582
|
parent = [namespace[str(parent.suffix) + "Shape"] for parent in class_definition.implements]
|
|
@@ -628,7 +631,7 @@ class SHACLPropertyShape(OntologyModel):
|
|
|
628
631
|
return self.path_triples + self.node_kind_triples + self.cardinality_triples
|
|
629
632
|
|
|
630
633
|
@classmethod
|
|
631
|
-
def from_property(cls, definition:
|
|
634
|
+
def from_property(cls, definition: ConceptualProperty, namespace: Namespace) -> "SHACLPropertyShape":
|
|
632
635
|
# TODO requires PR to fix MultiValueType and UnknownValueType
|
|
633
636
|
if isinstance(definition.value_type, ClassEntity):
|
|
634
637
|
expected_value_type = namespace[f"{definition.value_type.suffix}Shape"]
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
from collections import defaultdict
|
|
2
2
|
from collections.abc import Iterable
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core.
|
|
5
|
-
from cognite.neat.core.
|
|
4
|
+
from cognite.neat.core._data_model.models.conceptual import ConceptualProperty
|
|
5
|
+
from cognite.neat.core._data_model.models.entities import ClassEntity
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def duplicated_properties(
|
|
9
|
-
properties: Iterable[
|
|
10
|
-
) -> dict[tuple[ClassEntity, str], list[tuple[int,
|
|
11
|
-
class_properties_by_id: dict[tuple[ClassEntity, str], list[tuple[int,
|
|
9
|
+
properties: Iterable[ConceptualProperty],
|
|
10
|
+
) -> dict[tuple[ClassEntity, str], list[tuple[int, ConceptualProperty]]]:
|
|
11
|
+
class_properties_by_id: dict[tuple[ClassEntity, str], list[tuple[int, ConceptualProperty]]] = defaultdict(list)
|
|
12
12
|
for prop_no, prop in enumerate(properties):
|
|
13
13
|
class_properties_by_id[(prop.class_, prop.property_)].append((prop_no, prop))
|
|
14
14
|
return {k: v for k, v in class_properties_by_id.items() if len(v) > 1}
|
|
@@ -2,7 +2,7 @@ from ._base import BaseImporter
|
|
|
2
2
|
from ._dms2rules import DMSImporter
|
|
3
3
|
from ._dtdl2rules import DTDLImporter
|
|
4
4
|
from ._rdf import IMFImporter, InferenceImporter, OWLImporter, SubclassInferenceImporter
|
|
5
|
-
from ._spreadsheet2rules import ExcelImporter
|
|
5
|
+
from ._spreadsheet2rules import ExcelImporter
|
|
6
6
|
from ._yaml2rules import YAMLImporter
|
|
7
7
|
|
|
8
8
|
__all__ = [
|
|
@@ -10,7 +10,6 @@ __all__ = [
|
|
|
10
10
|
"DMSImporter",
|
|
11
11
|
"DTDLImporter",
|
|
12
12
|
"ExcelImporter",
|
|
13
|
-
"GoogleSheetImporter",
|
|
14
13
|
"IMFImporter",
|
|
15
14
|
"InferenceImporter",
|
|
16
15
|
"OWLImporter",
|
|
@@ -23,7 +22,6 @@ RulesImporters = (
|
|
|
23
22
|
| IMFImporter
|
|
24
23
|
| DMSImporter
|
|
25
24
|
| ExcelImporter
|
|
26
|
-
| GoogleSheetImporter
|
|
27
25
|
| DTDLImporter
|
|
28
26
|
| YAMLImporter
|
|
29
27
|
| InferenceImporter
|
|
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Any, Generic
|
|
|
6
6
|
from rdflib import URIRef
|
|
7
7
|
|
|
8
8
|
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
9
|
-
from cognite.neat.core.
|
|
9
|
+
from cognite.neat.core._data_model._shared import ReadRules, T_InputRules
|
|
10
10
|
from cognite.neat.core._utils.auxiliary import class_html_doc
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
@@ -33,6 +33,34 @@ from cognite.neat.core._constants import (
|
|
|
33
33
|
DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT,
|
|
34
34
|
DMS_PRIMITIVE_LIST_DEFAULT_LIMIT,
|
|
35
35
|
)
|
|
36
|
+
from cognite.neat.core._data_model._shared import ReadRules
|
|
37
|
+
from cognite.neat.core._data_model.importers._base import BaseImporter
|
|
38
|
+
from cognite.neat.core._data_model.models import (
|
|
39
|
+
DMSInputRules,
|
|
40
|
+
DMSSchema,
|
|
41
|
+
)
|
|
42
|
+
from cognite.neat.core._data_model.models.conceptual import (
|
|
43
|
+
UnverifiedConceptualClass,
|
|
44
|
+
UnverifiedConceptualProperty,
|
|
45
|
+
)
|
|
46
|
+
from cognite.neat.core._data_model.models.data_types import DataType, Enum, String
|
|
47
|
+
from cognite.neat.core._data_model.models.dms import (
|
|
48
|
+
DMSInputContainer,
|
|
49
|
+
DMSInputEnum,
|
|
50
|
+
DMSInputMetadata,
|
|
51
|
+
DMSInputNode,
|
|
52
|
+
DMSInputProperty,
|
|
53
|
+
DMSInputView,
|
|
54
|
+
)
|
|
55
|
+
from cognite.neat.core._data_model.models.entities import (
|
|
56
|
+
ClassEntity,
|
|
57
|
+
ContainerEntity,
|
|
58
|
+
DMSNodeEntity,
|
|
59
|
+
DMSUnknownEntity,
|
|
60
|
+
EdgeEntity,
|
|
61
|
+
ReverseConnectionEntity,
|
|
62
|
+
ViewEntity,
|
|
63
|
+
)
|
|
36
64
|
from cognite.neat.core._issues import (
|
|
37
65
|
IssueList,
|
|
38
66
|
MultiValueError,
|
|
@@ -55,34 +83,6 @@ from cognite.neat.core._issues.warnings import (
|
|
|
55
83
|
ResourcesDuplicatedWarning,
|
|
56
84
|
ResourceUnknownWarning,
|
|
57
85
|
)
|
|
58
|
-
from cognite.neat.core._rules._shared import ReadRules
|
|
59
|
-
from cognite.neat.core._rules.importers._base import BaseImporter
|
|
60
|
-
from cognite.neat.core._rules.models import (
|
|
61
|
-
DMSInputRules,
|
|
62
|
-
DMSSchema,
|
|
63
|
-
)
|
|
64
|
-
from cognite.neat.core._rules.models.data_types import DataType, Enum, String
|
|
65
|
-
from cognite.neat.core._rules.models.dms import (
|
|
66
|
-
DMSInputContainer,
|
|
67
|
-
DMSInputEnum,
|
|
68
|
-
DMSInputMetadata,
|
|
69
|
-
DMSInputNode,
|
|
70
|
-
DMSInputProperty,
|
|
71
|
-
DMSInputView,
|
|
72
|
-
)
|
|
73
|
-
from cognite.neat.core._rules.models.entities import (
|
|
74
|
-
ClassEntity,
|
|
75
|
-
ContainerEntity,
|
|
76
|
-
DMSNodeEntity,
|
|
77
|
-
DMSUnknownEntity,
|
|
78
|
-
EdgeEntity,
|
|
79
|
-
ReverseConnectionEntity,
|
|
80
|
-
ViewEntity,
|
|
81
|
-
)
|
|
82
|
-
from cognite.neat.core._rules.models.information import (
|
|
83
|
-
InformationInputClass,
|
|
84
|
-
InformationInputProperty,
|
|
85
|
-
)
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
class DMSImporter(BaseImporter[DMSInputRules]):
|
|
@@ -639,7 +639,7 @@ class DMSImporter(BaseImporter[DMSInputRules]):
|
|
|
639
639
|
@classmethod
|
|
640
640
|
def as_information_input_property(
|
|
641
641
|
cls, entity: ClassEntity, prop_id: str, view_property: ViewProperty
|
|
642
|
-
) ->
|
|
642
|
+
) -> UnverifiedConceptualProperty:
|
|
643
643
|
if not isinstance(view_property, dm.MappedProperty | dm.EdgeConnection | ReverseDirectRelation):
|
|
644
644
|
raise PropertyTypeNotSupportedError(
|
|
645
645
|
dm.ViewId(str(entity.prefix), str(entity.suffix), entity.version),
|
|
@@ -652,7 +652,7 @@ class DMSImporter(BaseImporter[DMSInputRules]):
|
|
|
652
652
|
if value_type is None:
|
|
653
653
|
raise NeatValueError(f"Failed to get value type for {entity} property {prop_id}")
|
|
654
654
|
|
|
655
|
-
return
|
|
655
|
+
return UnverifiedConceptualProperty(
|
|
656
656
|
class_=entity,
|
|
657
657
|
property_=prop_id,
|
|
658
658
|
value_type=str(value_type),
|
|
@@ -664,13 +664,17 @@ class DMSImporter(BaseImporter[DMSInputRules]):
|
|
|
664
664
|
)
|
|
665
665
|
|
|
666
666
|
@classmethod
|
|
667
|
-
def as_information_input_class(cls, view: View) ->
|
|
668
|
-
return
|
|
667
|
+
def as_information_input_class(cls, view: View) -> UnverifiedConceptualClass:
|
|
668
|
+
return UnverifiedConceptualClass(
|
|
669
669
|
class_=ClassEntity(prefix=view.space, suffix=view.external_id, version=view.version),
|
|
670
670
|
name=view.name,
|
|
671
671
|
description=view.description,
|
|
672
672
|
implements=[
|
|
673
|
-
ClassEntity(
|
|
673
|
+
ClassEntity(
|
|
674
|
+
prefix=parent.space,
|
|
675
|
+
suffix=parent.external_id,
|
|
676
|
+
version=parent.version,
|
|
677
|
+
)
|
|
674
678
|
for parent in view.implements or []
|
|
675
679
|
]
|
|
676
680
|
or None,
|