cognite-neat 0.75.8__py3-none-any.whl → 0.76.0__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/app/api/configuration.py +4 -9
- cognite/neat/app/api/routers/configuration.py +2 -1
- cognite/neat/app/api/routers/crud.py +5 -5
- cognite/neat/app/api/routers/data_exploration.py +3 -1
- cognite/neat/app/api/routers/rules.py +3 -3
- cognite/neat/app/api/routers/workflows.py +3 -3
- cognite/neat/app/ui/neat-app/build/asset-manifest.json +3 -3
- cognite/neat/app/ui/neat-app/build/index.html +1 -1
- cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js → main.ec7f72e2.js} +3 -3
- cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js.map → main.ec7f72e2.js.map} +1 -1
- cognite/neat/config.py +147 -12
- cognite/neat/constants.py +1 -0
- cognite/neat/graph/exceptions.py +1 -2
- cognite/neat/legacy/graph/exceptions.py +1 -2
- cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +1 -2
- cognite/neat/legacy/graph/loaders/_asset_loader.py +8 -13
- cognite/neat/legacy/graph/loaders/_base.py +2 -4
- cognite/neat/legacy/graph/loaders/_exceptions.py +1 -3
- cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +4 -8
- cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +2 -4
- cognite/neat/legacy/graph/loaders/rdf_to_dms.py +2 -4
- cognite/neat/legacy/graph/loaders/validator.py +1 -1
- cognite/neat/legacy/graph/transformations/transformer.py +1 -2
- cognite/neat/legacy/rules/exporters/_rules2dms.py +1 -2
- cognite/neat/legacy/rules/exporters/_validation.py +4 -8
- cognite/neat/legacy/rules/importers/_base.py +0 -4
- cognite/neat/legacy/rules/importers/_dms2rules.py +0 -2
- cognite/neat/legacy/rules/models/rdfpath.py +1 -2
- cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +89 -0
- cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +152 -0
- cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +139 -0
- cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +270 -0
- cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +65 -0
- cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +116 -0
- cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +67 -0
- cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +64 -0
- cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +95 -0
- cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +111 -0
- cognite/neat/rules/exporters/_models.py +3 -0
- cognite/neat/rules/exporters/_rules2dms.py +46 -4
- cognite/neat/rules/exporters/_rules2excel.py +2 -11
- cognite/neat/rules/exporters/_validation.py +6 -8
- cognite/neat/rules/importers/_base.py +8 -4
- cognite/neat/rules/importers/_dms2rules.py +321 -129
- cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +2 -4
- cognite/neat/rules/importers/_dtdl2rules/spec.py +2 -4
- cognite/neat/rules/importers/_owl2rules/_owl2rules.py +2 -4
- cognite/neat/rules/importers/_spreadsheet2rules.py +18 -16
- cognite/neat/rules/importers/_yaml2rules.py +2 -4
- cognite/neat/rules/issues/base.py +3 -0
- cognite/neat/rules/issues/dms.py +144 -58
- cognite/neat/rules/issues/fileread.py +41 -0
- cognite/neat/rules/issues/formatters.py +3 -1
- cognite/neat/rules/issues/importing.py +155 -0
- cognite/neat/rules/issues/spreadsheet.py +12 -9
- cognite/neat/rules/models/entities.py +30 -8
- cognite/neat/rules/models/rdfpath.py +1 -2
- cognite/neat/rules/models/rules/_base.py +5 -6
- cognite/neat/rules/models/rules/_dms_architect_rules.py +494 -333
- cognite/neat/rules/models/rules/_dms_rules_write.py +43 -52
- cognite/neat/rules/models/rules/_dms_schema.py +112 -22
- cognite/neat/rules/models/rules/_domain_rules.py +5 -0
- cognite/neat/rules/models/rules/_information_rules.py +13 -6
- cognite/neat/rules/models/wrapped_entities.py +166 -0
- cognite/neat/utils/cdf_loaders/_data_modeling.py +3 -1
- cognite/neat/utils/cdf_loaders/_ingestion.py +2 -4
- cognite/neat/utils/spreadsheet.py +2 -4
- cognite/neat/utils/utils.py +2 -4
- cognite/neat/workflows/base.py +5 -5
- cognite/neat/workflows/manager.py +32 -22
- cognite/neat/workflows/model.py +3 -3
- cognite/neat/workflows/steps/lib/__init__.py +0 -7
- cognite/neat/workflows/steps/lib/current/__init__.py +6 -0
- cognite/neat/workflows/steps/lib/{rules_exporter.py → current/rules_exporter.py} +8 -8
- cognite/neat/workflows/steps/lib/{rules_importer.py → current/rules_importer.py} +4 -4
- cognite/neat/workflows/steps/lib/io/__init__.py +1 -0
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_contextualization.py +2 -2
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_extractor.py +9 -9
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_loader.py +9 -9
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_store.py +4 -4
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_transformer.py +2 -2
- cognite/neat/workflows/steps/lib/{v1 → legacy}/rules_exporter.py +15 -17
- cognite/neat/workflows/steps/lib/{v1 → legacy}/rules_importer.py +7 -7
- cognite/neat/workflows/steps/step_model.py +5 -9
- cognite/neat/workflows/steps_registry.py +20 -11
- {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/METADATA +1 -1
- {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/RECORD +98 -86
- cognite/neat/app/api/data_classes/configuration.py +0 -121
- /cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js.LICENSE.txt → main.ec7f72e2.js.LICENSE.txt} +0 -0
- /cognite/neat/workflows/steps/lib/{graph_extractor.py → current/graph_extractor.py} +0 -0
- /cognite/neat/workflows/steps/lib/{graph_loader.py → current/graph_loader.py} +0 -0
- /cognite/neat/workflows/steps/lib/{graph_store.py → current/graph_store.py} +0 -0
- /cognite/neat/workflows/steps/lib/{rules_validator.py → current/rules_validator.py} +0 -0
- /cognite/neat/workflows/steps/lib/{io_steps.py → io/io_steps.py} +0 -0
- /cognite/neat/workflows/steps/lib/{v1 → legacy}/__init__.py +0 -0
- {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/LICENSE +0 -0
- {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/WHEEL +0 -0
- {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/entry_points.txt +0 -0
|
@@ -4,7 +4,7 @@ from abc import ABC, abstractmethod
|
|
|
4
4
|
from functools import total_ordering
|
|
5
5
|
from typing import Annotated, Any, ClassVar, Generic, TypeVar, cast
|
|
6
6
|
|
|
7
|
-
from cognite.client.data_classes.data_modeling.ids import ContainerId, DataModelId, PropertyId, ViewId
|
|
7
|
+
from cognite.client.data_classes.data_modeling.ids import ContainerId, DataModelId, NodeId, PropertyId, ViewId
|
|
8
8
|
from pydantic import AnyHttpUrl, BaseModel, BeforeValidator, Field, PlainSerializer, model_serializer, model_validator
|
|
9
9
|
|
|
10
10
|
if sys.version_info >= (3, 11):
|
|
@@ -30,6 +30,7 @@ class EntityTypes(StrEnum):
|
|
|
30
30
|
data_value_type = "data_value_type" # these are strings, floats, ...
|
|
31
31
|
xsd_value_type = "xsd_value_type"
|
|
32
32
|
dms_value_type = "dms_value_type"
|
|
33
|
+
dms_node = "dms_node"
|
|
33
34
|
view = "view"
|
|
34
35
|
reference_entity = "reference_entity"
|
|
35
36
|
container = "container"
|
|
@@ -57,8 +58,7 @@ _PROPERTY_ID_REGEX = rf"\((?P<{EntityTypes.property_}>{_ENTITY_ID_REGEX})\)"
|
|
|
57
58
|
_ENTITY_PATTERN = re.compile(r"^(?P<prefix>.*?):?(?P<suffix>[^(:]*)(\((?P<content>[^)]+)\))?$")
|
|
58
59
|
|
|
59
60
|
|
|
60
|
-
class _UndefinedType(BaseModel):
|
|
61
|
-
...
|
|
61
|
+
class _UndefinedType(BaseModel): ...
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
class _UnknownType(BaseModel):
|
|
@@ -249,7 +249,7 @@ class UnknownEntity(ClassEntity):
|
|
|
249
249
|
return str(Unknown)
|
|
250
250
|
|
|
251
251
|
|
|
252
|
-
T_ID = TypeVar("T_ID", bound=ContainerId | ViewId | DataModelId | PropertyId | None)
|
|
252
|
+
T_ID = TypeVar("T_ID", bound=ContainerId | ViewId | DataModelId | PropertyId | NodeId | None)
|
|
253
253
|
|
|
254
254
|
|
|
255
255
|
class DMSEntity(Entity, Generic[T_ID], ABC):
|
|
@@ -303,7 +303,9 @@ class ContainerEntity(DMSEntity[ContainerId]):
|
|
|
303
303
|
class DMSVersionedEntity(DMSEntity[T_ID], ABC):
|
|
304
304
|
version: str
|
|
305
305
|
|
|
306
|
-
def as_class(self) -> ClassEntity:
|
|
306
|
+
def as_class(self, skip_version: bool = False) -> ClassEntity:
|
|
307
|
+
if skip_version:
|
|
308
|
+
return ClassEntity(prefix=self.space, suffix=self.external_id)
|
|
307
309
|
return ClassEntity(prefix=self.space, suffix=self.external_id, version=self.version)
|
|
308
310
|
|
|
309
311
|
|
|
@@ -316,10 +318,13 @@ class ViewEntity(DMSVersionedEntity[ViewId]):
|
|
|
316
318
|
return ViewId(space=self.space, external_id=self.external_id, version=self.version)
|
|
317
319
|
|
|
318
320
|
@classmethod
|
|
319
|
-
def from_id(cls, id: ViewId) -> "ViewEntity":
|
|
320
|
-
if id.version is None:
|
|
321
|
+
def from_id(cls, id: ViewId, default_version: str | None = None) -> "ViewEntity":
|
|
322
|
+
if id.version is not None:
|
|
323
|
+
return cls(space=id.space, externalId=id.external_id, version=id.version)
|
|
324
|
+
elif default_version is not None:
|
|
325
|
+
return cls(space=id.space, externalId=id.external_id, version=default_version)
|
|
326
|
+
else:
|
|
321
327
|
raise ValueError("Version must be specified")
|
|
322
|
-
return cls(space=id.space, externalId=id.external_id, version=id.version)
|
|
323
328
|
|
|
324
329
|
|
|
325
330
|
class DMSUnknownEntity(DMSEntity[None]):
|
|
@@ -377,6 +382,17 @@ class DataModelEntity(DMSVersionedEntity[DataModelId]):
|
|
|
377
382
|
return cls(space=id.space, externalId=id.external_id, version=id.version)
|
|
378
383
|
|
|
379
384
|
|
|
385
|
+
class DMSNodeEntity(DMSEntity[NodeId]):
|
|
386
|
+
type_: ClassVar[EntityTypes] = EntityTypes.dms_node
|
|
387
|
+
|
|
388
|
+
def as_id(self) -> NodeId:
|
|
389
|
+
return NodeId(space=self.space, external_id=self.external_id)
|
|
390
|
+
|
|
391
|
+
@classmethod
|
|
392
|
+
def from_id(cls, id: NodeId) -> "DMSNodeEntity":
|
|
393
|
+
return cls(space=id.space, externalId=id.external_id)
|
|
394
|
+
|
|
395
|
+
|
|
380
396
|
class ReferenceEntity(ClassEntity):
|
|
381
397
|
type_: ClassVar[EntityTypes] = EntityTypes.reference_entity
|
|
382
398
|
prefix: str
|
|
@@ -392,6 +408,12 @@ class ReferenceEntity(ClassEntity):
|
|
|
392
408
|
raise ValueError("Property is not defined or prefix is not defined or suffix is unknown")
|
|
393
409
|
return PropertyId(source=self.as_view_id(), property=self.property_)
|
|
394
410
|
|
|
411
|
+
def as_node_id(self) -> NodeId:
|
|
412
|
+
return NodeId(space=self.prefix, external_id=self.suffix)
|
|
413
|
+
|
|
414
|
+
def as_node_entity(self) -> DMSNodeEntity:
|
|
415
|
+
return DMSNodeEntity(space=self.prefix, externalId=self.suffix)
|
|
416
|
+
|
|
395
417
|
def as_class_entity(self) -> ClassEntity:
|
|
396
418
|
return ClassEntity(prefix=self.prefix, suffix=self.suffix, version=self.version)
|
|
397
419
|
|
|
@@ -27,8 +27,6 @@ from pydantic import (
|
|
|
27
27
|
)
|
|
28
28
|
from pydantic.fields import FieldInfo
|
|
29
29
|
|
|
30
|
-
from cognite.neat.rules.models.entities import ClassEntity
|
|
31
|
-
|
|
32
30
|
if sys.version_info >= (3, 11):
|
|
33
31
|
from enum import StrEnum
|
|
34
32
|
from typing import Self
|
|
@@ -140,6 +138,11 @@ class ExtensionCategory(StrEnum):
|
|
|
140
138
|
rebuild = "rebuild"
|
|
141
139
|
|
|
142
140
|
|
|
141
|
+
class DataModelType(StrEnum):
|
|
142
|
+
solution = "solution"
|
|
143
|
+
enterprise = "enterprise"
|
|
144
|
+
|
|
145
|
+
|
|
143
146
|
class RoleTypes(StrEnum):
|
|
144
147
|
domain_expert = "domain expert"
|
|
145
148
|
information_architect = "information architect"
|
|
@@ -274,10 +277,6 @@ class BaseRules(RuleModel):
|
|
|
274
277
|
|
|
275
278
|
# An sheet entity is either a class or a property.
|
|
276
279
|
class SheetEntity(RuleModel):
|
|
277
|
-
class_: ClassEntity = Field(alias="Class")
|
|
278
|
-
name: str | None = Field(alias="Name", default=None)
|
|
279
|
-
description: str | None = Field(alias="Description", default=None)
|
|
280
|
-
|
|
281
280
|
@field_validator("*", mode="before")
|
|
282
281
|
def strip_string(cls, value: Any) -> Any:
|
|
283
282
|
if isinstance(value, str):
|