cognite-neat 0.123.10__py3-none-any.whl → 0.123.12__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 +1 -1
- cognite/neat/core/_data_model/importers/_rdf/_shared.py +10 -0
- cognite/neat/core/_data_model/models/conceptual/_unverified.py +1 -1
- cognite/neat/core/_data_model/models/conceptual/_validation.py +7 -1
- cognite/neat/core/_data_model/models/conceptual/_verified.py +3 -1
- cognite/neat/core/_issues/warnings/_models.py +8 -0
- {cognite_neat-0.123.10.dist-info → cognite_neat-0.123.12.dist-info}/METADATA +1 -1
- {cognite_neat-0.123.10.dist-info → cognite_neat-0.123.12.dist-info}/RECORD +10 -10
- {cognite_neat-0.123.10.dist-info → cognite_neat-0.123.12.dist-info}/WHEEL +0 -0
- {cognite_neat-0.123.10.dist-info → cognite_neat-0.123.12.dist-info}/licenses/LICENSE +0 -0
cognite/neat/_version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.123.
|
|
1
|
+
__version__ = "0.123.12"
|
|
2
2
|
__engine__ = "^2.0.4"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from typing import cast
|
|
2
|
+
from urllib.parse import quote
|
|
2
3
|
|
|
3
4
|
from rdflib import BNode, Graph
|
|
4
5
|
from rdflib.plugins.sparql import prepareQuery
|
|
@@ -33,6 +34,9 @@ def parse_concepts(graph: Graph, query: str, language: str, issue_list: IssueLis
|
|
|
33
34
|
res: dict = convert_rdflib_content(cast(ResultRow, raw).asdict(), True)
|
|
34
35
|
res = {key: res.get(key, None) for key in expected_keys}
|
|
35
36
|
|
|
37
|
+
# Quote the concept id to ensure it is web-safe
|
|
38
|
+
res["concept"] = quote(res["concept"], safe="")
|
|
39
|
+
|
|
36
40
|
concept_id = res["concept"]
|
|
37
41
|
|
|
38
42
|
# Safeguarding against incomplete semantic definitions
|
|
@@ -91,6 +95,8 @@ def parse_properties(graph: Graph, query: str, language: str, issue_list: IssueL
|
|
|
91
95
|
res: dict = convert_rdflib_content(cast(ResultRow, raw).asdict(), True)
|
|
92
96
|
res = {key: res.get(key, None) for key in expected_keys}
|
|
93
97
|
|
|
98
|
+
# Quote the concept id to ensure it is web-safe
|
|
99
|
+
res["property_"] = quote(res["property_"], safe="")
|
|
94
100
|
property_id = res["property_"]
|
|
95
101
|
|
|
96
102
|
# Safeguarding against incomplete semantic definitions
|
|
@@ -115,6 +121,10 @@ def parse_properties(graph: Graph, query: str, language: str, issue_list: IssueL
|
|
|
115
121
|
)
|
|
116
122
|
continue
|
|
117
123
|
|
|
124
|
+
# Quote the concept and value_type to ensure they are web-safe
|
|
125
|
+
res["concept"] = quote(res["concept"], safe="")
|
|
126
|
+
res["value_type"] = quote(res["value_type"], safe="")
|
|
127
|
+
|
|
118
128
|
id_ = f"{res['concept']}.{res['property_']}"
|
|
119
129
|
|
|
120
130
|
if id_ not in properties:
|
|
@@ -146,8 +146,8 @@ class UnverifiedConcept(UnverifiedComponent[Concept]):
|
|
|
146
146
|
@dataclass
|
|
147
147
|
class UnverifiedConceptualDataModel(UnverifiedDataModel[ConceptualDataModel]):
|
|
148
148
|
metadata: UnverifiedConceptualMetadata
|
|
149
|
-
properties: list[UnverifiedConceptualProperty] = field(default_factory=list)
|
|
150
149
|
concepts: list[UnverifiedConcept] = field(default_factory=list)
|
|
150
|
+
properties: list[UnverifiedConceptualProperty] = field(default_factory=list)
|
|
151
151
|
prefixes: dict[str, Namespace] | None = None
|
|
152
152
|
|
|
153
153
|
@classmethod
|
|
@@ -11,7 +11,7 @@ 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 UndefinedConceptWarning
|
|
14
|
+
from cognite.neat.core._issues.warnings._models import ConceptOnlyDataModelWarning, UndefinedConceptWarning
|
|
15
15
|
from cognite.neat.core._issues.warnings._resources import (
|
|
16
16
|
ResourceNotDefinedWarning,
|
|
17
17
|
ResourceRegexViolationWarning,
|
|
@@ -46,10 +46,16 @@ class ConceptualValidation:
|
|
|
46
46
|
self._parent_concept_defined()
|
|
47
47
|
self._referenced_classes_exist()
|
|
48
48
|
self._referenced_value_types_exist()
|
|
49
|
+
self._concept_only_data_model()
|
|
49
50
|
self._regex_compliance_with_physical_data_model()
|
|
50
51
|
|
|
51
52
|
return self.issue_list
|
|
52
53
|
|
|
54
|
+
def _concept_only_data_model(self) -> None:
|
|
55
|
+
"""Check if the data model only consists of concepts without any properties."""
|
|
56
|
+
if not self._properties:
|
|
57
|
+
self.issue_list.append(ConceptOnlyDataModelWarning())
|
|
58
|
+
|
|
53
59
|
def _duplicated_resources(self) -> None:
|
|
54
60
|
properties_sheet = self._read_info_by_spreadsheet.get("Properties")
|
|
55
61
|
concepts_sheet = self._read_info_by_spreadsheet.get("Concepts")
|
|
@@ -241,8 +241,10 @@ class ConceptualProperty(SheetRow):
|
|
|
241
241
|
|
|
242
242
|
class ConceptualDataModel(BaseVerifiedDataModel):
|
|
243
243
|
metadata: ConceptualMetadata = Field(alias="Metadata", description="Metadata for the conceptual data model")
|
|
244
|
-
properties: SheetList[ConceptualProperty] = Field(alias="Properties", description="List of properties")
|
|
245
244
|
concepts: SheetList[Concept] = Field(alias="Concepts", description="List of concepts")
|
|
245
|
+
properties: SheetList[ConceptualProperty] = Field(
|
|
246
|
+
alias="Properties", default_factory=SheetList, description="List of properties"
|
|
247
|
+
)
|
|
246
248
|
prefixes: dict[str, Namespace] = Field(
|
|
247
249
|
alias="Prefixes",
|
|
248
250
|
default_factory=get_default_prefixes_and_namespaces,
|
|
@@ -101,6 +101,14 @@ class UndefinedConceptWarning(UserModelingWarning):
|
|
|
101
101
|
concept_id: str
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
@dataclass(unsafe_hash=True)
|
|
105
|
+
class ConceptOnlyDataModelWarning(UserModelingWarning):
|
|
106
|
+
"""Data model is concept-only (contains concepts but no properties).
|
|
107
|
+
This model will likely cause issues when converting to a physical data model."""
|
|
108
|
+
|
|
109
|
+
fix = "Define properties for concepts or make sure that concepts implement other concepts that have properties."
|
|
110
|
+
|
|
111
|
+
|
|
104
112
|
@dataclass(unsafe_hash=True)
|
|
105
113
|
class UndefinedViewWarning(UserModelingWarning):
|
|
106
114
|
"""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.
|
|
3
|
+
Version: 0.123.12
|
|
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=
|
|
2
|
+
cognite/neat/_version.py,sha256=Mzqn-YIDR_mqLMU1RkQCFPerYxlahGnGKv-rz3QId68,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
|
|
@@ -44,16 +44,16 @@ cognite/neat/core/_data_model/importers/_rdf/__init__.py,sha256=1yOjV2PKCxwH7uCT
|
|
|
44
44
|
cognite/neat/core/_data_model/importers/_rdf/_base.py,sha256=FKceKumKmhEGpMZvo1BwEewnUvfAsTF3Ax9fo1nxsGE,6020
|
|
45
45
|
cognite/neat/core/_data_model/importers/_rdf/_inference2rdata_model.py,sha256=PCgM9-qGSLlupN7tYCFLHjivgICtMiahNry1ub8JCYk,28934
|
|
46
46
|
cognite/neat/core/_data_model/importers/_rdf/_owl2data_model.py,sha256=WmncZNpELeZnt6mdw6X8yWnr7XsFXZGfoVe5wTd0HH4,3438
|
|
47
|
-
cognite/neat/core/_data_model/importers/_rdf/_shared.py,sha256=
|
|
47
|
+
cognite/neat/core/_data_model/importers/_rdf/_shared.py,sha256=KJz4HirSpWBXsOw8YGBJh-6Yj_pBjrMB9_K8UQ00sQg,6411
|
|
48
48
|
cognite/neat/core/_data_model/models/__init__.py,sha256=hmF7MDR1XmpLxYdMkOEuPuHUqOQKE4AgsuUqdc-ySSQ,1249
|
|
49
49
|
cognite/neat/core/_data_model/models/_base_unverified.py,sha256=1Wfbp-tJaEF6hd1bFdp2FhTgPkInf-1ZokuEoVJRPxQ,6842
|
|
50
50
|
cognite/neat/core/_data_model/models/_base_verified.py,sha256=nzPrlj7ZvYull_Fdh2zeDXz98hux-eQOdTGy9jhUtYA,15127
|
|
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=
|
|
55
|
-
cognite/neat/core/_data_model/models/conceptual/_validation.py,sha256=
|
|
56
|
-
cognite/neat/core/_data_model/models/conceptual/_verified.py,sha256=
|
|
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
|
|
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=
|
|
134
|
+
cognite/neat/core/_issues/warnings/_models.py,sha256=mnoNxVvTifkIGxOxXAgdY-5ZDwy_IyxNsIxdTIcXdNY,4759
|
|
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.
|
|
190
|
-
cognite_neat-0.123.
|
|
191
|
-
cognite_neat-0.123.
|
|
192
|
-
cognite_neat-0.123.
|
|
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,,
|
|
File without changes
|
|
File without changes
|