cognite-neat 0.123.12__py3-none-any.whl → 0.123.13__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 CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.123.12"
1
+ __version__ = "0.123.13"
2
2
  __engine__ = "^2.0.4"
@@ -78,7 +78,7 @@ class UnverifiedConceptualMetadata(UnverifiedComponent[ConceptualMetadata]):
78
78
 
79
79
  @dataclass
80
80
  class UnverifiedConceptualProperty(UnverifiedComponent[ConceptualProperty]):
81
- concept: ConceptEntity | str
81
+ concept: ConceptEntity | str | UnknownEntity
82
82
  property_: str
83
83
  value_type: DataType | ConceptEntity | MultiValueTypeInfo | UnknownEntity | str
84
84
  name: str | None = None
@@ -11,7 +11,11 @@ from cognite.neat.core._issues.errors._resources import (
11
11
  ResourceDuplicatedError,
12
12
  ResourceNotDefinedError,
13
13
  )
14
- from cognite.neat.core._issues.warnings._models import ConceptOnlyDataModelWarning, UndefinedConceptWarning
14
+ from cognite.neat.core._issues.warnings._models import (
15
+ ConceptOnlyDataModelWarning,
16
+ DanglingPropertyWarning,
17
+ UndefinedConceptWarning,
18
+ )
15
19
  from cognite.neat.core._issues.warnings._resources import (
16
20
  ResourceNotDefinedWarning,
17
21
  ResourceRegexViolationWarning,
@@ -47,6 +51,7 @@ class ConceptualValidation:
47
51
  self._referenced_classes_exist()
48
52
  self._referenced_value_types_exist()
49
53
  self._concept_only_data_model()
54
+ self._dangling_properties()
50
55
  self._regex_compliance_with_physical_data_model()
51
56
 
52
57
  return self.issue_list
@@ -56,6 +61,13 @@ class ConceptualValidation:
56
61
  if not self._properties:
57
62
  self.issue_list.append(ConceptOnlyDataModelWarning())
58
63
 
64
+ def _dangling_properties(self) -> None:
65
+ """Check if there are properties that do not reference any concept."""
66
+ dangling_properties = [prop for prop in self._properties if prop.concept == UnknownEntity()]
67
+ if dangling_properties:
68
+ for prop in dangling_properties:
69
+ self.issue_list.append(DanglingPropertyWarning(property_id=prop.property_))
70
+
59
71
  def _duplicated_resources(self) -> None:
60
72
  properties_sheet = self._read_info_by_spreadsheet.get("Properties")
61
73
  concepts_sheet = self._read_info_by_spreadsheet.get("Concepts")
@@ -119,7 +131,7 @@ class ConceptualValidation:
119
131
 
120
132
  def _undefined_classes(self) -> None:
121
133
  defined_concept = {concept.concept for concept in self._concepts}
122
- referred_concepts = {property_.concept for property_ in self._properties}
134
+ referred_concepts = {property_.concept for property_ in self._properties} - {UnknownEntity()}
123
135
 
124
136
  if undefined_concepts := referred_concepts.difference(defined_concept):
125
137
  for concept in undefined_concepts:
@@ -199,7 +211,7 @@ class ConceptualValidation:
199
211
  PATTERNS.physical_property_id_compliance.pattern,
200
212
  )
201
213
  )
