cognite-neat 0.81.12__py3-none-any.whl → 0.82.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/graph/extractors/_mock_graph_generator.py +2 -8
- cognite/neat/graph/loaders/_rdf2dms.py +1 -1
- cognite/neat/graph/queries/__init__.py +3 -0
- cognite/neat/graph/queries/_base.py +99 -0
- cognite/neat/graph/queries/_construct.py +185 -0
- cognite/neat/graph/queries/_shared.py +159 -0
- cognite/neat/graph/stores/_base.py +24 -87
- cognite/neat/rules/_shared.py +2 -2
- cognite/neat/rules/analysis/_information_rules.py +34 -58
- cognite/neat/rules/importers/_inference2rules.py +5 -1
- cognite/neat/rules/importers/_spreadsheet2rules.py +6 -1
- cognite/neat/rules/models/__init__.py +4 -1
- cognite/neat/rules/models/_base.py +1 -0
- cognite/neat/rules/models/asset/__init__.py +10 -0
- cognite/neat/rules/models/asset/_converter.py +4 -0
- cognite/neat/rules/models/asset/_rules.py +156 -0
- cognite/neat/rules/models/asset/_rules_input.py +171 -0
- cognite/neat/rules/models/asset/_serializer.py +73 -0
- cognite/neat/rules/models/asset/_validation.py +4 -0
- cognite/neat/rules/models/entities.py +56 -1
- cognite/neat/rules/models/information/_rules.py +5 -0
- cognite/neat/rules/models/information/_rules_input.py +3 -6
- cognite/neat/utils/utils.py +6 -1
- cognite/neat/workflows/steps/data_contracts.py +5 -2
- {cognite_neat-0.81.12.dist-info → cognite_neat-0.82.1.dist-info}/METADATA +1 -1
- {cognite_neat-0.81.12.dist-info → cognite_neat-0.82.1.dist-info}/RECORD +30 -20
- {cognite_neat-0.81.12.dist-info → cognite_neat-0.82.1.dist-info}/LICENSE +0 -0
- {cognite_neat-0.81.12.dist-info → cognite_neat-0.82.1.dist-info}/WHEEL +0 -0
- {cognite_neat-0.81.12.dist-info → cognite_neat-0.82.1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from collections.abc import Sequence
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any, cast, overload
|
|
4
|
+
|
|
5
|
+
from cognite.neat.rules.models._base import _add_alias
|
|
6
|
+
from cognite.neat.rules.models.data_types import DataType
|
|
7
|
+
from cognite.neat.rules.models.entities import (
|
|
8
|
+
ClassEntity,
|
|
9
|
+
MultiValueTypeInfo,
|
|
10
|
+
Unknown,
|
|
11
|
+
UnknownEntity,
|
|
12
|
+
)
|
|
13
|
+
from cognite.neat.rules.models.information._rules_input import InformationClassInput, InformationMetadataInput
|
|
14
|
+
|
|
15
|
+
from ._rules import AssetProperty, AssetRules
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class AssetMetadataInput(InformationMetadataInput): ...
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class AssetPropertyInput:
|
|
24
|
+
class_: str
|
|
25
|
+
property_: str
|
|
26
|
+
value_type: str
|
|
27
|
+
name: str | None = None
|
|
28
|
+
description: str | None = None
|
|
29
|
+
comment: str | None = None
|
|
30
|
+
min_count: int | None = None
|
|
31
|
+
max_count: int | float | None = None
|
|
32
|
+
default: Any | None = None
|
|
33
|
+
reference: str | None = None
|
|
34
|
+
match_type: str | None = None
|
|
35
|
+
transformation: str | None = None
|
|
36
|
+
implementation: str | None = None
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
@overload
|
|
40
|
+
def load(cls, data: None) -> None: ...
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
@overload
|
|
44
|
+
def load(cls, data: dict[str, Any]) -> "AssetPropertyInput": ...
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
@overload
|
|
48
|
+
def load(cls, data: list[dict[str, Any]]) -> list["AssetPropertyInput"]: ...
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def load(
|
|
52
|
+
cls, data: dict[str, Any] | list[dict[str, Any]] | None
|
|
53
|
+
) -> "AssetPropertyInput | list[AssetPropertyInput] | None":
|
|
54
|
+
if data is None:
|
|
55
|
+
return None
|
|
56
|
+
if isinstance(data, list) or (isinstance(data, dict) and isinstance(data.get("data"), list)):
|
|
57
|
+
items = cast(list[dict[str, Any]], data.get("data") if isinstance(data, dict) else data)
|
|
58
|
+
return [loaded for item in items if (loaded := cls.load(item)) is not None]
|
|
59
|
+
|
|
60
|
+
_add_alias(data, AssetProperty)
|
|
61
|
+
return cls(
|
|
62
|
+
class_=data.get("class_"), # type: ignore[arg-type]
|
|
63
|
+
property_=data.get("property_"), # type: ignore[arg-type]
|
|
64
|
+
name=data.get("name", None),
|
|
65
|
+
description=data.get("description", None),
|
|
66
|
+
comment=data.get("comment", None),
|
|
67
|
+
value_type=data.get("value_type"), # type: ignore[arg-type]
|
|
68
|
+
min_count=data.get("min_count", None),
|
|
69
|
+
max_count=data.get("max_count", None),
|
|
70
|
+
default=data.get("default", None),
|
|
71
|
+
reference=data.get("reference", None),
|
|
72
|
+
match_type=data.get("match_type", None),
|
|
73
|
+
transformation=data.get("transformation", None),
|
|
74
|
+
implementation=data.get("implementation", None),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
def dump(self, default_prefix: str) -> dict[str, Any]:
|
|
78
|
+
value_type: MultiValueTypeInfo | DataType | ClassEntity | UnknownEntity
|
|
79
|
+
|
|
80
|
+
# property holding xsd data type
|
|
81
|
+
# check if it is multi value type
|
|
82
|
+
if "|" in self.value_type:
|
|
83
|
+
value_type = MultiValueTypeInfo.load(self.value_type)
|
|
84
|
+
value_type.set_default_prefix(default_prefix)
|
|
85
|
+
|
|
86
|
+
elif DataType.is_data_type(self.value_type):
|
|
87
|
+
value_type = DataType.load(self.value_type)
|
|
88
|
+
|
|
89
|
+
# unknown value type
|
|
90
|
+
elif self.value_type == str(Unknown):
|
|
91
|
+
value_type = UnknownEntity()
|
|
92
|
+
|
|
93
|
+
# property holding link to class
|
|
94
|
+
else:
|
|
95
|
+
value_type = ClassEntity.load(self.value_type, prefix=default_prefix)
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
"Class": ClassEntity.load(self.class_, prefix=default_prefix),
|
|
99
|
+
"Property": self.property_,
|
|
100
|
+
"Name": self.name,
|
|
101
|
+
"Description": self.description,
|
|
102
|
+
"Comment": self.comment,
|
|
103
|
+
"Value Type": value_type,
|
|
104
|
+
"Min Count": self.min_count,
|
|
105
|
+
"Max Count": self.max_count,
|
|
106
|
+
"Default": self.default,
|
|
107
|
+
"Reference": self.reference,
|
|
108
|
+
"Match Type": self.match_type,
|
|
109
|
+
"Transformation": self.transformation,
|
|
110
|
+
"Implementation": self.implementation,
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class AssetClassInput(InformationClassInput): ...
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@dataclass
|
|
118
|
+
class AssetRulesInput:
|
|
119
|
+
metadata: AssetMetadataInput
|
|
120
|
+
properties: Sequence[AssetPropertyInput]
|
|
121
|
+
classes: Sequence[AssetClassInput]
|
|
122
|
+
last: "AssetRulesInput | AssetRules | None" = None
|
|
123
|
+
reference: "AssetRulesInput | AssetRules | None" = None
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
@overload
|
|
127
|
+
def load(cls, data: dict[str, Any]) -> "AssetRulesInput": ...
|
|
128
|
+
|
|
129
|
+
@classmethod
|
|
130
|
+
@overload
|
|
131
|
+
def load(cls, data: None) -> None: ...
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def load(cls, data: dict | None) -> "AssetRulesInput | None":
|
|
135
|
+
if data is None:
|
|
136
|
+
return None
|
|
137
|
+
_add_alias(data, AssetRules)
|
|
138
|
+
|
|
139
|
+
return cls(
|
|
140
|
+
metadata=AssetMetadataInput.load(data.get("metadata")), # type: ignore[arg-type]
|
|
141
|
+
properties=AssetPropertyInput.load(data.get("properties")), # type: ignore[arg-type]
|
|
142
|
+
classes=InformationClassInput.load(data.get("classes")), # type: ignore[arg-type]
|
|
143
|
+
last=AssetRulesInput.load(data.get("last")),
|
|
144
|
+
reference=AssetRulesInput.load(data.get("reference")),
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
def as_rules(self) -> AssetRules:
|
|
148
|
+
return AssetRules.model_validate(self.dump())
|
|
149
|
+
|
|
150
|
+
def dump(self) -> dict[str, Any]:
|
|
151
|
+
default_prefix = self.metadata.prefix
|
|
152
|
+
reference: dict[str, Any] | None = None
|
|
153
|
+
if isinstance(self.reference, AssetRulesInput):
|
|
154
|
+
reference = self.reference.dump()
|
|
155
|
+
elif isinstance(self.reference, AssetRules):
|
|
156
|
+
# We need to load through the AssetRulesInput to set the correct default space and version
|
|
157
|
+
reference = AssetRulesInput.load(self.reference.model_dump()).dump()
|
|
158
|
+
last: dict[str, Any] | None = None
|
|
159
|
+
if isinstance(self.last, AssetRulesInput):
|
|
160
|
+
last = self.last.dump()
|
|
161
|
+
elif isinstance(self.last, AssetRules):
|
|
162
|
+
# We need to load through the AssetRulesInput to set the correct default space and version
|
|
163
|
+
last = AssetRulesInput.load(self.last.model_dump()).dump()
|
|
164
|
+
|
|
165
|
+
return dict(
|
|
166
|
+
Metadata=self.metadata.dump(),
|
|
167
|
+
Properties=[prop.dump(default_prefix) for prop in self.properties],
|
|
168
|
+
Classes=[class_.dump(default_prefix) for class_ in self.classes],
|
|
169
|
+
Last=last,
|
|
170
|
+
Reference=reference,
|
|
171
|
+
)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from typing import Any, ClassVar
|
|
2
|
+
|
|
3
|
+
from cognite.neat.rules.models.entities import ClassEntity, ReferenceEntity
|
|
4
|
+
|
|
5
|
+
from ._rules import AssetClass, AssetProperty, AssetRules
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class _AssetRulesSerializer:
|
|
9
|
+
# These are the fields that need to be cleaned from the default space and version
|
|
10
|
+
PROPERTIES_FIELDS: ClassVar[list[str]] = ["class_", "value_type"]
|
|
11
|
+
CLASSES_FIELDS: ClassVar[list[str]] = ["class_"]
|
|
12
|
+
|
|
13
|
+
def __init__(self, by_alias: bool, default_prefix: str) -> None:
|
|
14
|
+
self.default_prefix = f"{default_prefix}:"
|
|
15
|
+
|
|
16
|
+
self.properties_fields = self.PROPERTIES_FIELDS
|
|
17
|
+
self.classes_fields = self.CLASSES_FIELDS
|
|
18
|
+
|
|
19
|
+
self.prop_name = "properties"
|
|
20
|
+
self.class_name = "classes"
|
|
21
|
+
self.metadata_name = "metadata"
|
|
22
|
+
self.class_parent = "parent"
|
|
23
|
+
|
|
24
|
+
self.prop_property = "property_"
|
|
25
|
+
self.prop_class = "class_"
|
|
26
|
+
|
|
27
|
+
self.reference = "Reference" if by_alias else "reference"
|
|
28
|
+
if by_alias:
|
|
29
|
+
self.properties_fields = [
|
|
30
|
+
AssetProperty.model_fields[field].alias or field for field in self.properties_fields
|
|
31
|
+
]
|
|
32
|
+
self.classes_fields = [AssetClass.model_fields[field].alias or field for field in self.classes_fields]
|
|
33
|
+
self.prop_name = AssetRules.model_fields[self.prop_name].alias or self.prop_name
|
|
34
|
+
self.class_name = AssetRules.model_fields[self.class_name].alias or self.class_name
|
|
35
|
+
self.class_parent = AssetClass.model_fields[self.class_parent].alias or self.class_parent
|
|
36
|
+
self.metadata_name = AssetRules.model_fields[self.metadata_name].alias or self.metadata_name
|
|
37
|
+
|
|
38
|
+
self.prop_property = AssetProperty.model_fields[self.prop_property].alias or self.prop_property
|
|
39
|
+
self.prop_class = AssetProperty.model_fields[self.prop_class].alias or self.prop_class
|
|
40
|
+
|
|
41
|
+
def clean(self, dumped: dict[str, Any], as_reference: bool) -> dict[str, Any]:
|
|
42
|
+
# Sorting to get a deterministic order
|
|
43
|
+
dumped[self.prop_name] = sorted(
|
|
44
|
+
dumped[self.prop_name]["data"], key=lambda p: (p[self.prop_class], p[self.prop_property])
|
|
45
|
+
)
|
|
46
|
+
dumped[self.class_name] = sorted(dumped[self.class_name]["data"], key=lambda v: v[self.prop_class])
|
|
47
|
+
|
|
48
|
+
for prop in dumped[self.prop_name]:
|
|
49
|
+
if as_reference:
|
|
50
|
+
class_entity = ClassEntity.load(prop[self.prop_class])
|
|
51
|
+
prop[self.reference] = str(
|
|
52
|
+
ReferenceEntity(
|
|
53
|
+
prefix=str(class_entity.prefix), suffix=class_entity.suffix, property=prop[self.prop_property]
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
for field_name in self.properties_fields:
|
|
58
|
+
if value := prop.get(field_name):
|
|
59
|
+
prop[field_name] = value.removeprefix(self.default_prefix)
|
|
60
|
+
|
|
61
|
+
for class_ in dumped[self.class_name]:
|
|
62
|
+
if as_reference:
|
|
63
|
+
class_[self.reference] = class_[self.prop_class]
|
|
64
|
+
for field_name in self.classes_fields:
|
|
65
|
+
if value := class_.get(field_name):
|
|
66
|
+
class_[field_name] = value.removeprefix(self.default_prefix)
|
|
67
|
+
|
|
68
|
+
if value := class_.get(self.class_parent):
|
|
69
|
+
class_[self.class_parent] = ",".join(
|
|
70
|
+
parent.strip().removeprefix(self.default_prefix) for parent in value.split(",")
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return dumped
|
|
@@ -48,6 +48,8 @@ class EntityTypes(StrEnum):
|
|
|
48
48
|
datamodel = "datamodel"
|
|
49
49
|
undefined = "undefined"
|
|
50
50
|
multi_value_type = "multi_value_type"
|
|
51
|
+
asset = "asset"
|
|
52
|
+
relationship = "relationship"
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
# ALLOWED
|
|
@@ -204,7 +206,7 @@ class Entity(BaseModel, extra="ignore"):
|
|
|
204
206
|
if (v := getattr(self, field_name)) is not None and field_name not in {"prefix", "suffix"}
|
|
205
207
|
)
|
|
206
208
|
args = ",".join([f"{k}={v}" for k, v in model_dump])
|
|
207
|
-
if self.prefix
|
|
209
|
+
if self.prefix == Undefined:
|
|
208
210
|
base_id = str(self.suffix)
|
|
209
211
|
else:
|
|
210
212
|
base_id = f"{self.prefix}:{self.suffix!s}"
|
|
@@ -267,6 +269,28 @@ class UnknownEntity(ClassEntity):
|
|
|
267
269
|
return str(Unknown)
|
|
268
270
|
|
|
269
271
|
|
|
272
|
+
class AssetFields(StrEnum):
|
|
273
|
+
external_id = "external_id"
|
|
274
|
+
name = "name"
|
|
275
|
+
parent_external_id = "parent_external_id"
|
|
276
|
+
description = "description"
|
|
277
|
+
metadata = "metadata"
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class AssetEntity(Entity):
|
|
281
|
+
type_: ClassVar[EntityTypes] = EntityTypes.asset
|
|
282
|
+
suffix: str = "Asset"
|
|
283
|
+
prefix: _UndefinedType = Undefined
|
|
284
|
+
property_: AssetFields = Field(alias="property")
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class RelationshipEntity(Entity):
|
|
288
|
+
type_: ClassVar[EntityTypes] = EntityTypes.relationship
|
|
289
|
+
suffix: str = "Relationship"
|
|
290
|
+
prefix: _UndefinedType = Undefined
|
|
291
|
+
label: str | None = None
|
|
292
|
+
|
|
293
|
+
|
|
270
294
|
T_ID = TypeVar("T_ID", bound=ContainerId | ViewId | DataModelId | PropertyId | NodeId | None)
|
|
271
295
|
|
|
272
296
|
|
|
@@ -505,6 +529,25 @@ def _join_str(v: list[ClassEntity]) -> str | None:
|
|
|
505
529
|
return ",".join([entry.id for entry in v]) if v else None
|
|
506
530
|
|
|
507
531
|
|
|
532
|
+
def _generate_cdf_resource_list(v: Any) -> list[AssetEntity | RelationshipEntity]:
|
|
533
|
+
results = []
|
|
534
|
+
for item in _split_str(v):
|
|
535
|
+
if isinstance(item, str):
|
|
536
|
+
if "relationship" in item.lower():
|
|
537
|
+
results.append(RelationshipEntity.load(item))
|
|
538
|
+
elif "asset" in item.lower():
|
|
539
|
+
results.append(AssetEntity.load(item)) # type: ignore
|
|
540
|
+
else:
|
|
541
|
+
raise ValueError(f"Unsupported implementation definition: {item}")
|
|
542
|
+
|
|
543
|
+
elif isinstance(item, AssetEntity | RelationshipEntity):
|
|
544
|
+
results.append(item)
|
|
545
|
+
else:
|
|
546
|
+
raise ValueError(f"Unsupported implementation definition: {item}")
|
|
547
|
+
|
|
548
|
+
return results # type: ignore
|
|
549
|
+
|
|
550
|
+
|
|
508
551
|
ParentEntityList = Annotated[
|
|
509
552
|
list[ParentClassEntity],
|
|
510
553
|
BeforeValidator(_split_str),
|
|
@@ -515,6 +558,18 @@ ParentEntityList = Annotated[
|
|
|
515
558
|
),
|
|
516
559
|
]
|
|
517
560
|
|
|
561
|
+
|
|
562
|
+
CdfResourceEntityList = Annotated[
|
|
563
|
+
list[AssetEntity | RelationshipEntity],
|
|
564
|
+
BeforeValidator(_generate_cdf_resource_list),
|
|
565
|
+
PlainSerializer(
|
|
566
|
+
_join_str,
|
|
567
|
+
return_type=str,
|
|
568
|
+
when_used="unless-none",
|
|
569
|
+
),
|
|
570
|
+
]
|
|
571
|
+
|
|
572
|
+
|
|
518
573
|
ContainerEntityList = Annotated[
|
|
519
574
|
list[ContainerEntity],
|
|
520
575
|
BeforeValidator(_split_str),
|
|
@@ -169,6 +169,11 @@ class InformationProperty(SheetEntity):
|
|
|
169
169
|
match_type: MatchType | None = Field(alias="Match Type", default=None)
|
|
170
170
|
transformation: str | RDFPath | None = Field(alias="Transformation", default=None)
|
|
171
171
|
comment: str | None = Field(alias="Comment", default=None)
|
|
172
|
+
inherited: bool = Field(
|
|
173
|
+
default=False,
|
|
174
|
+
alias="Inherited",
|
|
175
|
+
description="Flag to indicate if the property is inherited, only use for internal purposes",
|
|
176
|
+
)
|
|
172
177
|
|
|
173
178
|
@field_serializer("max_count", when_used="json-unless-none")
|
|
174
179
|
def serialize_max_count(self, value: int | float | None) -> int | float | None | str:
|
|
@@ -84,8 +84,7 @@ class InformationPropertyInput:
|
|
|
84
84
|
default: Any | None = None
|
|
85
85
|
reference: str | None = None
|
|
86
86
|
match_type: str | None = None
|
|
87
|
-
|
|
88
|
-
rule: str | None = None
|
|
87
|
+
transformation: str | None = None
|
|
89
88
|
|
|
90
89
|
@classmethod
|
|
91
90
|
@overload
|
|
@@ -122,8 +121,7 @@ class InformationPropertyInput:
|
|
|
122
121
|
default=data.get("default", None),
|
|
123
122
|
reference=data.get("reference", None),
|
|
124
123
|
match_type=data.get("match_type", None),
|
|
125
|
-
|
|
126
|
-
rule=data.get("rule", None),
|
|
124
|
+
transformation=data.get("transformation", None),
|
|
127
125
|
)
|
|
128
126
|
|
|
129
127
|
def dump(self, default_prefix: str) -> dict[str, Any]:
|
|
@@ -158,8 +156,7 @@ class InformationPropertyInput:
|
|
|
158
156
|
"Default": self.default,
|
|
159
157
|
"Reference": self.reference,
|
|
160
158
|
"Match Type": self.match_type,
|
|
161
|
-
"
|
|
162
|
-
"Rule": self.rule,
|
|
159
|
+
"Transformation": self.transformation,
|
|
163
160
|
}
|
|
164
161
|
|
|
165
162
|
|
cognite/neat/utils/utils.py
CHANGED
|
@@ -3,7 +3,7 @@ import logging
|
|
|
3
3
|
import re
|
|
4
4
|
import sys
|
|
5
5
|
import time
|
|
6
|
-
from collections import OrderedDict
|
|
6
|
+
from collections import Counter, OrderedDict
|
|
7
7
|
from collections.abc import Iterable
|
|
8
8
|
from datetime import datetime
|
|
9
9
|
from functools import wraps
|
|
@@ -386,3 +386,8 @@ def string_to_ideal_type(input_string: str) -> int | bool | float | datetime | s
|
|
|
386
386
|
except ValueError:
|
|
387
387
|
# Return the input string if no conversion is possible
|
|
388
388
|
return input_string
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
def most_occurring_element(list_of_elements: list):
|
|
392
|
+
counts = Counter(list_of_elements)
|
|
393
|
+
return counts.most_common(1)[0][0]
|
|
@@ -7,7 +7,7 @@ from cognite.client.data_classes.data_modeling import EdgeApply, NodeApply
|
|
|
7
7
|
from cognite.neat.legacy.graph.stores import NeatGraphStoreBase
|
|
8
8
|
from cognite.neat.legacy.rules.exporters._rules2dms import DMSSchemaComponents
|
|
9
9
|
from cognite.neat.legacy.rules.models.rules import Rules
|
|
10
|
-
from cognite.neat.rules.models import DMSRules, DomainRules, InformationRules
|
|
10
|
+
from cognite.neat.rules.models import AssetRules, DMSRules, DomainRules, InformationRules
|
|
11
11
|
from cognite.neat.workflows.steps.step_model import DataContract
|
|
12
12
|
|
|
13
13
|
|
|
@@ -25,14 +25,17 @@ class RulesData(DataContract):
|
|
|
25
25
|
class MultiRuleData(DataContract):
|
|
26
26
|
domain: DomainRules | None = None
|
|
27
27
|
information: InformationRules | None = None
|
|
28
|
+
asset: AssetRules | None = None
|
|
28
29
|
dms: DMSRules | None = None
|
|
29
30
|
|
|
30
31
|
@classmethod
|
|
31
|
-
def from_rules(cls, rules: DomainRules | InformationRules | DMSRules):
|
|
32
|
+
def from_rules(cls, rules: DomainRules | InformationRules | AssetRules | DMSRules):
|
|
32
33
|
if isinstance(rules, DomainRules):
|
|
33
34
|
return cls(domain=rules)
|
|
34
35
|
elif isinstance(rules, InformationRules):
|
|
35
36
|
return cls(information=rules)
|
|
37
|
+
elif isinstance(rules, AssetRules):
|
|
38
|
+
return cls(asset=rules)
|
|
36
39
|
elif isinstance(rules, DMSRules):
|
|
37
40
|
return cls(dms=rules)
|
|
38
41
|
else:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
cognite/neat/__init__.py,sha256=v-rRiDOgZ3sQSMQKq0vgUQZvpeOkoHFXissAx6Ktg84,61
|
|
2
|
-
cognite/neat/_version.py,sha256
|
|
2
|
+
cognite/neat/_version.py,sha256=-bjKNrf7oWO-fveyMGHMdNh3lCU-83ApDm9-UMtjhVk,23
|
|
3
3
|
cognite/neat/app/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
cognite/neat/app/api/asgi/metrics.py,sha256=nxFy7L5cChTI0a-zkCiJ59Aq8yLuIJp5c9Dg0wRXtV0,152
|
|
5
5
|
cognite/neat/app/api/configuration.py,sha256=2U5M6M252swvQPQyooA1EBzFUZNtcTmuSaywfJDgckM,4232
|
|
@@ -64,16 +64,20 @@ cognite/neat/graph/extractors/_classic_cdf/_relationships.py,sha256=w16hu_REIFEV
|
|
|
64
64
|
cognite/neat/graph/extractors/_classic_cdf/_sequences.py,sha256=o4yxkf81FGFrKkflvlyDYie05fTYsT_LcRFM63OTVCI,3406
|
|
65
65
|
cognite/neat/graph/extractors/_classic_cdf/_timeseries.py,sha256=KTYmL8vhXijlmkN1UFQrGpaCllpRekr1y55SoLhlLbg,4559
|
|
66
66
|
cognite/neat/graph/extractors/_dexpi.py,sha256=CYSLt0Fl7Y2RCqOfIAT0N8Cjs-Yu2lRLvB13axtAaWw,9384
|
|
67
|
-
cognite/neat/graph/extractors/_mock_graph_generator.py,sha256=
|
|
67
|
+
cognite/neat/graph/extractors/_mock_graph_generator.py,sha256=1TjgbxDVwgZjivIqx1lLKwggn_zHqWLiYM26esgDAMs,14694
|
|
68
68
|
cognite/neat/graph/extractors/_rdf_file.py,sha256=w4-XgPgNsmZOkNxjO1ZQCcopTntmmtxfDBkQxn1se6E,463
|
|
69
69
|
cognite/neat/graph/issues/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
70
70
|
cognite/neat/graph/issues/loader.py,sha256=v8YDsehkUT1QUG61JM9BDV_lqowMUnDmGmbay0aFzN4,3085
|
|
71
71
|
cognite/neat/graph/loaders/__init__.py,sha256=hHC9sfFfbnGSVFTYeuNTIEu4tdLSJ2mWV07fereLelo,125
|
|
72
72
|
cognite/neat/graph/loaders/_base.py,sha256=bdYC6CwsHVqnQa1QzOhL68qQhF1OtrsearqH6D-z3E4,4037
|
|
73
|
-
cognite/neat/graph/loaders/_rdf2dms.py,sha256=
|
|
73
|
+
cognite/neat/graph/loaders/_rdf2dms.py,sha256=6B3fdsaygSOYClq5vgNPMF4HJkO_Xt1OlrrbTsU0Bdc,12989
|
|
74
74
|
cognite/neat/graph/models.py,sha256=AtLgZh2qyRP6NRetjQCy9qLMuTQB0CH52Zsev-qa2sk,149
|
|
75
|
+
cognite/neat/graph/queries/__init__.py,sha256=BgDd-037kvtWwAoGAy8eORVNMiZ5-E9sIV0txIpeaN4,50
|
|
76
|
+
cognite/neat/graph/queries/_base.py,sha256=20A7GDBdmc35VmHVz5n0YCGPcnBAmUX-bM2ImHPManc,3844
|
|
77
|
+
cognite/neat/graph/queries/_construct.py,sha256=FxzSQqzCpo7lKVYerlLAY03oqCeFM5L6MozfBUblzr4,7341
|
|
78
|
+
cognite/neat/graph/queries/_shared.py,sha256=EwW2RbPttt7-z7QTgfKWlthA2Nq5d3bYyyewFkCA7R4,5043
|
|
75
79
|
cognite/neat/graph/stores/__init__.py,sha256=G-VG_YwfRt1kuPao07PDJyZ3w_0-eguzLUM13n-Z_RA,64
|
|
76
|
-
cognite/neat/graph/stores/_base.py,sha256=
|
|
80
|
+
cognite/neat/graph/stores/_base.py,sha256=b4qidXCl9190LrvLXTms2lDqv1ErwvvcGzQkY6mU9hI,10096
|
|
77
81
|
cognite/neat/graph/stores/_oxrdflib.py,sha256=A5zeRm5_e8ui_ihGpgstRDg_N7qcLZ3QZBRGrOXSGI0,9569
|
|
78
82
|
cognite/neat/graph/stores/_provenance.py,sha256=Hr9WBhFj-eoet4czL8XSBGYnu9Yn66YsTgH_G0n3QpY,3293
|
|
79
83
|
cognite/neat/graph/transformers/__init__.py,sha256=wXrNSyJNGnis3haaCKVPZ5y5kKSUsOUHnh-860ekatk,555
|
|
@@ -175,10 +179,10 @@ cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/wor
|
|
|
175
179
|
cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml,sha256=yWVL-NHghKtiNV2kpEX674MJwWqhOUn3j2ZOJiJbprE,2579
|
|
176
180
|
cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
177
181
|
cognite/neat/rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
178
|
-
cognite/neat/rules/_shared.py,sha256=
|
|
182
|
+
cognite/neat/rules/_shared.py,sha256=Ak2K9YnLhvmp8womNI3bmjaooQZkY9E33-DJ97P9wZg,195
|
|
179
183
|
cognite/neat/rules/analysis/__init__.py,sha256=J2yL0QWSvXOWLbaYPyA0HXHh3aqOWmkwobScdgVQpw8,115
|
|
180
184
|
cognite/neat/rules/analysis/_base.py,sha256=PmN5NLgGsovsHtsnvUzc_zuarWl-Xwk1azWcYKKuWdA,669
|
|
181
|
-
cognite/neat/rules/analysis/_information_rules.py,sha256=
|
|
185
|
+
cognite/neat/rules/analysis/_information_rules.py,sha256=fdSMyInsPJdgLHKwSkj2N9bcEXld9ETxUIXWqeDH8L4,17478
|
|
182
186
|
cognite/neat/rules/examples/__init__.py,sha256=nxIwueAcHgZhkYriGxnDLQmIyiT8PByPHbScjYKDKe0,374
|
|
183
187
|
cognite/neat/rules/examples/wind-energy.owl,sha256=NuomCA9FuuLF0JlSuG3OKqD4VBcHgSjDKFLV17G1zV8,65934
|
|
184
188
|
cognite/neat/rules/exceptions.py,sha256=YLnsbXXJdDSr_szQoioEtOdqDV8PR7RdQjpMP2SWeCs,123868
|
|
@@ -197,13 +201,13 @@ cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py,sha256=wW4saKva61Q_i17g
|
|
|
197
201
|
cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py,sha256=ysmWUxZ0npwrTB0uiH5jA0v37sfCwowGaYk17IyxPUU,12663
|
|
198
202
|
cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py,sha256=QDyGt5YBaxzF4v_oCFSgKRSpwVdVruDU3-VW0DEiHbY,6718
|
|
199
203
|
cognite/neat/rules/importers/_dtdl2rules/spec.py,sha256=tim_MfN1J0F3Oeqk3BMgIA82d_MZvhRuRMsLK3B4PYc,11897
|
|
200
|
-
cognite/neat/rules/importers/_inference2rules.py,sha256=
|
|
204
|
+
cognite/neat/rules/importers/_inference2rules.py,sha256=vN3l6gfca19FHGzPb9fwolZaq4Z8KkeiR-iK1up8Kqk,11478
|
|
201
205
|
cognite/neat/rules/importers/_owl2rules/__init__.py,sha256=tdGcrgtozdQyST-pTlxIa4cLBNTLvtk1nNYR4vOdFSw,63
|
|
202
206
|
cognite/neat/rules/importers/_owl2rules/_owl2classes.py,sha256=QpTxvrTGczIa48X8lgXGnMN1AWPhHK0DR6uNq175xak,7357
|
|
203
207
|
cognite/neat/rules/importers/_owl2rules/_owl2metadata.py,sha256=nwnUaBNAAYMoBre2UmsnkJXUuaqGEpR3U3txDrH2w6g,7527
|
|
204
208
|
cognite/neat/rules/importers/_owl2rules/_owl2properties.py,sha256=eKr-e-ZTTV54PJ9UXNVPTT_c9XxszNPraS4Y43AF7qQ,7297
|
|
205
209
|
cognite/neat/rules/importers/_owl2rules/_owl2rules.py,sha256=41_wZFvt0A6TI55zlT04oQkvU7V73li4aGLgc4T4Lxo,6358
|
|
206
|
-
cognite/neat/rules/importers/_spreadsheet2rules.py,sha256=
|
|
210
|
+
cognite/neat/rules/importers/_spreadsheet2rules.py,sha256=32Mnu74cSKQ0XcnAshwL6XTS_TxqYBUm5u29U7sirCg,12684
|
|
207
211
|
cognite/neat/rules/importers/_yaml2rules.py,sha256=F0uksSz1A3po5OlRM2152_w5j8D9oYTLB9NFTkSMlWI,4275
|
|
208
212
|
cognite/neat/rules/issues/__init__.py,sha256=c12m0HAHHzF6oR8lKbULE3TxOPimTi9s1O9IIrtgh0g,549
|
|
209
213
|
cognite/neat/rules/issues/base.py,sha256=x2YLCfmqtPlFLoURq3qHaprXCpFaQdf0iWkql-EMyps,2446
|
|
@@ -213,13 +217,19 @@ cognite/neat/rules/issues/formatters.py,sha256=_ag2bJ9hncOj8pAGJvTTEPs9kTtxbD7vk
|
|
|
213
217
|
cognite/neat/rules/issues/importing.py,sha256=uSk4TXo_CO3bglBZkaiWekXLXXd31UWIZE95clVSLz4,13417
|
|
214
218
|
cognite/neat/rules/issues/spreadsheet.py,sha256=jBEczqon1G0H_mCfdCCffWdRLHO5ER8SnGKuR4q4eKs,15882
|
|
215
219
|
cognite/neat/rules/issues/spreadsheet_file.py,sha256=YCp0Pk_TsiqYuOPdWpjUpre-zvi2c5_MvrC_dxw10YY,4964
|
|
216
|
-
cognite/neat/rules/models/__init__.py,sha256=
|
|
217
|
-
cognite/neat/rules/models/_base.py,sha256=
|
|
220
|
+
cognite/neat/rules/models/__init__.py,sha256=IqAg-h8PlcXcR_l-MECNMcVxMecF57vdg-Y488mBgWM,917
|
|
221
|
+
cognite/neat/rules/models/_base.py,sha256=uZrP_TRu3aljL3XZGMyNtlQDsMPwUEsfSNjGhRdMg88,11234
|
|
218
222
|
cognite/neat/rules/models/_constants.py,sha256=zPREgHT79_4FMg58QlaXc7A8XKRJrjP5SUgh63jDnTk,31
|
|
219
223
|
cognite/neat/rules/models/_rdfpath.py,sha256=RoHnfWufjnDtwJh7UUzWKoJz8luvX7Gb5SDQORfkQTE,11030
|
|
220
224
|
cognite/neat/rules/models/_types/__init__.py,sha256=l1tGxzE7ezNHIL72AoEvNHN2IFuitxOLxiHJG__s6t4,305
|
|
221
225
|
cognite/neat/rules/models/_types/_base.py,sha256=2GhLUE1ukV8X8SGL_JDxpbWGZyAvOnSqAE6JmDh5wbI,929
|
|
222
226
|
cognite/neat/rules/models/_types/_field.py,sha256=h2RrhjxdaRbzHG5EyduyHLkCJJmQoyZb9pYCkgMcnVk,3203
|
|
227
|
+
cognite/neat/rules/models/asset/__init__.py,sha256=qNon0kHleCPo2eT82TmeBAfiDDdwdKNU-Xdewuz8JRA,231
|
|
228
|
+
cognite/neat/rules/models/asset/_converter.py,sha256=PrTh9ZZkqSJBviiJE4xc3pClCsaWu2tTYOdgwg6_VOk,150
|
|
229
|
+
cognite/neat/rules/models/asset/_rules.py,sha256=mUgZEExfdMLDdpldfYLEyeWU4e89SKn_nyGv52v-1aQ,6044
|
|
230
|
+
cognite/neat/rules/models/asset/_rules_input.py,sha256=LiT-85CVgDz2ng65CtrRa77r4rnmg3E4Q6DC7-gv0dE,6257
|
|
231
|
+
cognite/neat/rules/models/asset/_serializer.py,sha256=ixqRf9qEzvChgysRaDX4g_vHVDtRBCsPYC9sOn0-ShE,3365
|
|
232
|
+
cognite/neat/rules/models/asset/_validation.py,sha256=86ymEgMZpG1eWu53PviUyUFnQBUJmYDZggUDXufBYLI,148
|
|
223
233
|
cognite/neat/rules/models/data_types.py,sha256=lanwkhwG8iHKfjYfia4v2SBTJrMeXOsqaVkVEP2QMXs,6078
|
|
224
234
|
cognite/neat/rules/models/dms/__init__.py,sha256=Wzyqzz2ZIjpUbDg04CMuuIAw-f2A02DayNeqO9R-2Hw,491
|
|
225
235
|
cognite/neat/rules/models/dms/_converter.py,sha256=QaJT0z0Yo4gkG9tHPZkU8idF8PK7c-tDahbyIT-WJQU,5959
|
|
@@ -230,11 +240,11 @@ cognite/neat/rules/models/dms/_schema.py,sha256=byMG67i80a4sSQS_0k8YGrDvh7whio4i
|
|
|
230
240
|
cognite/neat/rules/models/dms/_serializer.py,sha256=iqp2zyyf8jEcU-R3PERuN8nu248xIqyxiWj4owAn92g,6406
|
|
231
241
|
cognite/neat/rules/models/dms/_validation.py,sha256=5mk9L99FSwC8Ok7weEjnFJ_OZnmqMWUc6XFMTfkqfDw,14549
|
|
232
242
|
cognite/neat/rules/models/domain.py,sha256=wZ-DeIPFnacbNlxSrRuLzUpnhHdTpzNc22z0sDfisi4,2880
|
|
233
|
-
cognite/neat/rules/models/entities.py,sha256=
|
|
243
|
+
cognite/neat/rules/models/entities.py,sha256=qZa_PJOjFk3yTu5NyTSbAjsrU0HUxVnme_7YruBJoRQ,20460
|
|
234
244
|
cognite/neat/rules/models/information/__init__.py,sha256=HR6g8xgyU53U7Ck8pPdbT70817Q4NC1r1pCRq5SA8iw,291
|
|
235
245
|
cognite/neat/rules/models/information/_converter.py,sha256=r0a2uyzv8m82xzAkYt_-ZXdMN5u46SA_mn95Oo7ng-s,11424
|
|
236
|
-
cognite/neat/rules/models/information/_rules.py,sha256=
|
|
237
|
-
cognite/neat/rules/models/information/_rules_input.py,sha256=
|
|
246
|
+
cognite/neat/rules/models/information/_rules.py,sha256=hQihDlji-DV3pmAPxIZpUBP9PVCcZxJXN2KyZZecFeM,13089
|
|
247
|
+
cognite/neat/rules/models/information/_rules_input.py,sha256=ExCjcD0pvsThXYDf3uWYLzSLqN_2OtXFggbW_RB8hr4,10343
|
|
238
248
|
cognite/neat/rules/models/information/_serializer.py,sha256=yti9I_xJruxrib66YIBInhze___Io-oPTQH6uWDumPE,3503
|
|
239
249
|
cognite/neat/rules/models/information/_validation.py,sha256=Is2GzL2lZU3A5zPu3NjvlXfmIU2_Y10C5Nxi5Denz4g,7528
|
|
240
250
|
cognite/neat/rules/models/wrapped_entities.py,sha256=ThhjnNNrpgz0HeORIQ8Q894trxP73P7T_TuZj6qH2CU,7157
|
|
@@ -251,7 +261,7 @@ cognite/neat/utils/exceptions.py,sha256=-w4cAcvcoWLf-_ZwAl7QV_NysfqtQzIOd1Ti-mpx
|
|
|
251
261
|
cognite/neat/utils/spreadsheet.py,sha256=LI0c7dlW0zXHkHw0NvB-gg6Df6cDcE3FbiaHBYLXdzQ,2714
|
|
252
262
|
cognite/neat/utils/text.py,sha256=4bg1_Q0lg7KsoxaDOvXrVyeY78BJN8i-27BlyDzUCls,3082
|
|
253
263
|
cognite/neat/utils/upload.py,sha256=XaAKqyMhz6qXbUrttGNIXZxFRPJvrnbMpDRF8GEiK2g,2707
|
|
254
|
-
cognite/neat/utils/utils.py,sha256=
|
|
264
|
+
cognite/neat/utils/utils.py,sha256=1LEwR8gpHw_6pvEeLkW_cDU_lUun4qSsw_Rr3JsKwgA,14172
|
|
255
265
|
cognite/neat/utils/xml.py,sha256=ppLT3lQKVp8wOP-m8-tFY8uB2P4R76l7R_-kUtsABng,992
|
|
256
266
|
cognite/neat/workflows/__init__.py,sha256=oiKub_U9f5cA0I1nKl5dFkR4BD8_6Be9eMzQ_50PwP0,396
|
|
257
267
|
cognite/neat/workflows/_exceptions.py,sha256=ugI_X1XNpikAiL8zIggBjcx6q7WvOpRIgvxHrj2Rhr4,1348
|
|
@@ -273,7 +283,7 @@ cognite/neat/workflows/migration/steps.py,sha256=4YCPWwfEqzIgLN4lRNx8Y-nj14ptNxH
|
|
|
273
283
|
cognite/neat/workflows/migration/wf_manifests.py,sha256=TIJ9q_sbZ1LVJfUYVk8VRYcxrRHlwyktHRag0OJcVrE,1556
|
|
274
284
|
cognite/neat/workflows/model.py,sha256=LQY7abYnz3CUEIlIEqoj0Eo6Q8yQukTQ0S_sPststCA,6570
|
|
275
285
|
cognite/neat/workflows/steps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
276
|
-
cognite/neat/workflows/steps/data_contracts.py,sha256=
|
|
286
|
+
cognite/neat/workflows/steps/data_contracts.py,sha256=piel9tnZ1q5VBDvHvMgmUnPENe9Knnah2R2wrhPvDpE,3150
|
|
277
287
|
cognite/neat/workflows/steps/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
278
288
|
cognite/neat/workflows/steps/lib/current/__init__.py,sha256=c22IznGdCSNCpXCi_yonlbbywJE1uj6bfVCv0X2LYeE,225
|
|
279
289
|
cognite/neat/workflows/steps/lib/current/graph_extractor.py,sha256=vW9UpJScx5dFVCSairpOdWRdBdLpkCt2kNh6litbF0o,5161
|
|
@@ -297,8 +307,8 @@ cognite/neat/workflows/steps_registry.py,sha256=fkTX14ZA7_gkUYfWIlx7A1XbCidvqR23
|
|
|
297
307
|
cognite/neat/workflows/tasks.py,sha256=dqlJwKAb0jlkl7abbY8RRz3m7MT4SK8-7cntMWkOYjw,788
|
|
298
308
|
cognite/neat/workflows/triggers.py,sha256=_BLNplzoz0iic367u1mhHMHiUrCwP-SLK6_CZzfODX0,7071
|
|
299
309
|
cognite/neat/workflows/utils.py,sha256=gKdy3RLG7ctRhbCRwaDIWpL9Mi98zm56-d4jfHDqP1E,453
|
|
300
|
-
cognite_neat-0.
|
|
301
|
-
cognite_neat-0.
|
|
302
|
-
cognite_neat-0.
|
|
303
|
-
cognite_neat-0.
|
|
304
|
-
cognite_neat-0.
|
|
310
|
+
cognite_neat-0.82.1.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
|
|
311
|
+
cognite_neat-0.82.1.dist-info/METADATA,sha256=fy-PzFxaU52cR35aAHSXj9WhBJdR51STymkH-e6JgJg,9290
|
|
312
|
+
cognite_neat-0.82.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
313
|
+
cognite_neat-0.82.1.dist-info/entry_points.txt,sha256=61FPqiWb25vbqB0KI7znG8nsg_ibLHBvTjYnkPvNFso,50
|
|
314
|
+
cognite_neat-0.82.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|