cognite-neat 0.123.42__py3-none-any.whl → 0.123.43__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/_data_model/models/conceptual/_data_model.py +51 -0
- cognite/neat/_data_model/models/conceptual/_property.py +3 -2
- cognite/neat/_version.py +1 -1
- {cognite_neat-0.123.42.dist-info → cognite_neat-0.123.43.dist-info}/METADATA +1 -1
- {cognite_neat-0.123.42.dist-info → cognite_neat-0.123.43.dist-info}/RECORD +7 -6
- {cognite_neat-0.123.42.dist-info → cognite_neat-0.123.43.dist-info}/WHEEL +0 -0
- {cognite_neat-0.123.42.dist-info → cognite_neat-0.123.43.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from collections import Counter
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, ValidationInfo, field_validator
|
|
4
|
+
|
|
5
|
+
from cognite.neat._data_model.models.entities._constants import PREFIX_PATTERN, SUFFIX_PATTERN, VERSION_PATTERN
|
|
6
|
+
from cognite.neat._utils.text import humanize_collection
|
|
7
|
+
from cognite.neat.v0.core._data_model.models.entities._single_value import ConceptEntity
|
|
8
|
+
|
|
9
|
+
from ._base import ResourceMetadata
|
|
10
|
+
from ._concept import Concept
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DataModel(ResourceMetadata):
|
|
14
|
+
space: str = Field(
|
|
15
|
+
description="Id of the space that the concept belongs to.",
|
|
16
|
+
min_length=1,
|
|
17
|
+
max_length=43,
|
|
18
|
+
pattern=PREFIX_PATTERN,
|
|
19
|
+
alias="prefix",
|
|
20
|
+
)
|
|
21
|
+
external_id: str = Field(
|
|
22
|
+
description="External-id of the concept.",
|
|
23
|
+
min_length=1,
|
|
24
|
+
max_length=255,
|
|
25
|
+
pattern=SUFFIX_PATTERN,
|
|
26
|
+
alias="suffix",
|
|
27
|
+
)
|
|
28
|
+
version: str = Field(
|
|
29
|
+
description="Version of the concept.",
|
|
30
|
+
max_length=43,
|
|
31
|
+
pattern=VERSION_PATTERN,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
concepts: list[Concept] = Field(
|
|
35
|
+
description="References to the concepts from where this concept will inherit properties.",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
@field_validator("concepts", mode="after")
|
|
39
|
+
def cannot_have_duplicates(cls, value: list[Concept], info: ValidationInfo) -> list[Concept]:
|
|
40
|
+
concept_ids = [
|
|
41
|
+
ConceptEntity(prefix=concept.space, suffix=concept.external_id, version=concept.version)
|
|
42
|
+
for concept in value
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
counts = Counter(concept_ids)
|
|
46
|
+
duplicates = {concept for concept, count in counts.items() if count > 1}
|
|
47
|
+
|
|
48
|
+
if duplicates:
|
|
49
|
+
raise ValueError(f"Duplicate concepts found: {humanize_collection(duplicates)}")
|
|
50
|
+
|
|
51
|
+
return value
|
|
@@ -78,11 +78,12 @@ class Property(ResourceMetadata):
|
|
|
78
78
|
return value
|
|
79
79
|
|
|
80
80
|
max_count = info.data.get("max_count")
|
|
81
|
+
min_count = info.data.get("min_count")
|
|
81
82
|
|
|
82
|
-
if max_count is None or max_count > 1:
|
|
83
|
+
if max_count is None or max_count > 1 or (min_count and min_count > 1):
|
|
83
84
|
raise ValueError(
|
|
84
85
|
"Setting default value is only supported for single-valued properties."
|
|
85
|
-
f" Property has
|
|
86
|
+
f" Property has min_count={info.data.get('min_count')} and max_count={info.data.get('max_count')}."
|
|
86
87
|
)
|
|
87
88
|
return value
|
|
88
89
|
|
cognite/neat/_version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.123.
|
|
1
|
+
__version__ = "0.123.43"
|
|
2
2
|
__engine__ = "^2.0.4"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cognite-neat
|
|
3
|
-
Version: 0.123.
|
|
3
|
+
Version: 0.123.43
|
|
4
4
|
Summary: Knowledge graph transformation
|
|
5
5
|
Project-URL: Documentation, https://cognite-neat.readthedocs-hosted.com/
|
|
6
6
|
Project-URL: Homepage, https://cognite-neat.readthedocs-hosted.com/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
cognite/neat/__init__.py,sha256=Lo4DbjDOwnhCYUoAgPp5RG1fDdF7OlnomalTe7n1ydw,211
|
|
2
2
|
cognite/neat/_issues.py,sha256=uv0fkkWwTKqNmTmHqyoBB3L6yMCh42EZpEkLGmIJYOY,812
|
|
3
|
-
cognite/neat/_version.py,sha256=
|
|
3
|
+
cognite/neat/_version.py,sha256=dEWoG_6PogUbhTlc8CLubWeLvGWXiuXTv6Q2rLO3bJs,47
|
|
4
4
|
cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
cognite/neat/_data_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
cognite/neat/_data_model/_constants.py,sha256=NGGvWHlQqhkkSBP_AqoofGYjNph3SiZX6QPINlMsy04,107
|
|
@@ -11,8 +11,9 @@ cognite/neat/_data_model/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
|
|
|
11
11
|
cognite/neat/_data_model/models/conceptual/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
cognite/neat/_data_model/models/conceptual/_base.py,sha256=SFkoBJDM51pqew_isHFJoB20OgfofpwVRnTrg-rKkNY,710
|
|
13
13
|
cognite/neat/_data_model/models/conceptual/_concept.py,sha256=0Pk4W2TJ_Y0Z7oPHpzely1kPXrAkmkyqw6a0n3il6LY,2248
|
|
14
|
+
cognite/neat/_data_model/models/conceptual/_data_model.py,sha256=mSX0z8i29ufcRUhvC_NPeo2xGidlK3B1n89kngY_SqQ,1695
|
|
14
15
|
cognite/neat/_data_model/models/conceptual/_properties.py,sha256=CpF37vJYBTLT4DH4ZOu2U-JyWtkb_27V8fw52qiaE_k,4007
|
|
15
|
-
cognite/neat/_data_model/models/conceptual/_property.py,sha256=
|
|
16
|
+
cognite/neat/_data_model/models/conceptual/_property.py,sha256=blSZQxX52zaILAtjUkldPzPeysz7wnG-UGSNU5tacI8,4138
|
|
16
17
|
cognite/neat/_data_model/models/dms/__init__.py,sha256=I_yw2GoEjUdLk8VOiLSlU4BWgE3u_GgCHJayeEa1w1w,3583
|
|
17
18
|
cognite/neat/_data_model/models/dms/_base.py,sha256=R8SP3Zi9daTBqewYKGjuNEkrWc-j91f-6t34CN-9YJ0,719
|
|
18
19
|
cognite/neat/_data_model/models/dms/_constants.py,sha256=wBkLjAPwufPc2naxOfPA1XC0CM2RbDbo6Dpiv9dPrew,1344
|
|
@@ -231,7 +232,7 @@ cognite/neat/v0/session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4
|
|
|
231
232
|
cognite/neat/v0/session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
|
|
232
233
|
cognite/neat/v0/session/engine/_interface.py,sha256=3W-cYr493c_mW3P5O6MKN1xEQg3cA7NHR_ev3zdF9Vk,533
|
|
233
234
|
cognite/neat/v0/session/engine/_load.py,sha256=u0x7vuQCRoNcPt25KJBJRn8sJabonYK4vtSZpiTdP4k,5201
|
|
234
|
-
cognite_neat-0.123.
|
|
235
|
-
cognite_neat-0.123.
|
|
236
|
-
cognite_neat-0.123.
|
|
237
|
-
cognite_neat-0.123.
|
|
235
|
+
cognite_neat-0.123.43.dist-info/METADATA,sha256=R09xC2ziQsAEfmEMQ9tnUDA57fIpJstPhY7GUVqrFWc,9148
|
|
236
|
+
cognite_neat-0.123.43.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
237
|
+
cognite_neat-0.123.43.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
|
|
238
|
+
cognite_neat-0.123.43.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|