cognite-neat 0.123.37__py3-none-any.whl → 0.123.38__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/dms/_space.py +2 -2
- cognite/neat/_version.py +1 -1
- cognite/neat/v0/core/_data_model/exporters/_data_model2semantic_model.py +43 -26
- {cognite_neat-0.123.37.dist-info → cognite_neat-0.123.38.dist-info}/METADATA +1 -1
- {cognite_neat-0.123.37.dist-info → cognite_neat-0.123.38.dist-info}/RECORD +7 -7
- {cognite_neat-0.123.37.dist-info → cognite_neat-0.123.38.dist-info}/WHEEL +0 -0
- {cognite_neat-0.123.37.dist-info → cognite_neat-0.123.38.dist-info}/licenses/LICENSE +0 -0
|
@@ -15,8 +15,8 @@ class Space(WriteableResource["SpaceRequest"], ABC):
|
|
|
15
15
|
max_length=43,
|
|
16
16
|
pattern=SPACE_FORMAT_PATTERN,
|
|
17
17
|
)
|
|
18
|
-
name: str | None = Field(None, description="Name of the space.", max_length=
|
|
19
|
-
description: str | None = Field(None, description="The description of the space.", max_length=
|
|
18
|
+
name: str | None = Field(None, description="Name of the space.", max_length=255)
|
|
19
|
+
description: str | None = Field(None, description="The description of the space.", max_length=1024)
|
|
20
20
|
|
|
21
21
|
@field_validator("space")
|
|
22
22
|
def check_forbidden_space_value(cls, val: str) -> str:
|
cognite/neat/_version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.123.
|
|
1
|
+
__version__ = "0.123.38"
|
|
2
2
|
__engine__ = "^2.0.4"
|
|
@@ -462,25 +462,27 @@ class ShaclShapes(_ModelConfig):
|
|
|
462
462
|
"""
|
|
463
463
|
analysis = DataModelAnalysis(data_model)
|
|
464
464
|
concepts_by_concept_entity = analysis.concept_by_concept_entity
|
|
465
|
-
properties_by_concept_entity = analysis.
|
|
465
|
+
properties_by_concept_entity = analysis.properties_by_concepts()
|
|
466
466
|
return cls(
|
|
467
467
|
shapes=[
|
|
468
468
|
# shapes that have property shapes as well
|
|
469
|
-
SHACLNodeShape.
|
|
470
|
-
|
|
471
|
-
|
|
469
|
+
SHACLNodeShape.from_concept(
|
|
470
|
+
concept_entity,
|
|
471
|
+
concepts_by_concept_entity,
|
|
472
|
+
properties,
|
|
472
473
|
data_model.metadata.namespace,
|
|
473
474
|
)
|
|
474
475
|
for concept_entity, properties in properties_by_concept_entity.items()
|
|
475
476
|
]
|
|
476
477
|
+ [
|
|
477
478
|
# shapes without any property shapes
|
|
478
|
-
SHACLNodeShape.
|
|
479
|
-
|
|
479
|
+
SHACLNodeShape.from_concept(
|
|
480
|
+
concept_entity,
|
|
481
|
+
concepts_by_concept_entity,
|
|
480
482
|
[],
|
|
481
483
|
data_model.metadata.namespace,
|
|
482
484
|
)
|
|
483
|
-
for concept_entity
|
|
485
|
+
for concept_entity in concepts_by_concept_entity.keys()
|
|
484
486
|
if concept_entity not in properties_by_concept_entity
|
|
485
487
|
],
|
|
486
488
|
prefixes=data_model.prefixes,
|
|
@@ -548,21 +550,28 @@ class SHACLNodeShape(_ModelConfig):
|
|
|
548
550
|
)
|
|
549
551
|
|
|
550
552
|
@classmethod
|
|
551
|
-
def
|
|
553
|
+
def from_concept(
|
|
552
554
|
cls,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
+
concept_entity: ConceptEntity,
|
|
556
|
+
concepts_by_concept_entity: dict[ConceptEntity, Concept],
|
|
557
|
+
properties: list[ConceptualProperty],
|
|
555
558
|
namespace: Namespace,
|
|
556
559
|
) -> "SHACLNodeShape":
|
|
557
|
-
if
|
|
558
|
-
|
|
560
|
+
if not (concept := concepts_by_concept_entity.get(concept_entity)):
|
|
561
|
+
raise ValueError(f"Concept {concept_entity} not found in data model!")
|
|
562
|
+
|
|
563
|
+
if concept.implements:
|
|
564
|
+
parent = [namespace[str(parent.suffix) + "Shape"] for parent in concept.implements]
|
|
559
565
|
else:
|
|
560
566
|
parent = None
|
|
561
567
|
return cls(
|
|
562
|
-
id_=namespace[f"{
|
|
563
|
-
target_class=namespace[str(
|
|
568
|
+
id_=namespace[f"{concept.concept.suffix!s}Shape"],
|
|
569
|
+
target_class=concept.instance_source or namespace[str(concept.concept.suffix)],
|
|
564
570
|
parent=parent,
|
|
565
|
-
property_shapes=[
|
|
571
|
+
property_shapes=[
|
|
572
|
+
SHACLPropertyShape.from_property(property_, concepts_by_concept_entity, namespace)
|
|
573
|
+
for property_ in properties
|
|
574
|
+
],
|
|
566
575
|
namespace=namespace,
|
|
567
576
|
)
|
|
568
577
|
|
|
@@ -607,23 +616,31 @@ class SHACLPropertyShape(_ModelConfig):
|
|
|
607
616
|
return self.path_triples + self.node_kind_triples + self.cardinality_triples
|
|
608
617
|
|
|
609
618
|
@classmethod
|
|
610
|
-
def from_property(
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
619
|
+
def from_property(
|
|
620
|
+
cls,
|
|
621
|
+
property_: ConceptualProperty,
|
|
622
|
+
concepts_by_concept_entity: dict[ConceptEntity, Concept],
|
|
623
|
+
namespace: Namespace,
|
|
624
|
+
) -> "SHACLPropertyShape":
|
|
625
|
+
if isinstance(property_.value_type, ConceptEntity):
|
|
626
|
+
concept = concepts_by_concept_entity.get(property_.value_type)
|
|
627
|
+
value_type_uri = concept.instance_source if concept else None
|
|
628
|
+
expected_value_type = value_type_uri or namespace[f"{property_.value_type.suffix}"]
|
|
629
|
+
elif isinstance(property_.value_type, DataType):
|
|
630
|
+
expected_value_type = XSD[property_.value_type.xsd]
|
|
616
631
|
else:
|
|
617
|
-
raise
|
|
632
|
+
raise NotImplementedError(f"Value type {property_.value_type.type_} is not supported yet")
|
|
618
633
|
|
|
619
634
|
return cls(
|
|
620
635
|
id_=BNode(),
|
|
621
|
-
path=
|
|
622
|
-
|
|
636
|
+
path=property_.instance_source[0]
|
|
637
|
+
if property_.instance_source and len(property_.instance_source) == 1
|
|
638
|
+
else namespace[property_.property_],
|
|
639
|
+
node_kind=SHACL.IRI if property_.type_ == EntityTypes.object_property else SHACL.Literal,
|
|
623
640
|
expected_value_type=expected_value_type,
|
|
624
|
-
min_count=
|
|
641
|
+
min_count=property_.min_count,
|
|
625
642
|
max_count=(
|
|
626
|
-
int(
|
|
643
|
+
int(property_.max_count) if property_.max_count and property_.max_count != float("inf") else None
|
|
627
644
|
),
|
|
628
645
|
namespace=namespace,
|
|
629
646
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cognite-neat
|
|
3
|
-
Version: 0.123.
|
|
3
|
+
Version: 0.123.38
|
|
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=AcC3bBw58APEu-16ayi6h9wHbjFkLKdwAnhBj7XMeqk,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
|
|
@@ -17,7 +17,7 @@ cognite/neat/_data_model/models/dms/_container.py,sha256=ovyAwsh2ACt0j9-j6ooDOdU
|
|
|
17
17
|
cognite/neat/_data_model/models/dms/_data_types.py,sha256=XSGQWVzYFRYAzKsDln20nC2kqiHQC6JAvDeTzCBPT-0,5202
|
|
18
18
|
cognite/neat/_data_model/models/dms/_indexes.py,sha256=MsiHbGCH50QaF1mw_pIY-AZ5dY37vS3fQECOd2rBXWo,780
|
|
19
19
|
cognite/neat/_data_model/models/dms/_references.py,sha256=yrmMo2JNfupG3tppdjLOaEhUAsRSIjZlBOI6hCol1z4,613
|
|
20
|
-
cognite/neat/_data_model/models/dms/_space.py,sha256
|
|
20
|
+
cognite/neat/_data_model/models/dms/_space.py,sha256=-1LkRmQaAdIj2EYDcVv5Mcejl5uswgAEVv7DztpIUk4,1680
|
|
21
21
|
cognite/neat/_data_model/models/entities/__init__.py,sha256=qdtIpyy2hjfdMwEHya-efOCvWassaalQla15RnqK00E,798
|
|
22
22
|
cognite/neat/_data_model/models/entities/_base.py,sha256=PREgBqc6DM9pLn3VXFWxPBMVK0sexl6s3twSHn9wsf0,3874
|
|
23
23
|
cognite/neat/_data_model/models/entities/_constants.py,sha256=P56zgsL2xqfegWOxEAyPm9qrZcxrjb1ZXqMG7cDmQxc,333
|
|
@@ -66,7 +66,7 @@ cognite/neat/v0/core/_data_model/exporters/_base.py,sha256=pdtQDi5G89JVbHtGnvLHJ
|
|
|
66
66
|
cognite/neat/v0/core/_data_model/exporters/_data_model2dms.py,sha256=LdLGgR73n9k5hHiWUSdvDc0lmaEO8UVQYFTiaVWHQ-c,19918
|
|
67
67
|
cognite/neat/v0/core/_data_model/exporters/_data_model2excel.py,sha256=dT7ZHt57y3mca4TtCBnqMER0xlB7AyvivG0EZ2bGPzg,25484
|
|
68
68
|
cognite/neat/v0/core/_data_model/exporters/_data_model2instance_template.py,sha256=cmyQBlc1UM5l42g1N_F2K1sVu39ontsmA2bfXJO5muQ,6115
|
|
69
|
-
cognite/neat/v0/core/_data_model/exporters/_data_model2semantic_model.py,sha256=
|
|
69
|
+
cognite/neat/v0/core/_data_model/exporters/_data_model2semantic_model.py,sha256=vxeDEWyvj7uv6geNlTQe6MfGcNZkeQJYz0vLzPI7e14,23154
|
|
70
70
|
cognite/neat/v0/core/_data_model/exporters/_data_model2yaml.py,sha256=v7CgNVtVv4t0FXHPJM-HGkID0AqVDlwsQqUNjWqr_1U,3287
|
|
71
71
|
cognite/neat/v0/core/_data_model/importers/__init__.py,sha256=jkDKSGv5VdJgl44lmn7VQtD6-rqo09VFOr-tTB5Lfyc,1290
|
|
72
72
|
cognite/neat/v0/core/_data_model/importers/_base.py,sha256=SAC3nhJUBBl5PwnIs-bQvVam_0zEGjlOlNMvVOuJZzI,2028
|
|
@@ -223,7 +223,7 @@ cognite/neat/v0/session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4
|
|
|
223
223
|
cognite/neat/v0/session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
|
|
224
224
|
cognite/neat/v0/session/engine/_interface.py,sha256=3W-cYr493c_mW3P5O6MKN1xEQg3cA7NHR_ev3zdF9Vk,533
|
|
225
225
|
cognite/neat/v0/session/engine/_load.py,sha256=u0x7vuQCRoNcPt25KJBJRn8sJabonYK4vtSZpiTdP4k,5201
|
|
226
|
-
cognite_neat-0.123.
|
|
227
|
-
cognite_neat-0.123.
|
|
228
|
-
cognite_neat-0.123.
|
|
229
|
-
cognite_neat-0.123.
|
|
226
|
+
cognite_neat-0.123.38.dist-info/METADATA,sha256=iDFSXJ075Uh7qGQoJ-CP6VsKePjEuOdiKjf45BFYKWQ,9148
|
|
227
|
+
cognite_neat-0.123.38.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
228
|
+
cognite_neat-0.123.38.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
|
|
229
|
+
cognite_neat-0.123.38.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|