cognite-neat 0.127.22__py3-none-any.whl → 0.127.24__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.
@@ -13,7 +13,11 @@ from ._connections import (
13
13
  ReverseConnectionTargetMissing,
14
14
  )
15
15
  from ._consistency import ViewSpaceVersionInconsistentWithDataModel
16
- from ._containers import ExternalContainerDoesNotExist, RequiredContainerDoesNotExist
16
+ from ._containers import (
17
+ ExternalContainerDoesNotExist,
18
+ ExternalContainerPropertyDoesNotExist,
19
+ RequiredContainerDoesNotExist,
20
+ )
17
21
  from ._limits import (
18
22
  ContainerPropertyCountIsOutOfLimits,
19
23
  ContainerPropertyListSizeIsOutOfLimits,
@@ -36,6 +40,7 @@ __all__ = [
36
40
  "DataModelViewCountIsOutOfLimits",
37
41
  "DmsDataModelValidation",
38
42
  "ExternalContainerDoesNotExist",
43
+ "ExternalContainerPropertyDoesNotExist",
39
44
  "ImplementedViewNotExisting",
40
45
  "RequiredContainerDoesNotExist",
41
46
  "ReverseConnectionContainerMissing",
@@ -12,17 +12,15 @@ BASE_CODE = "NEAT-DMS-CONTAINER"
12
12
 
13
13
  class ExternalContainerDoesNotExist(DataModelValidator):
14
14
  """
15
- Validates that any container or container property referenced by a view property, when the
15
+ Validates that any container referenced by a view property, when the
16
16
  referenced container does not belong to the data model's space, exists in CDF.
17
17
 
18
18
  ## What it does
19
19
  For each view property that maps to a container in a different space than the data model,
20
- this validator checks that:
21
- - the referenced external container exists in CDF, and
22
- - that the referenced container property also exists in that external container.
20
+ this validator checks that the referenced external container exists in CDF.
23
21
 
24
22
  ## Why is this bad?
25
- If a view property references a container or container property that does not exist in CDF,
23
+ If a view property references a container that does not exist in CDF,
26
24
  the data model cannot be deployed. The affected view property will not function, and the
27
25
  deployment of the entire data model will fail.
28
26
 
@@ -30,10 +28,6 @@ class ExternalContainerDoesNotExist(DataModelValidator):
30
28
  View `my_space:WindTurbine` has a property `location` that maps to container
31
29
  `other_space:WindTurbineContainer`, where `other_space` differs from `my_space`. If that
32
30
  container does not exist in CDF, the model cannot be deployed.
33
-
34
- Similarly, if a view property references `other_space:WindTurbineContainer` and its property
35
- `gpsCoordinates`, and `gpsCoordinates` does not exist in that container in CDF, deployment
36
- will also fail.
37
31
  """
38
32
 
39
33
  code = f"{BASE_CODE}-001"
@@ -50,7 +44,7 @@ class ExternalContainerDoesNotExist(DataModelValidator):
50
44
  continue
51
45
 
52
46
  # Check existence of container in CDF
53
- elif property_.container not in self.cdf_resources.containers_by_reference:
47
+ if property_.container not in self.cdf_resources.containers_by_reference:
54
48
  errors.append(
55
49
  ConsistencyError(
56
50
  message=(
@@ -62,8 +56,50 @@ class ExternalContainerDoesNotExist(DataModelValidator):
62
56
  )
63
57
  )
64
58
 
59
+ return errors
60
+
61
+
62
+ class ExternalContainerPropertyDoesNotExist(DataModelValidator):
63
+ """
64
+ Validates that any container property referenced by a view property, when the
65
+ referenced container does not belong to the data model's space, exists in CDF.
66
+
67
+ ## What it does
68
+ For each view property that maps to a container in a different space than the data model,
69
+ this validator checks that the referenced container property exists in that external container in CDF.
70
+ This validator only runs if the external container exists in CDF.
71
+
72
+ ## Why is this bad?
73
+ If a view property references a container property that does not exist in CDF,
74
+ the data model cannot be deployed. The affected view property will not function, and the
75
+ deployment of the entire data model will fail.
76
+
77
+ ## Example
78
+ View `my_space:WindTurbine` has a property `location` that maps to container property
79
+ `gpsCoordinates` in `other_space:WindTurbineContainer`. If `gpsCoordinates` does not exist
80
+ in that container in CDF, deployment will fail.
81
+ """
82
+
83
+ code = f"{BASE_CODE}-002"
84
+
85
+ def run(self) -> list[ConsistencyError]:
86
+ errors: list[ConsistencyError] = []
87
+
88
+ for view_ref, view in self.merged_views.items():
89
+ for property_ref, property_ in view.properties.items():
90
+ if not isinstance(property_, ViewCorePropertyRequest):
91
+ continue
92
+
93
+ if property_.container.space == self.local_resources.data_model_reference.space:
94
+ continue
95
+
96
+ # Only check property if container exists in CDF
97
+ # this check is done in ExternalContainerDoesNotExist
98
+ if property_.container not in self.cdf_resources.containers_by_reference:
99
+ continue
100
+
65
101
  # Check existence of container property in CDF
66
- elif (
102
+ if (
67
103
  property_.container_property_identifier
68
104
  not in self.cdf_resources.containers_by_reference[property_.container].properties
69
105
  ):
@@ -100,7 +136,7 @@ class RequiredContainerDoesNotExist(DataModelValidator):
100
136
  If `windy_space:LocationContainer` does not exist in the data model or in CDF, deployment will fail.
101
137
  """
102
138
 
103
- code = f"{BASE_CODE}-002"
139
+ code = f"{BASE_CODE}-003"
104
140
 
105
141
  def run(self) -> list[ConsistencyError]:
106
142
  errors: list[ConsistencyError] = []
@@ -35,7 +35,11 @@ from ._connections import (
35
35
  ReverseConnectionTargetMissing,
36
36
  )
37
37
  from ._consistency import ViewSpaceVersionInconsistentWithDataModel
38
- from ._containers import ExternalContainerDoesNotExist, RequiredContainerDoesNotExist
38
+ from ._containers import (
39
+ ExternalContainerDoesNotExist,
40
+ ExternalContainerPropertyDoesNotExist,
41
+ RequiredContainerDoesNotExist,
42
+ )
39
43
  from ._views import ImplementedViewNotExisting, ViewToContainerMappingNotPossible
40
44
 
41
45
 
@@ -116,6 +120,7 @@ class DmsDataModelValidation(OnSuccessIssuesChecker):
116
120
  ImplementedViewNotExisting(local_resources, cdf_resources, self._modus_operandi),
117
121
  # Containers
118
122
  ExternalContainerDoesNotExist(local_resources, cdf_resources, self._modus_operandi),
123
+ ExternalContainerPropertyDoesNotExist(local_resources, cdf_resources, self._modus_operandi),
119
124
  RequiredContainerDoesNotExist(local_resources, cdf_resources, self._modus_operandi),
120
125
  # Consistency
121
126
  ViewSpaceVersionInconsistentWithDataModel(local_resources, cdf_resources, self._modus_operandi),
@@ -93,6 +93,8 @@ def humanize_validation_error(
93
93
  )
94
94
  elif type_ == "union_tag_invalid":
95
95
  msg = error["msg"].replace(", 'direct'", "").replace("found using 'type' ", "").replace("tag", "value")
96
+ elif type_ == "string_pattern_mismatch":
97
+ msg = f"string '{error['input']}' does not match the required pattern: '{error['ctx']['pattern']}'."
96
98
 
97
99
  elif type_.endswith("_type"):
98
100
  msg = f"{error['msg']}. Got {error['input']!r} of type {type(error['input']).__name__}."
@@ -142,8 +144,11 @@ def _enum_message(type_: str, loc: tuple[int | str, ...], context: ValidationCon
142
144
  if loc[-1] != "values":
143
145
  raise RuntimeError("This is a neat bug, report to the team.")
144
146
  if type_ == "missing":
145
- return f"In {context.humanize_location(loc[:-1])} definition is missing the collection reference"
147
+ return (
148
+ f"In {context.humanize_location(loc[:-1])} definition should include "
149
+ "a reference to a collection in the 'Enum' sheet (e.g., collection='MyEnumCollection')."
150
+ )
146
151
  elif type_ == "too_short":
147
- return f"In {context.humanize_location(loc[:-1])} collection is not defined in 'Enum' sheet"
152
+ return f"In {context.humanize_location(loc[:-1])} collection is not defined in the 'Enum' sheet"
148
153
  else:
149
154
  raise RuntimeError("This is a neat bug, report to the team.")
cognite/neat/_version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.127.22"
1
+ __version__ = "0.127.24"
2
2
  __engine__ = "^2.0.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-neat
3
- Version: 0.127.22
3
+ Version: 0.127.24
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,7 +1,7 @@
1
1
  cognite/neat/__init__.py,sha256=Lo4DbjDOwnhCYUoAgPp5RG1fDdF7OlnomalTe7n1ydw,211
2
2
  cognite/neat/_exceptions.py,sha256=ox-5hXpee4UJlPE7HpuEHV2C96aLbLKo-BhPDoOAzhA,1650
3
3
  cognite/neat/_issues.py,sha256=wH1mnkrpBsHUkQMGUHFLUIQWQlfJ_qMfdF7q0d9wNhY,1871
4
- cognite/neat/_version.py,sha256=Lln5aX0eKRyzYKw67isIIefxhPXDVBWcCGy6IFleQUM,47
4
+ cognite/neat/_version.py,sha256=LNaUX8rigYyV0YJJO1DIZXt21i_AUALgOhe4snlff6o,47
5
5
  cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  cognite/neat/v1.py,sha256=owqW5Mml2DSZx1AvPvwNRTBngfhBNrQ6EH-7CKL7Jp0,61
7
7
  cognite/neat/_client/__init__.py,sha256=75Bh7eGhaN4sOt3ZcRzHl7pXaheu1z27kmTHeaI05vo,114
@@ -73,14 +73,14 @@ cognite/neat/_data_model/models/entities/_data_types.py,sha256=DfdEWGek7gODro-_0
73
73
  cognite/neat/_data_model/models/entities/_identifiers.py,sha256=uBiK4ot3V0b_LGXuJ7bfha6AEcFI3p2letr1z2iSvig,1923
74
74
  cognite/neat/_data_model/models/entities/_parser.py,sha256=zef_pSDZYMZrJl4IKreFDR577KutfhtN1xpH3Ayjt2o,7669
75
75
  cognite/neat/_data_model/validation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
- cognite/neat/_data_model/validation/dms/__init__.py,sha256=y-7ISQri7EVZJDNcDgtxpnCm6c_JulrLmmxOeHPJNm0,2256
76
+ cognite/neat/_data_model/validation/dms/__init__.py,sha256=qK9zBaXHj7x9k7geA1fRk6ewRB_hGm7bcq69WlDyffc,2357
77
77
  cognite/neat/_data_model/validation/dms/_ai_readiness.py,sha256=SI46roGc2pbZQwY-6tuSWyS7uMbg2mIzXcVA3NPRCk4,6742
78
78
  cognite/neat/_data_model/validation/dms/_base.py,sha256=y95k6HWGxX_EnnyuV2ooftgiyC-fwJaaHW28oEf9oBs,13113
79
79
  cognite/neat/_data_model/validation/dms/_connections.py,sha256=goIcsGV4yYb-d9ltXg4eM5qxt8iErIIxtkiKJXZUYyM,26937
80
80
  cognite/neat/_data_model/validation/dms/_consistency.py,sha256=K0mfAwwpW6zQXGDEldrA7Lgqk-giV_Y-gUKyb8Dw47k,2445
81
- cognite/neat/_data_model/validation/dms/_containers.py,sha256=Vs5Zj0NWVuO0APDEZaO7q2U877-tJzTDpaaCEd5AcTA,5991
81
+ cognite/neat/_data_model/validation/dms/_containers.py,sha256=Jqwu2JH36eyqA7xt6_UaLEl-zhZi4itI1dmb73GpJMY,7431
82
82
  cognite/neat/_data_model/validation/dms/_limits.py,sha256=LVxF1qmeEdUVVAPmywCgxWJ9BR7Ai6nI4X1ylJ7pv8I,15982
83
- cognite/neat/_data_model/validation/dms/_orchestrator.py,sha256=FChXB7zflQtnR46BRUFkDCwosLu9YeFLeydEoyFtpVI,10176
83
+ cognite/neat/_data_model/validation/dms/_orchestrator.py,sha256=4_KHtfJcuXSSIP7sazhBzM4_nSEz0d77CrsX5rmShOc,10337
84
84
  cognite/neat/_data_model/validation/dms/_views.py,sha256=3bHEEbFKTR_QH_tiJYHppQsZ9ruApv-kdyfehEjIlCU,4198
85
85
  cognite/neat/_session/__init__.py,sha256=owqW5Mml2DSZx1AvPvwNRTBngfhBNrQ6EH-7CKL7Jp0,61
86
86
  cognite/neat/_session/_issues.py,sha256=E8UQeSJURg2dm4MF1pfD9dp-heSRT7pgQZgKlD1-FGs,2723
@@ -116,7 +116,7 @@ cognite/neat/_utils/auxiliary.py,sha256=Cx-LP8dfN782R3iUcm--q26zdzQ0k_RFnVbJ0bwV
116
116
  cognite/neat/_utils/collection.py,sha256=BIwRrFbUXNPvHhEVujLHgVoDJXzdPEMScrbSBhyCibk,446
117
117
  cognite/neat/_utils/text.py,sha256=-ujNaG_hLkdurKsUmZB9ZI_kJkddlCKEf8g-g_XCk10,2010
118
118
  cognite/neat/_utils/useful_types.py,sha256=BwTjcWnpxnxN8rWXuYXMgU55O_YjVteMtYK0y25OmH0,1260
119
- cognite/neat/_utils/validation.py,sha256=Pg6EzS-sxB3k4P3OR1O15SSqBXIzpbPwvPSrosOxNJk,6675
119
+ cognite/neat/_utils/validation.py,sha256=U422V0TY5KujFJFyfhRLONVj5A4AcCWgqIKVK6BUm7M,6938
120
120
  cognite/neat/_utils/http_client/__init__.py,sha256=qaCLLLhi7H3b_cmbknX0S66KILT7JSKX1YSgZjNdd1U,786
121
121
  cognite/neat/_utils/http_client/_client.py,sha256=TO9C77LcsqX0R3Fu-mP560nnV6rP5oRXki9kxRYtBlg,9658
122
122
  cognite/neat/_utils/http_client/_config.py,sha256=C8IF1JoijmVMjA_FEMgAkiD1buEV1cY5Og3t-Ecyfmk,756
@@ -312,7 +312,7 @@ cognite/neat/v0/session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4
312
312
  cognite/neat/v0/session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
313
313
  cognite/neat/v0/session/engine/_interface.py,sha256=3W-cYr493c_mW3P5O6MKN1xEQg3cA7NHR_ev3zdF9Vk,533
314
314
  cognite/neat/v0/session/engine/_load.py,sha256=u0x7vuQCRoNcPt25KJBJRn8sJabonYK4vtSZpiTdP4k,5201
315
- cognite_neat-0.127.22.dist-info/METADATA,sha256=Z7803rtujMVrtcXDwv6nG-sVhmPaEM7WBZhK-41Lryk,9150
316
- cognite_neat-0.127.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
317
- cognite_neat-0.127.22.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
318
- cognite_neat-0.127.22.dist-info/RECORD,,
315
+ cognite_neat-0.127.24.dist-info/METADATA,sha256=MAWzw07h5PAWRf-4uH9i42Ljqj4n5f_DUI29VJ8ka_I,9150
316
+ cognite_neat-0.127.24.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
317
+ cognite_neat-0.127.24.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
318
+ cognite_neat-0.127.24.dist-info/RECORD,,