cognite-neat 0.123.28__py3-none-any.whl → 0.123.30__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.28"
1
+ __version__ = "0.123.30"
2
2
  __engine__ = "^2.0.4"
@@ -1,3 +1,4 @@
1
+ import itertools
1
2
  import re
2
3
  import warnings
3
4
  from abc import ABC, abstractmethod
@@ -238,7 +239,7 @@ class ResourceLoader(
238
239
  try:
239
240
  return self._update(items)
240
241
  except CogniteAPIError as e:
241
- failed_ids = {self.get_id(failed) for failed in e.failed + e.unknown}
242
+ failed_ids = {self.get_id(failed) for failed in itertools.chain(e.failed, e.unknown)}
242
243
  success_ids = [self.get_id(success) for success in e.successful]
243
244
  success_ = self.retrieve(success_ids)
244
245
  if success is None:
@@ -446,6 +446,8 @@ class DMSImporter(BaseImporter[UnverifiedPhysicalDataModel]):
446
446
  return ViewEntity.from_id(prop.source)
447
447
  elif isinstance(prop_type, PropertyTypeWithUnit) and prop_type.unit:
448
448
  return DataType.load(f"{prop_type._type}(unit={prop_type.unit.external_id})")
449
+ elif isinstance(prop_type, dm.Text) and prop_type.max_text_size is not None:
450
+ return DataType.load(f"{prop_type._type}(maxTextSize={prop_type.max_text_size})")
449
451
  elif isinstance(prop_type, DMSEnum):
450
452
  if enum_collection_by_container_property is None:
451
453
  return String()
@@ -246,6 +246,11 @@ class String(DataType):
246
246
  sql = "STRING"
247
247
 
248
248
  name: typing.Literal["string"] = "string"
249
+ max_text_size: int | None = Field(
250
+ None,
251
+ alias="maxTextSize",
252
+ description="Specifies the maximum size in bytes of the text property, when encoded with utf-8.",
253
+ )
249
254
 
250
255
 
251
256
  class LangString(DataType):
@@ -256,6 +261,11 @@ class LangString(DataType):
256
261
  sql = "STRING"
257
262
 
258
263
  name: typing.Literal["langString"] = "langString"
264
+ max_text_size: int | None = Field(
265
+ None,
266
+ alias="maxTextSize",
267
+ description="Specifies the maximum size in bytes of the text property, when encoded with utf-8.",
268
+ )
259
269
 
260
270
 
261
271
  class AnyURI(DataType):
@@ -25,7 +25,7 @@ from cognite.neat.core._constants import (
25
25
  DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT,
26
26
  DMS_PRIMITIVE_LIST_DEFAULT_LIMIT,
27
27
  )
28
- from cognite.neat.core._data_model.models.data_types import DataType, Double, Enum, Float
28
+ from cognite.neat.core._data_model.models.data_types import DataType, Double, Enum, Float, LangString, String
29
29
  from cognite.neat.core._data_model.models.entities import (
30
30
  ConceptEntity,
31
31
  ContainerEntity,
@@ -347,6 +347,8 @@ class _DMSExporter:
347
347
  args["max_list_size"] = prop.max_count
348
348
  if isinstance(prop.value_type, Double | Float) and isinstance(prop.value_type.unit, UnitEntity):
349
349
  args["unit"] = prop.value_type.unit.as_reference()
350
+ if isinstance(prop.value_type, String | LangString) and prop.value_type.max_text_size is not None:
351
+ args["max_text_size"] = prop.value_type.max_text_size
350
352
  if isinstance(prop.value_type, Enum):
351
353
  if prop.value_type.collection not in enum_values_by_collection:
352
354
  raise ResourceNotFoundError(
File without changes
@@ -0,0 +1,9 @@
1
+ from ._constants import Undefined, Unknown
2
+ from ._identifiers import URI, NameSpace
3
+
4
+ __all__ = [
5
+ "URI",
6
+ "NameSpace",
7
+ "Undefined",
8
+ "Unknown",
9
+ ]
@@ -0,0 +1,17 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class _UndefinedType(BaseModel): ...
5
+
6
+
7
+ class _UnknownType(BaseModel):
8
+ def __str__(self) -> str:
9
+ return "#N/A"
10
+
11
+ def __hash__(self) -> int:
12
+ return hash(str(self))
13
+
14
+
15
+ # This is a trick to make Undefined and Unknown singletons
16
+ Undefined = _UndefinedType()
17
+ Unknown = _UnknownType()
@@ -0,0 +1,61 @@
1
+ from pydantic import HttpUrl, RootModel, ValidationError
2
+
3
+ from cognite.neat.core._utils.auxiliary import local_import
4
+
5
+
6
+ class URI(RootModel[str]):
7
+ def __init__(self, value: str):
8
+ try:
9
+ # Use Pydantic's HttpUrl to validate the URI
10
+ _ = HttpUrl(value)
11
+ except ValidationError as e:
12
+ raise ValueError(f"Invalid URI: {value}") from e
13
+ super().__init__(value)
14
+
15
+ def __str__(self) -> str:
16
+ return self.root
17
+
18
+ def __repr__(self) -> str:
19
+ return f"URI({self.root!r})"
20
+
21
+ def as_rdflib_uriref(self): # type: ignore[no-untyped-def]
22
+ # rdflib is an optional dependency, so import here
23
+ local_import("rdflib", "rdflib")
24
+ from rdflib import URIRef
25
+
26
+ return URIRef(self.root)
27
+
28
+
29
+ class NameSpace(RootModel[str]):
30
+ def __init__(self, value: str):
31
+ try:
32
+ # Use Pydantic's HttpUrl to validate the URI
33
+ _ = HttpUrl(value)
34
+ except ValidationError as e:
35
+ raise ValueError(f"Invalid Namespace: {value}") from e
36
+ super().__init__(value)
37
+
38
+ def __str__(self) -> str:
39
+ return self.root
40
+
41
+ def __repr__(self) -> str:
42
+ return f"NameSpace({self.root!r})"
43
+
44
+ def term(self, name: str) -> URI:
45
+ # need to handle slices explicitly because of __getitem__ override
46
+ return URI(self.root + (name if isinstance(name, str) else ""))
47
+
48
+ def __getitem__(self, key: str) -> URI: # type: ignore[override]
49
+ return self.term(key)
50
+
51
+ def __getattr__(self, name: str) -> URI:
52
+ if name.startswith("__"): # ignore any special Python names!
53
+ raise AttributeError
54
+ return self.term(name)
55
+
56
+ def as_rdflib_namespace(self): # type: ignore[no-untyped-def]
57
+ # rdflib is an optional dependency, so import here
58
+ local_import("rdflib", "rdflib")
59
+ from rdflib import Namespace
60
+
61
+ return Namespace(self.root)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-neat
3
- Version: 0.123.28
3
+ Version: 0.123.30
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/
@@ -11,7 +11,7 @@ License-Expression: Apache-2.0
11
11
  License-File: LICENSE
12
12
  Requires-Python: >=3.10
13
13
  Requires-Dist: backports-strenum<2.0.0,>=1.2; python_version < '3.11'
14
- Requires-Dist: cognite-sdk<8.0.0,>=7.73.4
14
+ Requires-Dist: cognite-sdk<8.0.0,>=7.83.0
15
15
  Requires-Dist: elementpath<5.0.0,>=4.0.0
16
16
  Requires-Dist: exceptiongroup<2.0.0,>=1.1.3; python_version < '3.11'
17
17
  Requires-Dist: jsonpath-python<2.0.0,>=1.0.6
@@ -1,5 +1,5 @@
1
1
  cognite/neat/__init__.py,sha256=12StS1dzH9_MElqxGvLWrNsxCJl9Hv8A2a9D0E5OD_U,193
2
- cognite/neat/_version.py,sha256=6seCV2thSh0iPLMJ5f4Ba6srBIKclOMKbKjgQpVgAiA,47
2
+ cognite/neat/_version.py,sha256=Umq3xx0HZoXDYrJ16jkCraj5gi3lRvqf-wxtIkntgvg,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
@@ -9,7 +9,7 @@ cognite/neat/core/_client/__init__.py,sha256=RQ7MwL8mwGqGHokRzsPqO3XStDzmI4-c12_
9
9
  cognite/neat/core/_client/_api_client.py,sha256=CqgG4kEArI9jiKAh82YrRZv_SzeMKA5guIZOvDg2R5I,860
10
10
  cognite/neat/core/_client/testing.py,sha256=rZGd-TFwNtfUqT8LV0u3FT0kHwNrjnvDNZU_Mcd5yx4,1329
11
11
  cognite/neat/core/_client/_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- cognite/neat/core/_client/_api/data_modeling_loaders.py,sha256=6ZiL_btoqMlJF2TtW9q2y8zEWds7QWLn4YlFH72v1Ew,43794
12
+ cognite/neat/core/_client/_api/data_modeling_loaders.py,sha256=y0QbkawjS-Fmstltt0rVDXEQRJagg2z6eXVrgT3qDM8,43827
13
13
  cognite/neat/core/_client/_api/neat_instances.py,sha256=8HcQO1sp8zjXdnRBRQ4yeQzt1O906HNSrDDCgrgTe8A,4805
14
14
  cognite/neat/core/_client/_api/schema.py,sha256=lbA8Cka_7K_RjmaxdeqkVkIwKPfWeDvpYvvEOGI07xo,6967
15
15
  cognite/neat/core/_client/_api/statistics.py,sha256=M0JpCHD6WMfggoe-HyXfeigwRCvZJjVF-xNB9CgB4UE,3796
@@ -38,7 +38,7 @@ cognite/neat/core/_data_model/importers/__init__.py,sha256=jkDKSGv5VdJgl44lmn7VQ
38
38
  cognite/neat/core/_data_model/importers/_base.py,sha256=pKe2OK86Wdj6CTj5bUgjY33ejZhRfD2eJbjcCapHD58,2013
39
39
  cognite/neat/core/_data_model/importers/_base_file_reader.py,sha256=m7CwMujEybYMfHWbTQOb7wBvLl2X1TmROkPelJMSaDA,1621
40
40
  cognite/neat/core/_data_model/importers/_dict2data_model.py,sha256=GEAD0Gs69rH-i-TjHV3Px-7Wo1Z7PfUqESsZt_58xUU,4705
41
- cognite/neat/core/_data_model/importers/_dms2data_model.py,sha256=X2iQ2VQvrruj1lEFVYN3Hl7J1R7NK3WT6FyXyl-ruyE,29134
41
+ cognite/neat/core/_data_model/importers/_dms2data_model.py,sha256=s_DGq57oU-kOwQuHVwTGMN1_iTZxCVAuFG7Yh2TXFQQ,29321
42
42
  cognite/neat/core/_data_model/importers/_graph2data_model.py,sha256=yWi6Vlrc8rrcFM8hxHOVesr9D3etwJ0rbL6TJULrW9U,13684
43
43
  cognite/neat/core/_data_model/importers/_spreadsheet2data_model.py,sha256=wPb1ie_nmWNuHO0X6NW53pvqUDYGvNkHLvT8_UKFJIw,12079
44
44
  cognite/neat/core/_data_model/importers/_rdf/__init__.py,sha256=1yOjV2PKCxwH7uCTXVZhSdxtn5etmFX40cksvwtKcZ8,199
@@ -51,7 +51,7 @@ cognite/neat/core/_data_model/models/_base_unverified.py,sha256=1Wfbp-tJaEF6hd1b
51
51
  cognite/neat/core/_data_model/models/_base_verified.py,sha256=nzPrlj7ZvYull_Fdh2zeDXz98hux-eQOdTGy9jhUtYA,15127
52
52
  cognite/neat/core/_data_model/models/_import_contexts.py,sha256=LAQbgwTbyIAY3at2hk6OksfK_CKavBwgwPcRFcszJcc,3436
53
53
  cognite/neat/core/_data_model/models/_types.py,sha256=70E8fiLdZkVF2sDUGPuDhzXNA5niVECkVDI7YN0NF60,5488
54
- cognite/neat/core/_data_model/models/data_types.py,sha256=uQ_u9KxCetLjxo-VtFzOXSxQuuf97Kg-9lfTTGzY6hc,10150
54
+ cognite/neat/core/_data_model/models/data_types.py,sha256=S21snCN0hEDNAP0Na8ULc91YYbrRHLuKsQ4CUWFnm4o,10538
55
55
  cognite/neat/core/_data_model/models/conceptual/__init__.py,sha256=9A6myEV8s0-LqdXejaljqPj8S0pIpUL75rNdRDZzyR8,585
56
56
  cognite/neat/core/_data_model/models/conceptual/_unverified.py,sha256=2Ju_LJS0xH8Ao-AxZMLwAZwHjg6ITyn4tBwTfzy2Wic,6524
57
57
  cognite/neat/core/_data_model/models/conceptual/_validation.py,sha256=CF1jYALTCQFAr5KUwplAzOLdxJGknIeJo-HpxVZsgMY,13859
@@ -68,7 +68,7 @@ cognite/neat/core/_data_model/models/mapping/__init__.py,sha256=T68Hf7rhiXa7b03h
68
68
  cognite/neat/core/_data_model/models/mapping/_classic2core.py,sha256=FRDpYP_CX-CfptdFCZmfqsbKCYQ9BQPUbKoifTICe30,1415
69
69
  cognite/neat/core/_data_model/models/mapping/_classic2core.yaml,sha256=ei-nuivNWVW9HmvzDBKIPF6ZdgaMq64XHw_rKm0CMxg,22584
70
70
  cognite/neat/core/_data_model/models/physical/__init__.py,sha256=ONE_xLw1cxfw88rICG_RtbjCYUZm8yS2kBQ4Di3EGnA,987
71
- cognite/neat/core/_data_model/models/physical/_exporter.py,sha256=DPOytV-sIzpGJtfDEfi7G4RWnSCVNRLWe1KzY26ewmc,30083
71
+ cognite/neat/core/_data_model/models/physical/_exporter.py,sha256=qVQjo4jLzrAMHpIRhEFy24YepaFgVD22CCVAiKJ76_k,30292
72
72
  cognite/neat/core/_data_model/models/physical/_unverified.py,sha256=8Sg0-tfSJ6glc5h1yNDlY29sajAOv3xoi9j-Q-Md6ZY,20116
73
73
  cognite/neat/core/_data_model/models/physical/_validation.py,sha256=AuBAecOTAVRbGh9VXZ6W91HsU7-B75ko7oaxlX4Mmqw,41140
74
74
  cognite/neat/core/_data_model/models/physical/_verified.py,sha256=4_7XUj6-x74DhL8qe-duXhlNnq6ANmShB7UpICjbQW4,26783
@@ -159,6 +159,10 @@ cognite/neat/core/_utils/upload.py,sha256=yR-BvvrWPh0XHoIGByXMEVi3JONzmc5xwXbmED
159
159
  cognite/neat/core/_utils/xml_.py,sha256=FQkq84u35MUsnKcL6nTMJ9ajtG9D5i1u4VBnhGqP2DQ,1710
160
160
  cognite/neat/core/_utils/reader/__init__.py,sha256=fPkrNB_9hLB7CyHTCFV_xEbIfOMqUQzNly5JN33-QfM,146
161
161
  cognite/neat/core/_utils/reader/_base.py,sha256=fRXxUWW8a3UFedeCLxDTDgFntWGlHaEGxmKLcITtiWE,5417
162
+ cognite/neat/data_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
163
+ cognite/neat/data_model/models/entities/__init__.py,sha256=0IjgtsIJURvTFtYLbxb0b-rxAIyR6HjeMOPxKT3rXx0,159
164
+ cognite/neat/data_model/models/entities/_constants.py,sha256=P56zgsL2xqfegWOxEAyPm9qrZcxrjb1ZXqMG7cDmQxc,333
165
+ cognite/neat/data_model/models/entities/_identifiers.py,sha256=0G7xYwOa6dsO3Ie0UqCwbpkb4mMeYU1dQD2De6NnllU,1920
162
166
  cognite/neat/plugins/__init__.py,sha256=Q7r1FFbybOt71N9TjHjjk-1HguLRfHieLeiGVSG5HTY,75
163
167
  cognite/neat/plugins/_issues.py,sha256=jukeVjSs1DEzqtFuGRcIDbg7bNxZRxGPqnzumVRF-8c,940
164
168
  cognite/neat/plugins/_manager.py,sha256=_eJa5_3UGoLVacSQgbDrE0eWcopjeXxgbfSmvujeSiU,3979
@@ -196,7 +200,7 @@ cognite/neat/session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4dvc
196
200
  cognite/neat/session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
197
201
  cognite/neat/session/engine/_interface.py,sha256=3W-cYr493c_mW3P5O6MKN1xEQg3cA7NHR_ev3zdF9Vk,533
198
202
  cognite/neat/session/engine/_load.py,sha256=g52uYakQM03VqHt_RDHtpHso1-mFFifH5M4T2ScuH8A,5198
199
- cognite_neat-0.123.28.dist-info/METADATA,sha256=UScQChiQFnF4EpPSGPtFyHZ-JgQuiIiPMlRA_CUHLdA,9166
200
- cognite_neat-0.123.28.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
201
- cognite_neat-0.123.28.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
202
- cognite_neat-0.123.28.dist-info/RECORD,,
203
+ cognite_neat-0.123.30.dist-info/METADATA,sha256=girPGuZI_KaMxUsiBAAyFdVBLXuFrHyPMJP8dDX0u6M,9166
204
+ cognite_neat-0.123.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
205
+ cognite_neat-0.123.30.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
206
+ cognite_neat-0.123.30.dist-info/RECORD,,