202
- if not PATTERNS.view_id_compliance.match(prop_.concept.suffix):
214
+ if prop_.concept != UnknownEntity() and not PATTERNS.view_id_compliance.match(prop_.concept.suffix):
203
215
  self.issue_list.append(
204
216
  ResourceRegexViolationWarning(
205
217
  prop_.concept,
@@ -123,7 +123,7 @@ class ConceptualProperty(SheetRow):
123
123
  knowledge graph. Defaults to None (no transformation)
124
124
  """
125
125
 
126
- concept: ConceptEntityType = Field(
126
+ concept: ConceptEntityType | UnknownEntity = Field(
127
127
  alias="Concept",
128
128
  description="Concept id that the property is defined for, strongly advise `PascalCase` usage.",
129
129
  )
@@ -109,6 +109,16 @@ class ConceptOnlyDataModelWarning(UserModelingWarning):
109
109
  fix = "Define properties for concepts or make sure that concepts implement other concepts that have properties."
110
110
 
111
111
 
112
+ @dataclass(unsafe_hash=True)
113
+ class DanglingPropertyWarning(UserModelingWarning):
114
+ """Property {property_id} is not defined for any concept.
115
+ This will likely cause issues when converting to a physical data model."""
116
+
117
+ fix = "Define the property for a concept or remove it from the data model."
118
+
119
+ property_id: str
120
+
121
+
112
122
  @dataclass(unsafe_hash=True)
113
123
  class UndefinedViewWarning(UserModelingWarning):
114
124
  """Undefined view {value_type} has been referred as value type for property <{view_property}> of view {view_id}."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-neat
3
- Version: 0.123.12
3
+ Version: 0.123.13
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,5 +1,5 @@
1
1
  cognite/neat/__init__.py,sha256=12StS1dzH9_MElqxGvLWrNsxCJl9Hv8A2a9D0E5OD_U,193
2
- cognite/neat/_version.py,sha256=Mzqn-YIDR_mqLMU1RkQCFPerYxlahGnGKv-rz3QId68,47
2
+ cognite/neat/_version.py,sha256=_QVfpGepX4UR60nDrdZHGAkCm6OBHOLQ084t96SzBBo,47
3
3
  cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cognite/neat/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  cognite/neat/core/_config.py,sha256=WT1BS8uADcFvGoUYOOfwFOVq_VBl472TisdoA3wLick,280
@@ -51,9 +51,9 @@ cognite/neat/core/_data_model/models/_base_verified.py,sha256=nzPrlj7ZvYull_Fdh2
51
51
  cognite/neat/core/_data_model/models/_types.py,sha256=70E8fiLdZkVF2sDUGPuDhzXNA5niVECkVDI7YN0NF60,5488
52
52
  cognite/neat/core/_data_model/models/data_types.py,sha256=uQ_u9KxCetLjxo-VtFzOXSxQuuf97Kg-9lfTTGzY6hc,10150
53
53
  cognite/neat/core/_data_model/models/conceptual/__init__.py,sha256=9A6myEV8s0-LqdXejaljqPj8S0pIpUL75rNdRDZzyR8,585
54
- cognite/neat/core/_data_model/models/conceptual/_unverified.py,sha256=ufNHLd9czY0XHV_C2zbQDarKSPeew7ohRbmq6dyo-_o,6282
55
- cognite/neat/core/_data_model/models/conceptual/_validation.py,sha256=twgVP-SQypAf3R8RB5Rp8EjCgblePK_zUbUyYQfut28,13339
56
- cognite/neat/core/_data_model/models/conceptual/_verified.py,sha256=HPNjzASKP9hs8lI8Xxfvdl2a9MdlP-JoEtXFk0a2ISw,13700
54
+ cognite/neat/core/_data_model/models/conceptual/_unverified.py,sha256=VswgnTSjSCRzBX3z5HvintBGaWBPexxIs-7z7S4J57c,6298
55
+ cognite/neat/core/_data_model/models/conceptual/_validation.py,sha256=tPU8IGV5eiiReF40igjs0t7rMdYnaMcshKa01CY-JKI,13868
56
+ cognite/neat/core/_data_model/models/conceptual/_verified.py,sha256=BUB4Ur4kpBoWiwTf57tjxJ2l0tDTSbY7zGrg1g0yVNQ,13716
57
57
  cognite/neat/core/_data_model/models/entities/__init__.py,sha256=UsW-_6fwd-TW0WcnShPKf40h75l1elVn80VurUwRAic,1567
58
58
  cognite/neat/core/_data_model/models/entities/_constants.py,sha256=GXRzVfArwxF3C67VCkzy0JWTZRkRJUYXBQaaecrqcWc,351
59
59
  cognite/neat/core/_data_model/models/entities/_loaders.py,sha256=PkrVtGlZWYLvAVIRABrgVSgkMvJYpBqdrHBfz-H0Ut8,2783
@@ -131,7 +131,7 @@ cognite/neat/core/_issues/errors/_wrapper.py,sha256=clhuSwUuHy-FQXQopFIQRY8c_NZM
131
131
  cognite/neat/core/_issues/warnings/__init__.py,sha256=lzNZrguzwXyifehsCilAXa5UL94DWHIeO-slyC-EYZc,3165
132
132
  cognite/neat/core/_issues/warnings/_external.py,sha256=w-1R7ea6DXTIWqwlwMMjY0YxKDMSJ8gKAbp_nIIM1AI,1324
133
133
  cognite/neat/core/_issues/warnings/_general.py,sha256=_6dAFaMz-LIv7GsBBIBq2d-kmbuxVXKvU4jZeb7tjAo,972
134
- cognite/neat/core/_issues/warnings/_models.py,sha256=mnoNxVvTifkIGxOxXAgdY-5ZDwy_IyxNsIxdTIcXdNY,4759
134
+ cognite/neat/core/_issues/warnings/_models.py,sha256=dE8Ha96WtZ9m_Bozx64NCMuJY2gWZleicD5tnnOqbe8,5086
135
135
  cognite/neat/core/_issues/warnings/_properties.py,sha256=I3vqc1aL-ce_FRQNgQQy34RW7kQxcjbwhZIIVtGVmg8,3807
136
136
  cognite/neat/core/_issues/warnings/_resources.py,sha256=_iPRq0pRMmRu3LFjqZTaG3OqOzw4f8-Vc9G4Im__FHc,3578
137
137
  cognite/neat/core/_issues/warnings/user_modeling.py,sha256=Qn_S8TLw7MMYQaJcZBScJA48kz_PrTWz0NaepSR70Fk,4144
@@ -186,7 +186,7 @@ cognite/neat/session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4dvc
186
186
  cognite/neat/session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
187
187
  cognite/neat/session/engine/_interface.py,sha256=3W-cYr493c_mW3P5O6MKN1xEQg3cA7NHR_ev3zdF9Vk,533
188
188
  cognite/neat/session/engine/_load.py,sha256=g52uYakQM03VqHt_RDHtpHso1-mFFifH5M4T2ScuH8A,5198
189
- cognite_neat-0.123.12.dist-info/METADATA,sha256=U5jaZlc_AdCI7uML_9DBtq-V7bEIciJgBDxR8brvp0E,9172
190
- cognite_neat-0.123.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
191
- cognite_neat-0.123.12.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
192
- cognite_neat-0.123.12.dist-info/RECORD,,
189
+ cognite_neat-0.123.13.dist-info/METADATA,sha256=nvoEO8JM0qcLabmwghL9j-0ncS7LPeNB5NocH23DPsM,9172
190
+ cognite_neat-0.123.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
191
+ cognite_neat-0.123.13.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
192
+ cognite_neat-0.123.13.dist-info/RECORD,,