cognite-neat 0.123.17__py3-none-any.whl → 0.123.18__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.17"
1
+ __version__ = "0.123.18"
2
2
  __engine__ = "^2.0.4"
@@ -13,6 +13,7 @@ from cognite.neat.core._issues.errors._resources import (
13
13
  )
14
14
  from cognite.neat.core._issues.warnings._models import (
15
15
  ConceptOnlyDataModelWarning,
16
+ ConversionToPhysicalModelImpossibleWarning,
16
17
  DanglingPropertyWarning,
17
18
  UndefinedConceptWarning,
18
19
  )
@@ -61,9 +62,30 @@ class ConceptualValidation:
61
62
 
62
63
  self._concept_only_data_model()
63
64
  self._regex_compliance_with_physical_data_model()
65
+ self._physical_data_model_conversion()
64
66
 
65
67
  return self.issue_list
66
68
 
69
+ def _physical_data_model_conversion(self) -> None:
70
+ """Check if the conceptual data model has issues that will likely lead
71
+ to problems when converting to a physical data model."""
72
+ warning_types_preventing_conversion = [
73
+ ConceptOnlyDataModelWarning,
74
+ ResourceRegexViolationWarning,
75
+ ResourceNotDefinedWarning,
76
+ UndefinedConceptWarning,
77
+ DanglingPropertyWarning,
78
+ ]
79
+
80
+ if seen_warnings := frozenset(
81
+ [
82
+ warning_type.__name__
83
+ for warning_type in warning_types_preventing_conversion
84
+ if self.issue_list.has_warning_type(warning_type)
85
+ ]
86
+ ):
87
+ self.issue_list.append_if_not_exist(ConversionToPhysicalModelImpossibleWarning(issue_types=seen_warnings))
88
+
67
89
  def _concept_only_data_model(self) -> None:
68
90
  """Check if the data model only consists of concepts without any properties."""
69
91
  if not self._properties:
