cognite-neat 0.81.7__py3-none-any.whl → 0.81.9__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/graph/transformers/__init__.py +3 -3
- cognite/neat/graph/transformers/_classic_cdf.py +74 -0
- {cognite_neat-0.81.7.dist-info → cognite_neat-0.81.9.dist-info}/METADATA +1 -1
- {cognite_neat-0.81.7.dist-info → cognite_neat-0.81.9.dist-info}/RECORD +8 -8
- {cognite_neat-0.81.7.dist-info → cognite_neat-0.81.9.dist-info}/LICENSE +0 -0
- {cognite_neat-0.81.7.dist-info → cognite_neat-0.81.9.dist-info}/WHEEL +0 -0
- {cognite_neat-0.81.7.dist-info → cognite_neat-0.81.9.dist-info}/entry_points.txt +0 -0
cognite/neat/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.81.
|
|
1
|
+
__version__ = "0.81.9"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from ._classic_cdf import AddAssetDepth, AssetTimeSeriesConnector
|
|
1
|
+
from ._classic_cdf import AddAssetDepth, AssetFileConnector, AssetSequenceConnector, AssetTimeSeriesConnector
|
|
2
2
|
|
|
3
|
-
__all__ = ["AddAssetDepth", "AssetTimeSeriesConnector"]
|
|
3
|
+
__all__ = ["AddAssetDepth", "AssetTimeSeriesConnector", "AssetSequenceConnector", "AssetFileConnector"]
|
|
4
4
|
|
|
5
|
-
Transformers = AddAssetDepth | AssetTimeSeriesConnector
|
|
5
|
+
Transformers = AddAssetDepth | AssetTimeSeriesConnector | AssetSequenceConnector | AssetFileConnector
|
|
@@ -95,3 +95,77 @@ class AssetTimeSeriesConnector(BaseTransformer):
|
|
|
95
95
|
# timeseries can be connected to only one asset in the graph
|
|
96
96
|
asset_id = cast(list[tuple], asset_id_res)[0][0]
|
|
97
97
|
graph.add((asset_id, DEFAULT_NAMESPACE.timeSeries, timeseries_id))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class AssetSequenceConnector(BaseTransformer):
|
|
101
|
+
description: str = "Connects assets to sequences, thus forming bi-directional connection"
|
|
102
|
+
_use_only_once: bool = True
|
|
103
|
+
_need_changes = frozenset({str(extractors.AssetsExtractor.__name__), str(extractors.SequencesExtractor.__name__)})
|
|
104
|
+
_asset_template: str = """SELECT ?asset_id WHERE {{
|
|
105
|
+
<{sequence_id}> <{asset_prop}> ?asset_id .
|
|
106
|
+
?asset_id a <{asset_type}>}}"""
|
|
107
|
+
|
|
108
|
+
def __init__(
|
|
109
|
+
self,
|
|
110
|
+
asset_type: URIRef | None = None,
|
|
111
|
+
sequence_type: URIRef | None = None,
|
|
112
|
+
asset_prop: URIRef | None = None,
|
|
113
|
+
):
|
|
114
|
+
self.asset_type = asset_type or DEFAULT_NAMESPACE.Asset
|
|
115
|
+
self.sequence_type = sequence_type or DEFAULT_NAMESPACE.Sequence
|
|
116
|
+
self.asset_prop = asset_prop or DEFAULT_NAMESPACE.asset
|
|
117
|
+
|
|
118
|
+
def transform(self, graph: Graph) -> None:
|
|
119
|
+
for sequency_id_result in graph.query(
|
|
120
|
+
f"SELECT DISTINCT ?sequence_id WHERE {{?sequence_id a <{self.sequence_type}>}}"
|
|
121
|
+
):
|
|
122
|
+
sequence_id: URIRef = cast(tuple, sequency_id_result)[0]
|
|
123
|
+
|
|
124
|
+
if asset_id_res := list(
|
|
125
|
+
graph.query(
|
|
126
|
+
self._asset_template.format(
|
|
127
|
+
sequence_id=sequence_id,
|
|
128
|
+
asset_prop=self.asset_prop,
|
|
129
|
+
asset_type=self.asset_type,
|
|
130
|
+
)
|
|
131
|
+
)
|
|
132
|
+
):
|
|
133
|
+
# sequence can be connected to only one asset in the graph
|
|
134
|
+
asset_id = cast(list[tuple], asset_id_res)[0][0]
|
|
135
|
+
graph.add((asset_id, DEFAULT_NAMESPACE.sequence, sequence_id))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class AssetFileConnector(BaseTransformer):
|
|
139
|
+
description: str = "Connects assets to files, thus forming bi-directional connection"
|
|
140
|
+
_use_only_once: bool = True
|
|
141
|
+
_need_changes = frozenset({str(extractors.AssetsExtractor.__name__), str(extractors.FilesExtractor.__name__)})
|
|
142
|
+
_asset_template: str = """SELECT ?asset_id WHERE {{
|
|
143
|
+
<{file_id}> <{asset_prop}> ?asset_id .
|
|
144
|
+
?asset_id a <{asset_type}>}}"""
|
|
145
|
+
|
|
146
|
+
def __init__(
|
|
147
|
+
self,
|
|
148
|
+
asset_type: URIRef | None = None,
|
|
149
|
+
file_type: URIRef | None = None,
|
|
150
|
+
asset_prop: URIRef | None = None,
|
|
151
|
+
):
|
|
152
|
+
self.asset_type = asset_type or DEFAULT_NAMESPACE.Asset
|
|
153
|
+
self.file_type = file_type or DEFAULT_NAMESPACE.File
|
|
154
|
+
self.asset_prop = asset_prop or DEFAULT_NAMESPACE.asset
|
|
155
|
+
|
|
156
|
+
def transform(self, graph: Graph) -> None:
|
|
157
|
+
for sequency_id_result in graph.query(f"SELECT DISTINCT ?file_id WHERE {{?file_id a <{self.file_type}>}}"):
|
|
158
|
+
file_id: URIRef = cast(tuple, sequency_id_result)[0]
|
|
159
|
+
|
|
160
|
+
if assets_id_res := list(
|
|
161
|
+
graph.query(
|
|
162
|
+
self._asset_template.format(
|
|
163
|
+
file_id=file_id,
|
|
164
|
+
asset_prop=self.asset_prop,
|
|
165
|
+
asset_type=self.asset_type,
|
|
166
|
+
)
|
|
167
|
+
)
|
|
168
|
+
):
|
|
169
|
+
# files can be connected to multiple assets in the graph
|
|
170
|
+
for (asset_id,) in cast(list[tuple], assets_id_res):
|
|
171
|
+
graph.add((asset_id, DEFAULT_NAMESPACE.file, file_id))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
cognite/neat/__init__.py,sha256=v-rRiDOgZ3sQSMQKq0vgUQZvpeOkoHFXissAx6Ktg84,61
|
|
2
|
-
cognite/neat/_version.py,sha256=
|
|
2
|
+
cognite/neat/_version.py,sha256=gPog-eXLc_NQMwidfkhILHYH8iP4pKjOx2sYNlDyS8k,23
|
|
3
3
|
cognite/neat/app/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
cognite/neat/app/api/asgi/metrics.py,sha256=nxFy7L5cChTI0a-zkCiJ59Aq8yLuIJp5c9Dg0wRXtV0,152
|
|
5
5
|
cognite/neat/app/api/configuration.py,sha256=2U5M6M252swvQPQyooA1EBzFUZNtcTmuSaywfJDgckM,4232
|
|
@@ -76,9 +76,9 @@ cognite/neat/graph/stores/__init__.py,sha256=G-VG_YwfRt1kuPao07PDJyZ3w_0-eguzLUM
|
|
|
76
76
|
cognite/neat/graph/stores/_base.py,sha256=-MwqfVCBd4j4xWaI7zOvypsGqtbET-2eKQKf36DO0A0,11001
|
|
77
77
|
cognite/neat/graph/stores/_oxrdflib.py,sha256=A5zeRm5_e8ui_ihGpgstRDg_N7qcLZ3QZBRGrOXSGI0,9569
|
|
78
78
|
cognite/neat/graph/stores/_provenance.py,sha256=Hr9WBhFj-eoet4czL8XSBGYnu9Yn66YsTgH_G0n3QpY,3293
|
|
79
|
-
cognite/neat/graph/transformers/__init__.py,sha256=
|
|
79
|
+
cognite/neat/graph/transformers/__init__.py,sha256=rszYDrhnWD8crYZVwSlZ0X4QcJA40p2Xg42ZjXP0Phs,318
|
|
80
80
|
cognite/neat/graph/transformers/_base.py,sha256=b37Ek-9njuM5pTR_3XhnxCMrg_ip_2BMwM7ZhKpAAlw,328
|
|
81
|
-
cognite/neat/graph/transformers/_classic_cdf.py,sha256=
|
|
81
|
+
cognite/neat/graph/transformers/_classic_cdf.py,sha256=Gcsla0nOI1-0msGuo_vhwH5DyqeKMMusipD8e9WyJ7c,7280
|
|
82
82
|
cognite/neat/issues.py,sha256=pxQfqfBseMDE8JM0iqZnkLXngeyeFfT0TFtu1UuAd4c,4629
|
|
83
83
|
cognite/neat/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
84
|
cognite/neat/legacy/graph/__init__.py,sha256=31uTeejWOSd-I8iUG8GOZFhHZcQCsBitJ6X8vu2r1nU,73
|
|
@@ -297,8 +297,8 @@ cognite/neat/workflows/steps_registry.py,sha256=fkTX14ZA7_gkUYfWIlx7A1XbCidvqR23
|
|
|
297
297
|
cognite/neat/workflows/tasks.py,sha256=dqlJwKAb0jlkl7abbY8RRz3m7MT4SK8-7cntMWkOYjw,788
|
|
298
298
|
cognite/neat/workflows/triggers.py,sha256=_BLNplzoz0iic367u1mhHMHiUrCwP-SLK6_CZzfODX0,7071
|
|
299
299
|
cognite/neat/workflows/utils.py,sha256=gKdy3RLG7ctRhbCRwaDIWpL9Mi98zm56-d4jfHDqP1E,453
|
|
300
|
-
cognite_neat-0.81.
|
|
301
|
-
cognite_neat-0.81.
|
|
302
|
-
cognite_neat-0.81.
|
|
303
|
-
cognite_neat-0.81.
|
|
304
|
-
cognite_neat-0.81.
|
|
300
|
+
cognite_neat-0.81.9.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
|
|
301
|
+
cognite_neat-0.81.9.dist-info/METADATA,sha256=JpfmmlhKiKJbfOQgnPCLeH45QbGJbgFjGiQCI3p6nfs,9290
|
|
302
|
+
cognite_neat-0.81.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
303
|
+
cognite_neat-0.81.9.dist-info/entry_points.txt,sha256=61FPqiWb25vbqB0KI7znG8nsg_ibLHBvTjYnkPvNFso,50
|
|
304
|
+
cognite_neat-0.81.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|