@@ -23,6 +23,7 @@ from ._general import (
23
23
  from ._models import (
24
24
  BreakingModelingPrincipleWarning,
25
25
  CDFNotSupportedWarning,
26
+ ConversionToPhysicalModelImpossibleWarning,
26
27
  NotSupportedHasDataFilterLimitWarning,
27
28
  NotSupportedViewContainerLimitWarning,
28
29
  PrincipleMatchingSpaceAndVersionWarning,
@@ -58,6 +59,7 @@ __all__ = [
58
59
  "CDFAuthWarning",
59
60
  "CDFMaxIterationsWarning",
60
61
  "CDFNotSupportedWarning",
62
+ "ConversionToPhysicalModelImpossibleWarning",
61
63
  "DeprecatedWarning",
62
64
  "FileItemNotSupportedWarning",
63
65
  "FileMissingRequiredFieldWarning",
@@ -109,6 +109,14 @@ 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 ConversionToPhysicalModelImpossibleWarning(UserModelingWarning):
114
+ """Conceptual data model has {issue_types} that will lead to problems when converting to a physical data model."""
115
+
116
+ fix = "Fix the issues in the conceptual data model before attempting to convert it to a physical data model."
117
+ issue_types: frozenset[str]
118
+
119
+
112
120
  @dataclass(unsafe_hash=True)
113
121
  class DanglingPropertyWarning(UserModelingWarning):
114
122
  """Property {property_id} is not defined for any concept.
@@ -173,6 +173,7 @@ class NeatSession:
173
173
  "Convert to physical",
174
174
  has_physical_data_model=False,
175
175
  has_conceptual_data_model=True,
176
+ can_convert_to_physical_data_model=True,
176
177
  )
177
178
  converter = ConceptualToPhysical(reserved_properties=reserved_properties, client=self._state.client)
178
179
 
@@ -6,11 +6,13 @@ from rdflib import URIRef
6
6
  from cognite.neat.core._client import NeatClient
7
7
  from cognite.neat.core._data_model.importers import BaseImporter, InferenceImporter
8
8
  from cognite.neat.core._data_model.models import ConceptualDataModel, PhysicalDataModel
9
+ from cognite.neat.core._data_model.models.conceptual._validation import ConceptualValidation
9
10
  from cognite.neat.core._data_model.transformers import (
10
11
  VerifiedDataModelTransformer,
11
12
  )
12
13
  from cognite.neat.core._instances.extractors import KnowledgeGraphExtractor
13
14
  from cognite.neat.core._issues import IssueList
15
+ from cognite.neat.core._issues.warnings._models import ConversionToPhysicalModelImpossibleWarning
14
16
  from cognite.neat.core._store import NeatDataModelStore, NeatInstanceStore
15
17
  from cognite.neat.core._utils.upload import UploadResultList
16
18
 
@@ -72,6 +74,7 @@ class SessionState:
72
74
  instances_required: bool = False,
73
75
  client_required: bool = False,
74
76
  has_conceptual_data_model: bool | None = None,
77
+ can_convert_to_physical_data_model: bool = False,
75
78
  has_physical_data_model: bool | None = None,
76
79
  ) -> None:
77
80
  """Set conditions for raising an error in the session that are used by various methods in the session."""
@@ -84,6 +87,17 @@ class SessionState:
84
87
  if has_conceptual_data_model is True and self.data_model_store.try_get_last_conceptual_data_model is None:
85
88
  condition.add(f"{activity} expects conceptual data model in NEAT session")
86
89
  suggestion.add("Read in conceptual data model to neat session")
90
+ if (
91
+ can_convert_to_physical_data_model is True
92
+ and (conceptual_model := self.data_model_store.try_get_last_conceptual_data_model)
93
+ and ConceptualValidation(conceptual_model)
94
+ .validate()
95
+ .has_warning_type(ConversionToPhysicalModelImpossibleWarning)
96
+ ):
97
+ condition.add(f"{activity} expects conceptual data model that can be converted to physical data model")
98
+ suggestion.add(
99
+ "Read in conceptual data model and ensure that warnings that prevent conversion are resolved"
100
+ )
87
101
  if has_physical_data_model is False and self.data_model_store.try_get_last_physical_data_model is not None:
88
102
  condition.add(f"{activity} expects no physical data model in NEAT session")
89
103
  suggestion.add("You already have a physical data model in the session")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-neat
3
- Version: 0.123.17
3
+ Version: 0.123.18
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=nARB9jowN_gs06K1t0WopgFGE_qMSierhZAYDq08tNM,47
2
+ cognite/neat/_version.py,sha256=fuTI2lcJbM6-5HASu5MdGJw07hZcivY-3tNoqelvUs0,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
@@ -52,7 +52,7 @@ cognite/neat/core/_data_model/models/_types.py,sha256=70E8fiLdZkVF2sDUGPuDhzXNA5
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
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=wO8wTeQIPQ45B4OXf-okJaEyQs4eE2D0lvn24pFromQ,12882
55
+ cognite/neat/core/_data_model/models/conceptual/_validation.py,sha256=u-BngcU1Bfe846CxJM-z_uu7En1bLJd7NBzeKOmS9RA,13806
56
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
@@ -129,10 +129,10 @@ cognite/neat/core/_issues/errors/_general.py,sha256=QEgTp_bvzGjmpRtr09Lj_SBeD9IV
129
129
  cognite/neat/core/_issues/errors/_properties.py,sha256=ZR2_j-TkxT8Zn5NGMNNOuKQ_bKeciaMOGZkRKg1YCvw,2924
130
130
  cognite/neat/core/_issues/errors/_resources.py,sha256=lBK65tJZMhV3z3_xi8zJeo7Nt_agXsOklH_RPKQu28s,4002
131
131
  cognite/neat/core/_issues/errors/_wrapper.py,sha256=clhuSwUuHy-FQXQopFIQRY8c_NZM5u-QB9ncoc6Hrbo,2320
132
- cognite/neat/core/_issues/warnings/__init__.py,sha256=lzNZrguzwXyifehsCilAXa5UL94DWHIeO-slyC-EYZc,3165
132
+ cognite/neat/core/_issues/warnings/__init__.py,sha256=3MQS_elyRD3SG3iEWMWLRJDabth7upT3oX4WD0xxOh4,3263
133
133
  cognite/neat/core/_issues/warnings/_external.py,sha256=w-1R7ea6DXTIWqwlwMMjY0YxKDMSJ8gKAbp_nIIM1AI,1324
134
134
  cognite/neat/core/_issues/warnings/_general.py,sha256=_6dAFaMz-LIv7GsBBIBq2d-kmbuxVXKvU4jZeb7tjAo,972
135
- cognite/neat/core/_issues/warnings/_models.py,sha256=u9GH2i1vWet5fofB1ObDsiMxkLF7ZKj2s2a3J-oeiF4,5111
135
+ cognite/neat/core/_issues/warnings/_models.py,sha256=zTQuj2eAQOaX4CO8NljhX50Y8i9FUy3nc3x4l42YHmM,5479
136
136
  cognite/neat/core/_issues/warnings/_properties.py,sha256=I3vqc1aL-ce_FRQNgQQy34RW7kQxcjbwhZIIVtGVmg8,3807
137
137
  cognite/neat/core/_issues/warnings/_resources.py,sha256=_iPRq0pRMmRu3LFjqZTaG3OqOzw4f8-Vc9G4Im__FHc,3578
138
138
  cognite/neat/core/_issues/warnings/user_modeling.py,sha256=Qn_S8TLw7MMYQaJcZBScJA48kz_PrTWz0NaepSR70Fk,4144
@@ -163,7 +163,7 @@ cognite/neat/plugins/data_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
163
163
  cognite/neat/plugins/data_model/importers/__init__.py,sha256=d4UJNCFR1DXPY7lv5LdCW2hiStEhvXiu2g_bRSIp1y0,89
164
164
  cognite/neat/plugins/data_model/importers/_base.py,sha256=M9zXp7tEu1SfJZRAJAtLmqpssdFcoi2X-5e25q_n_h8,1034
165
165
  cognite/neat/session/__init__.py,sha256=fxQ5URVlUnmEGYyB8Baw7IDq-uYacqkigbc4b-Pr9Fw,58
166
- cognite/neat/session/_base.py,sha256=vg8KgzpQxFnFCR4F0yRNSsRmrgYZQ77rW6eX4w7L9M4,12884
166
+ cognite/neat/session/_base.py,sha256=6P63Kq4JJSi3S1CpcVLiG-dfKsN9Ml3o5GqZXjcLVvo,12937
167
167
  cognite/neat/session/_collector.py,sha256=-icWXOT9YBjAOVZfpPtBx-D39kpRP2RaQKdPtcr7Xm8,4233
168
168
  cognite/neat/session/_drop.py,sha256=ipD8RS_ZebPNpeIkhC7yqSSeo7e57TXMRxrh5_6IRik,4239
169
169
  cognite/neat/session/_experimental.py,sha256=0peZPZ9JpmzQE05wHbng2tWmPPLLTAVfWZEEUhdnI6o,1274
@@ -176,7 +176,7 @@ cognite/neat/session/_prepare.py,sha256=pskEVNgcnVJVRvYKk5xI55V89vKDO_kgjszj5flY
176
176
  cognite/neat/session/_read.py,sha256=rd1MeXPt_fS50WYrpM6UqDTKOQkDrOIn8TPS0WOVoSw,34607
177
177
  cognite/neat/session/_set.py,sha256=PU4lKI-LGtKFVyvdtfZkk-zLw9e_rnFHzuV9IyrOrTM,4593
178
178
  cognite/neat/session/_show.py,sha256=YLt6K4ukG1s_I_FhuVrIVPtw_btvvOL50Rwrx-vo7VQ,10743
179
- cognite/neat/session/_state.py,sha256=DLEm9wn3GtOuTGhy5-M1IK2v9qvLnTYEruWPidzAP_Q,6580
179
+ cognite/neat/session/_state.py,sha256=0fd8bS7WkzzCN_dVjxK6cInL9EYhQyPd_xIUlgtf-lE,7424
180
180
  cognite/neat/session/_subset.py,sha256=p7n6WmL0gZlUbqpVBgyPncQ6uWn_pi7FDSixDFrm7DM,2848
181
181
  cognite/neat/session/_template.py,sha256=NCgrrwLT98DpLYoo3Wybr_OUXrEXpsJZjrJ83KqfyWc,9908
182
182
  cognite/neat/session/_to.py,sha256=_R-UB3iEIQoa12kTD7tuSrRDdbySQXQg_mzbn5t-7bg,19399
@@ -187,7 +187,7 @@ cognite/neat/session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4dvc
187
187
  cognite/neat/session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
188
188
  cognite/neat/session/engine/_interface.py,sha256=3W-cYr493c_mW3P5O6MKN1xEQg3cA7NHR_ev3zdF9Vk,533
189
189
  cognite/neat/session/engine/_load.py,sha256=g52uYakQM03VqHt_RDHtpHso1-mFFifH5M4T2ScuH8A,5198
190
- cognite_neat-0.123.17.dist-info/METADATA,sha256=KFgvomIBfB9edOObzS4g19zDqvyiDKcfte_8AP6FRnQ,9172
191
- cognite_neat-0.123.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
192
- cognite_neat-0.123.17.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
193
- cognite_neat-0.123.17.dist-info/RECORD,,
190
+ cognite_neat-0.123.18.dist-info/METADATA,sha256=q22nT23r2NuAAxf3lXnDcYch4KrhEl7ZPVptlcYiGm0,9172
191
+ cognite_neat-0.123.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
192
+ cognite_neat-0.123.18.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
193
+ cognite_neat-0.123.18.dist-info/RECORD,,