cognite-neat 0.92.2__py3-none-any.whl → 0.93.0__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/__init__.py +3 -2
- cognite/neat/{app → _app}/api/configuration.py +9 -7
- cognite/neat/_app/api/context_manager/__init__.py +3 -0
- cognite/neat/{app → _app}/api/context_manager/manager.py +1 -1
- cognite/neat/{app → _app}/api/explorer.py +5 -5
- cognite/neat/{app → _app}/api/routers/configuration.py +2 -2
- cognite/neat/{app → _app}/api/routers/crud.py +4 -4
- cognite/neat/{app → _app}/api/routers/workflows.py +7 -7
- cognite/neat/{app → _app}/main.py +1 -1
- cognite/neat/_app/ui/neat-app/package-lock.json +18306 -0
- cognite/neat/_app/ui/neat-app/package.json +62 -0
- cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +116 -0
- cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +112 -0
- cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +34 -0
- cognite/neat/_app/ui/neat-app/public/index.html +43 -0
- cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- cognite/neat/_app/ui/neat-app/public/manifest.json +25 -0
- cognite/neat/_app/ui/neat-app/public/robots.txt +3 -0
- cognite/neat/_app/ui/neat-app/src/App.css +38 -0
- cognite/neat/_app/ui/neat-app/src/App.js +17 -0
- cognite/neat/_app/ui/neat-app/src/App.test.js +8 -0
- cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +70 -0
- cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +43 -0
- cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +124 -0
- cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +63 -0
- cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +511 -0
- cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +36 -0
- cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +56 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +60 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +112 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +67 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +79 -0
- cognite/neat/_app/ui/neat-app/src/index.css +13 -0
- cognite/neat/_app/ui/neat-app/src/index.js +13 -0
- cognite/neat/_app/ui/neat-app/src/logo.svg +1 -0
- cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +13 -0
- cognite/neat/_app/ui/neat-app/src/setupTests.js +5 -0
- cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +388 -0
- cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +61 -0
- cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +184 -0
- cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +180 -0
- cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +570 -0
- cognite/neat/_app/ui/neat-app/tsconfig.json +27 -0
- cognite/neat/{config.py → _config.py} +3 -3
- cognite/neat/{constants.py → _constants.py} +13 -5
- cognite/neat/_graph/_shared.py +34 -0
- cognite/neat/{graph → _graph}/_tracking/base.py +1 -1
- cognite/neat/{graph → _graph}/_tracking/log.py +1 -1
- cognite/neat/{graph → _graph}/extractors/__init__.py +5 -0
- cognite/neat/{graph → _graph}/extractors/_base.py +2 -2
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_assets.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_base.py +4 -4
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_classic.py +5 -5
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_data_sets.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_events.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_files.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_labels.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_relationships.py +2 -2
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_sequences.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_timeseries.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_dexpi.py +5 -5
- cognite/neat/{graph → _graph}/extractors/_dms.py +3 -3
- cognite/neat/_graph/extractors/_iodd.py +402 -0
- cognite/neat/{graph → _graph}/extractors/_mock_graph_generator.py +9 -8
- cognite/neat/_graph/extractors/_rdf_file.py +49 -0
- cognite/neat/{graph → _graph}/loaders/_base.py +5 -5
- cognite/neat/{graph → _graph}/loaders/_rdf2asset.py +11 -10
- cognite/neat/{graph → _graph}/loaders/_rdf2dms.py +10 -10
- cognite/neat/{graph → _graph}/queries/_base.py +91 -19
- cognite/neat/{graph → _graph}/queries/_construct.py +5 -5
- cognite/neat/{graph → _graph}/queries/_shared.py +3 -3
- cognite/neat/{graph → _graph}/transformers/__init__.py +6 -0
- cognite/neat/{graph → _graph}/transformers/_classic_cdf.py +135 -3
- cognite/neat/_graph/transformers/_iodd.py +25 -0
- cognite/neat/_graph/transformers/_prune_graph.py +126 -0
- cognite/neat/{graph → _graph}/transformers/_rdfpath.py +3 -3
- cognite/neat/_graph/transformers/_value_type.py +66 -0
- cognite/neat/{issues → _issues}/_base.py +32 -17
- cognite/neat/{issues → _issues}/errors/__init__.py +1 -1
- cognite/neat/{issues → _issues}/errors/_external.py +8 -8
- cognite/neat/{issues → _issues}/errors/_general.py +5 -5
- cognite/neat/{issues → _issues}/errors/_properties.py +7 -7
- cognite/neat/{issues → _issues}/errors/_resources.py +11 -11
- cognite/neat/{issues → _issues}/errors/_workflow.py +5 -5
- cognite/neat/{issues → _issues}/warnings/__init__.py +1 -1
- cognite/neat/{issues → _issues}/warnings/_external.py +5 -5
- cognite/neat/{issues → _issues}/warnings/_general.py +4 -4
- cognite/neat/{issues → _issues}/warnings/_models.py +10 -10
- cognite/neat/{issues → _issues}/warnings/_properties.py +6 -6
- cognite/neat/{issues → _issues}/warnings/_resources.py +5 -5
- cognite/neat/{issues → _issues}/warnings/user_modeling.py +9 -9
- cognite/neat/_rules/_constants.py +190 -0
- cognite/neat/{rules → _rules}/_shared.py +5 -5
- cognite/neat/_rules/analysis/__init__.py +5 -0
- cognite/neat/{rules → _rules}/analysis/_asset.py +5 -5
- cognite/neat/{rules → _rules}/analysis/_base.py +5 -5
- cognite/neat/_rules/analysis/_dms.py +43 -0
- cognite/neat/{rules → _rules}/analysis/_information.py +12 -6
- cognite/neat/_rules/catalog/__init__.py +6 -0
- cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- cognite/neat/{rules → _rules}/exporters/__init__.py +2 -0
- cognite/neat/{rules → _rules}/exporters/_base.py +3 -3
- cognite/neat/{rules → _rules}/exporters/_rules2dms.py +5 -5
- cognite/neat/{rules → _rules}/exporters/_rules2excel.py +26 -7
- cognite/neat/_rules/exporters/_rules2instance_template.py +152 -0
- cognite/neat/{rules → _rules}/exporters/_rules2ontology.py +10 -9
- cognite/neat/{rules → _rules}/exporters/_rules2yaml.py +1 -3
- cognite/neat/{rules → _rules}/exporters/_validation.py +2 -2
- cognite/neat/{rules → _rules}/importers/_base.py +3 -3
- cognite/neat/{rules → _rules}/importers/_dms2rules.py +9 -9
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/dtdl_converter.py +7 -7
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/dtdl_importer.py +9 -9
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/spec.py +1 -1
- cognite/neat/_rules/importers/_rdf/_base.py +144 -0
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2classes.py +1 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2metadata.py +4 -4
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2properties.py +2 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2rules.py +8 -39
- cognite/neat/{rules → _rules}/importers/_rdf/_inference2rules.py +33 -106
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2classes.py +1 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2metadata.py +5 -5
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2properties.py +1 -1
- cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2rules.py +39 -0
- cognite/neat/{rules → _rules}/importers/_rdf/_shared.py +4 -4
- cognite/neat/{rules → _rules}/importers/_spreadsheet2rules.py +40 -6
- cognite/neat/{rules → _rules}/importers/_yaml2rules.py +5 -5
- cognite/neat/{rules → _rules}/models/__init__.py +5 -5
- cognite/neat/{rules → _rules}/models/_base_input.py +30 -11
- cognite/neat/{rules → _rules}/models/_base_rules.py +22 -8
- cognite/neat/{rules → _rules}/models/_rdfpath.py +1 -1
- cognite/neat/_rules/models/_types.py +151 -0
- cognite/neat/{rules → _rules}/models/asset/_rules.py +4 -4
- cognite/neat/{rules → _rules}/models/asset/_rules_input.py +4 -4
- cognite/neat/{rules → _rules}/models/asset/_validation.py +7 -7
- cognite/neat/{rules → _rules}/models/data_types.py +15 -12
- cognite/neat/{rules → _rules}/models/dms/_exporter.py +60 -12
- cognite/neat/{rules → _rules}/models/dms/_rules.py +29 -26
- cognite/neat/{rules → _rules}/models/dms/_rules_input.py +4 -4
- cognite/neat/{rules → _rules}/models/dms/_schema.py +15 -14
- cognite/neat/{rules → _rules}/models/dms/_validation.py +8 -8
- cognite/neat/{rules → _rules}/models/domain.py +6 -6
- cognite/neat/{rules → _rules}/models/entities/__init__.py +1 -2
- cognite/neat/_rules/models/entities/_constants.py +15 -0
- cognite/neat/{rules → _rules}/models/entities/_loaders.py +2 -2
- cognite/neat/{rules → _rules}/models/entities/_multi_value.py +15 -2
- cognite/neat/{rules → _rules}/models/entities/_single_value.py +16 -4
- cognite/neat/{rules → _rules}/models/information/_rules.py +37 -25
- cognite/neat/{rules → _rules}/models/information/_rules_input.py +3 -3
- cognite/neat/{rules → _rules}/models/information/_validation.py +6 -5
- cognite/neat/_rules/models/mapping/__init__.py +4 -0
- cognite/neat/_rules/models/mapping/_base.py +131 -0
- cognite/neat/_rules/models/mapping/_classic2core.py +150 -0
- cognite/neat/{rules → _rules}/transformers/__init__.py +15 -2
- cognite/neat/{rules → _rules}/transformers/_base.py +3 -3
- cognite/neat/{rules → _rules}/transformers/_converters.py +289 -20
- cognite/neat/{rules/transformers/_map_onto.py → _rules/transformers/_mapping.py} +46 -4
- cognite/neat/{rules → _rules}/transformers/_pipelines.py +4 -4
- cognite/neat/{rules → _rules}/transformers/_verification.py +10 -4
- cognite/neat/_session/__init__.py +3 -0
- cognite/neat/_session/_base.py +86 -0
- cognite/neat/_session/_prepare.py +61 -0
- cognite/neat/_session/_read.py +118 -0
- cognite/neat/_session/_show.py +96 -0
- cognite/neat/_session/_state.py +69 -0
- cognite/neat/_session/_to.py +70 -0
- cognite/neat/_session/_wizard.py +39 -0
- cognite/neat/_session/exceptions.py +42 -0
- cognite/neat/{store → _store}/_base.py +63 -32
- cognite/neat/{store → _store}/_provenance.py +11 -1
- cognite/neat/{utils → _utils}/auth.py +14 -3
- cognite/neat/{utils → _utils}/auxiliary.py +1 -1
- cognite/neat/{utils → _utils}/cdf/loaders/_data_modeling.py +8 -2
- cognite/neat/{utils → _utils}/cdf/loaders/_ingestion.py +1 -1
- cognite/neat/{utils → _utils}/upload.py +1 -1
- cognite/neat/_version.py +1 -1
- cognite/neat/_workflows/__init__.py +17 -0
- cognite/neat/{workflows → _workflows}/base.py +10 -10
- cognite/neat/{workflows → _workflows}/cdf_store.py +3 -3
- cognite/neat/{workflows → _workflows}/examples/Export_DMS/workflow.yaml +89 -89
- cognite/neat/{workflows → _workflows}/manager.py +6 -6
- cognite/neat/{workflows → _workflows}/steps/data_contracts.py +3 -3
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_extractor.py +8 -31
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_loader.py +4 -4
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_store.py +4 -4
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_exporter.py +8 -8
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_importer.py +13 -13
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_validator.py +8 -8
- cognite/neat/{workflows → _workflows}/steps/lib/io/io_steps.py +3 -3
- cognite/neat/{workflows → _workflows}/steps/step_model.py +3 -3
- cognite/neat/{workflows → _workflows}/steps_registry.py +9 -9
- cognite/neat/{workflows → _workflows}/tasks.py +1 -1
- cognite/neat/{workflows → _workflows}/triggers.py +2 -2
- {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/METADATA +6 -2
- cognite_neat-0.93.0.dist-info/RECORD +276 -0
- {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/WHEEL +1 -1
- cognite_neat-0.93.0.dist-info/entry_points.txt +3 -0
- cognite/neat/app/api/context_manager/__init__.py +0 -3
- cognite/neat/graph/_shared.py +0 -5
- cognite/neat/graph/extractors/_iodd.py +0 -160
- cognite/neat/graph/extractors/_rdf_file.py +0 -26
- cognite/neat/rules/analysis/__init__.py +0 -6
- cognite/neat/rules/examples/__init__.py +0 -10
- cognite/neat/rules/examples/info-rules-imf.xlsx +0 -0
- cognite/neat/rules/examples/wind-energy.owl +0 -1511
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -65
- cognite/neat/rules/models/_types.py +0 -96
- cognite/neat/rules/models/entities/_constants.py +0 -73
- cognite/neat/utils/regex_patterns.py +0 -58
- cognite/neat/workflows/__init__.py +0 -12
- cognite_neat-0.92.2.dist-info/RECORD +0 -224
- cognite_neat-0.92.2.dist-info/entry_points.txt +0 -3
- /cognite/neat/{app → _app}/api/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/asgi/metrics.py +0 -0
- /cognite/neat/{app → _app}/api/data_classes/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/data_classes/rest.py +0 -0
- /cognite/neat/{app → _app}/api/routers/metrics.py +0 -0
- /cognite/neat/{app → _app}/api/utils/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/utils/data_mapping.py +0 -0
- /cognite/neat/{app → _app}/api/utils/logging.py +0 -0
- /cognite/neat/{app → _app}/api/utils/query_templates.py +0 -0
- /cognite/neat/{app → _app}/monitoring/__init__.py +0 -0
- /cognite/neat/{app → _app}/monitoring/metrics.py +0 -0
- /cognite/neat/{app → _app}/ui/index.html +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/.gitignore +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/README.md +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/asset-manifest.json +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/favicon.ico +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/architect-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/developer-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/sme-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/index.html +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/logo192.png +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/manifest.json +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/robots.txt +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- /cognite/neat/{graph → _graph}/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/_tracking/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/{graph → _graph}/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/{graph → _graph}/examples/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- /cognite/neat/{graph → _graph}/extractors/_classic_cdf/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/loaders/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/models.py +0 -0
- /cognite/neat/{graph → _graph}/queries/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/transformers/_base.py +0 -0
- /cognite/neat/{issues → _issues}/__init__.py +0 -0
- /cognite/neat/{issues → _issues}/formatters.py +0 -0
- /cognite/neat/{rules → _rules}/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_dtdl2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_dtdl2rules/_unit_lookup.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/asset/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/dms/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/entities/_types.py +0 -0
- /cognite/neat/{rules → _rules}/models/entities/_wrapped.py +0 -0
- /cognite/neat/{rules → _rules}/models/information/__init__.py +0 -0
- /cognite/neat/{store → _store}/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/data_classes.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/loaders/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/loaders/_base.py +0 -0
- /cognite/neat/{utils → _utils}/collection_.py +0 -0
- /cognite/neat/{utils → _utils}/rdf_.py +0 -0
- /cognite/neat/{utils → _utils}/spreadsheet.py +0 -0
- /cognite/neat/{utils → _utils}/text.py +0 -0
- /cognite/neat/{utils → _utils}/time_.py +0 -0
- /cognite/neat/{utils → _utils}/xml_.py +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Import_DMS/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Validate_Rules/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Validate_Solution_Model/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/model.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/current/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/io/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/utils.py +0 -0
- {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/LICENSE +0 -0
|
@@ -3,22 +3,22 @@ import warnings
|
|
|
3
3
|
from collections.abc import Iterable
|
|
4
4
|
from datetime import datetime, timezone
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import cast
|
|
6
|
+
from typing import Any, cast
|
|
7
7
|
|
|
8
8
|
import pandas as pd
|
|
9
|
+
from pandas import Index
|
|
9
10
|
from rdflib import Graph, Namespace, URIRef
|
|
10
11
|
from rdflib.plugins.stores.sparqlstore import SPARQLUpdateStore
|
|
11
12
|
|
|
12
|
-
from cognite.neat.
|
|
13
|
-
from cognite.neat.
|
|
14
|
-
from cognite.neat.
|
|
15
|
-
from cognite.neat.
|
|
16
|
-
from cognite.neat.
|
|
17
|
-
from cognite.neat.
|
|
18
|
-
from cognite.neat.
|
|
19
|
-
from cognite.neat.
|
|
20
|
-
from cognite.neat.
|
|
21
|
-
from cognite.neat.utils.auxiliary import local_import
|
|
13
|
+
from cognite.neat._constants import DEFAULT_NAMESPACE
|
|
14
|
+
from cognite.neat._graph.extractors import RdfFileExtractor, TripleExtractors
|
|
15
|
+
from cognite.neat._graph.models import InstanceType, Triple
|
|
16
|
+
from cognite.neat._graph.queries import Queries
|
|
17
|
+
from cognite.neat._graph.transformers import Transformers
|
|
18
|
+
from cognite.neat._rules.analysis import InformationAnalysis
|
|
19
|
+
from cognite.neat._rules.models import InformationRules
|
|
20
|
+
from cognite.neat._rules.models.entities import ClassEntity
|
|
21
|
+
from cognite.neat._utils.auxiliary import local_import
|
|
22
22
|
|
|
23
23
|
from ._provenance import Change, Provenance
|
|
24
24
|
|
|
@@ -158,20 +158,29 @@ class NeatGraphStore:
|
|
|
158
158
|
|
|
159
159
|
def write(self, extractor: TripleExtractors) -> None:
|
|
160
160
|
_start = datetime.now(timezone.utc)
|
|
161
|
+
success = True
|
|
161
162
|
|
|
162
|
-
if isinstance(extractor, RdfFileExtractor):
|
|
163
|
-
self._parse_file(extractor.filepath, extractor.mime_type, extractor.base_uri)
|
|
163
|
+
if isinstance(extractor, RdfFileExtractor) and not extractor.issue_list.has_errors:
|
|
164
|
+
self._parse_file(extractor.filepath, cast(str, extractor.mime_type), extractor.base_uri)
|
|
165
|
+
elif isinstance(extractor, RdfFileExtractor):
|
|
166
|
+
success = False
|
|
167
|
+
issue_text = "\n".join([issue.as_message() for issue in extractor.issue_list])
|
|
168
|
+
warnings.warn(
|
|
169
|
+
f"Cannot write to graph store with {type(extractor).__name__}, errors found in file:\n{issue_text}",
|
|
170
|
+
stacklevel=2,
|
|
171
|
+
)
|
|
164
172
|
else:
|
|
165
173
|
self._add_triples(extractor.extract())
|
|
166
174
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
if success:
|
|
176
|
+
self.provenance.append(
|
|
177
|
+
Change.record(
|
|
178
|
+
activity=f"{type(extractor).__name__}",
|
|
179
|
+
start=_start,
|
|
180
|
+
end=datetime.now(timezone.utc),
|
|
181
|
+
description=f"Extracted triples to graph store using {type(extractor).__name__}",
|
|
182
|
+
)
|
|
173
183
|
)
|
|
174
|
-
)
|
|
175
184
|
|
|
176
185
|
def read(self, class_: str) -> Iterable[tuple[str, dict[str | InstanceType, list[str]]]]:
|
|
177
186
|
"""Read instances for given view from the graph store."""
|
|
@@ -234,7 +243,7 @@ class NeatGraphStore:
|
|
|
234
243
|
def _parse_file(
|
|
235
244
|
self,
|
|
236
245
|
filepath: Path,
|
|
237
|
-
mime_type:
|
|
246
|
+
mime_type: str = "application/rdf+xml",
|
|
238
247
|
base_uri: URIRef | None = None,
|
|
239
248
|
) -> None:
|
|
240
249
|
"""Imports graph data from file.
|
|
@@ -342,16 +351,38 @@ class NeatGraphStore:
|
|
|
342
351
|
def _repr_html_(self) -> str:
|
|
343
352
|
provenance = self.provenance._repr_html_()
|
|
344
353
|
summary: pd.DataFrame = self.summary
|
|
345
|
-
summary_text = (
|
|
346
|
-
"<br /><strong>Graph is empty</strong><br />"
|
|
347
|
-
if summary.empty
|
|
348
|
-
else f"<br /><strong>Graph content</strong><br />{cast(pd.DataFrame, summary)._repr_html_()}" # type: ignore[operator]
|
|
349
|
-
)
|
|
350
354
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
355
|
+
if summary.empty:
|
|
356
|
+
summary_text = "<br /><strong>Graph is empty</strong><br />"
|
|
357
|
+
else:
|
|
358
|
+
summary_text = (
|
|
359
|
+
"<br /><strong>Overview</strong>:" # type: ignore
|
|
360
|
+
f"<ul><li>{len(summary)} types</strong></li>"
|
|
361
|
+
f"<li>{sum(summary['Occurrence'])} instances</strong></li></ul>"
|
|
362
|
+
f"{cast(pd.DataFrame, self._shorten_summary(summary))._repr_html_()}" # type: ignore[operator]
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
return f"{summary_text}" f"{provenance}"
|
|
366
|
+
|
|
367
|
+
def _shorten_summary(self, summary: pd.DataFrame) -> pd.DataFrame:
|
|
368
|
+
"""Shorten summary to top 5 types by occurrence."""
|
|
369
|
+
top_5_rows = summary.head(5)
|
|
370
|
+
last_row = summary.tail(1)
|
|
371
|
+
|
|
372
|
+
indexes = [
|
|
373
|
+
*top_5_rows.index.tolist(),
|
|
374
|
+
"...",
|
|
375
|
+
*last_row.index.tolist(),
|
|
376
|
+
]
|
|
377
|
+
|
|
378
|
+
shorter_summary = pd.concat(
|
|
379
|
+
[
|
|
380
|
+
top_5_rows,
|
|
381
|
+
pd.DataFrame([["..."] * summary.shape[1]], columns=summary.columns),
|
|
382
|
+
last_row,
|
|
383
|
+
],
|
|
384
|
+
ignore_index=True,
|
|
357
385
|
)
|
|
386
|
+
shorter_summary.index = cast(Index[Any], indexes)
|
|
387
|
+
|
|
388
|
+
return shorter_summary
|
|
@@ -15,8 +15,8 @@ from typing import TypeVar
|
|
|
15
15
|
|
|
16
16
|
from rdflib import PROV, RDF, Literal, URIRef
|
|
17
17
|
|
|
18
|
+
from cognite.neat._constants import DEFAULT_NAMESPACE
|
|
18
19
|
from cognite.neat._shared import FrozenNeatObject, NeatList
|
|
19
|
-
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
@dataclass(frozen=True)
|
|
@@ -114,3 +114,13 @@ class Provenance(NeatList[Change]):
|
|
|
114
114
|
|
|
115
115
|
def __setitem__(self, *args, **kwargs):
|
|
116
116
|
raise TypeError("Cannot modify change from provenance")
|
|
117
|
+
|
|
118
|
+
def _repr_html_(self) -> str:
|
|
119
|
+
text = "<br /><strong>Provenance</strong>:<ul>"
|
|
120
|
+
|
|
121
|
+
for change in self:
|
|
122
|
+
text += f"<li>{change.description}</li>"
|
|
123
|
+
|
|
124
|
+
text += "</ul>"
|
|
125
|
+
|
|
126
|
+
return text
|
|
@@ -9,7 +9,7 @@ from cognite.client import ClientConfig, CogniteClient
|
|
|
9
9
|
from cognite.client.credentials import CredentialProvider, OAuthClientCredentials, OAuthInteractive, Token
|
|
10
10
|
|
|
11
11
|
from cognite.neat import _version
|
|
12
|
-
from cognite.neat.
|
|
12
|
+
from cognite.neat._utils.auxiliary import local_import
|
|
13
13
|
|
|
14
14
|
__all__ = ["get_cognite_client", "EnvironmentVariables"]
|
|
15
15
|
|
|
@@ -18,7 +18,18 @@ _VALID_LOGIN_FLOWS = get_args(_LOGIN_FLOW)
|
|
|
18
18
|
_CLIENT_NAME = f"CogniteNeat:{_version.__version__}"
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def get_cognite_client(env_file_name: str
|
|
21
|
+
def get_cognite_client(env_file_name: str) -> CogniteClient:
|
|
22
|
+
"""Instantiate a CogniteClient using environment variables. If the environment variables are not set, the user will
|
|
23
|
+
be prompted to enter them.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
env_file_name: The name of the .env file to look for in the repository root. If the file is found, the variables
|
|
27
|
+
will be loaded from the file. If the file is not found, the user will be prompted to enter the variables.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
CogniteClient: A CogniteClient instance.
|
|
31
|
+
|
|
32
|
+
"""
|
|
22
33
|
if not env_file_name.endswith(".env"):
|
|
23
34
|
raise ValueError("env_file_name must end with '.env'")
|
|
24
35
|
with suppress(KeyError):
|
|
@@ -320,5 +331,5 @@ def _env_in_gitignore(repo_root: Path, env_file_name: str) -> bool:
|
|
|
320
331
|
|
|
321
332
|
|
|
322
333
|
if __name__ == "__main__":
|
|
323
|
-
c = get_cognite_client()
|
|
334
|
+
c = get_cognite_client(".env")
|
|
324
335
|
print(c.iam.token.inspect())
|
|
@@ -10,7 +10,7 @@ from types import ModuleType
|
|
|
10
10
|
|
|
11
11
|
from cognite.client.exceptions import CogniteDuplicatedError, CogniteReadTimeout
|
|
12
12
|
|
|
13
|
-
from cognite.neat.
|
|
13
|
+
from cognite.neat._issues.errors import NeatImportError
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def local_import(module: str, extra: str) -> ModuleType:
|
|
@@ -31,6 +31,7 @@ from cognite.client.data_classes.data_modeling import (
|
|
|
31
31
|
from cognite.client.data_classes.data_modeling.ids import (
|
|
32
32
|
ContainerId,
|
|
33
33
|
DataModelId,
|
|
34
|
+
NodeId,
|
|
34
35
|
ViewId,
|
|
35
36
|
)
|
|
36
37
|
from cognite.client.exceptions import CogniteAPIError
|
|
@@ -115,9 +116,14 @@ class SpaceLoader(DataModelingLoader[str, SpaceApply, Space, SpaceApplyList, Spa
|
|
|
115
116
|
nodes = self.client.data_modeling.instances.list(
|
|
116
117
|
"node", limit=-1, filter=filters.Equals(["node", "space"], space)
|
|
117
118
|
)
|
|
118
|
-
if
|
|
119
|
-
|
|
119
|
+
node_types = {NodeId(node.type.space, node.type.external_id) for node in nodes if node.type}
|
|
120
|
+
node_data = set(nodes.as_ids()) - node_types
|
|
121
|
+
if node_data:
|
|
122
|
+
instances = self.client.data_modeling.instances.delete(nodes=list(node_data))
|
|
120
123
|
print(f"Deleted {len(instances.nodes)} nodes")
|
|
124
|
+
if node_types:
|
|
125
|
+
instances = self.client.data_modeling.instances.delete(nodes=list(node_types))
|
|
126
|
+
print(f"Deleted {len(instances.nodes)} node types")
|
|
121
127
|
views = self.client.data_modeling.views.list(limit=-1, space=space)
|
|
122
128
|
if views:
|
|
123
129
|
deleted_views = self.client.data_modeling.views.delete(views.as_ids())
|
|
@@ -15,7 +15,7 @@ from cognite.client.data_classes import (
|
|
|
15
15
|
from cognite.client.exceptions import CogniteAPIError
|
|
16
16
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
17
17
|
|
|
18
|
-
from cognite.neat.
|
|
18
|
+
from cognite.neat._utils.cdf.data_classes import RawTable, RawTableID, RawTableList, RawTableWrite, RawTableWriteList
|
|
19
19
|
|
|
20
20
|
from ._base import ResourceLoader
|
|
21
21
|
|
|
@@ -3,8 +3,8 @@ from dataclasses import dataclass, field
|
|
|
3
3
|
from functools import total_ordering
|
|
4
4
|
from typing import Any, Generic
|
|
5
5
|
|
|
6
|
+
from cognite.neat._issues import NeatIssueList
|
|
6
7
|
from cognite.neat._shared import T_ID, NeatList, NeatObject
|
|
7
|
-
from cognite.neat.issues import NeatIssueList
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@total_ordering
|
cognite/neat/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.93.0"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from cognite.neat._workflows.base import BaseWorkflow
|
|
2
|
+
from cognite.neat._workflows.manager import WorkflowManager
|
|
3
|
+
from cognite.neat._workflows.model import (
|
|
4
|
+
FlowMessage,
|
|
5
|
+
WorkflowFullStateReport,
|
|
6
|
+
WorkflowStepDefinition,
|
|
7
|
+
WorkflowStepEvent,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"BaseWorkflow",
|
|
12
|
+
"WorkflowStepDefinition",
|
|
13
|
+
"WorkflowManager",
|
|
14
|
+
"WorkflowStepEvent",
|
|
15
|
+
"WorkflowFullStateReport",
|
|
16
|
+
"FlowMessage",
|
|
17
|
+
]
|
|
@@ -11,13 +11,13 @@ import yaml
|
|
|
11
11
|
from cognite.client import ClientConfig, CogniteClient
|
|
12
12
|
from prometheus_client import Gauge
|
|
13
13
|
|
|
14
|
-
from cognite.neat.
|
|
15
|
-
from cognite.neat.
|
|
16
|
-
from cognite.neat.
|
|
17
|
-
from cognite.neat.
|
|
18
|
-
from cognite.neat.
|
|
19
|
-
from cognite.neat.
|
|
20
|
-
from cognite.neat.
|
|
14
|
+
from cognite.neat._app.monitoring.metrics import NeatMetricsCollector
|
|
15
|
+
from cognite.neat._config import Config
|
|
16
|
+
from cognite.neat._issues.errors import WorkflowConfigurationNotSetError, WorkflowStepOutputError
|
|
17
|
+
from cognite.neat._utils.auxiliary import retry_decorator
|
|
18
|
+
from cognite.neat._workflows import cdf_store, utils
|
|
19
|
+
from cognite.neat._workflows.cdf_store import CdfStore
|
|
20
|
+
from cognite.neat._workflows.model import (
|
|
21
21
|
FlowMessage,
|
|
22
22
|
StepExecutionStatus,
|
|
23
23
|
StepType,
|
|
@@ -31,9 +31,9 @@ from cognite.neat.workflows.model import (
|
|
|
31
31
|
WorkflowStepEvent,
|
|
32
32
|
WorkflowSystemComponent,
|
|
33
33
|
)
|
|
34
|
-
from cognite.neat.
|
|
35
|
-
from cognite.neat.
|
|
36
|
-
from cognite.neat.
|
|
34
|
+
from cognite.neat._workflows.steps.step_model import DataContract
|
|
35
|
+
from cognite.neat._workflows.steps_registry import StepsRegistry
|
|
36
|
+
from cognite.neat._workflows.tasks import WorkflowTaskBuilder
|
|
37
37
|
|
|
38
38
|
summary_metrics = Gauge("neat_workflow_summary_metrics", "Workflow execution summary metrics", ["wf_name", "name"])
|
|
39
39
|
steps_metrics = Gauge("neat_workflow_steps_metrics", "Workflow step level metrics", ["wf_name", "step_name", "name"])
|
|
@@ -11,9 +11,9 @@ from cognite.client.data_classes import Event, FileMetadataUpdate
|
|
|
11
11
|
from fastapi.encoders import jsonable_encoder
|
|
12
12
|
from pydantic import BaseModel
|
|
13
13
|
|
|
14
|
-
from cognite.neat.
|
|
15
|
-
from cognite.neat.
|
|
16
|
-
from cognite.neat.
|
|
14
|
+
from cognite.neat._issues.errors import WorkflowConfigurationNotSetError
|
|
15
|
+
from cognite.neat._workflows.model import WorkflowFullStateReport, WorkflowState, WorkflowStepEvent
|
|
16
|
+
from cognite.neat._workflows.utils import get_file_hash
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class NeatCdfResource(BaseModel):
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
configs: []
|
|
2
|
-
description: null
|
|
3
|
-
implementation_module: null
|
|
4
|
-
name: Export DMS
|
|
5
|
-
steps:
|
|
6
|
-
- complex_configs: {}
|
|
7
|
-
configs: {}
|
|
8
|
-
description: null
|
|
9
|
-
enabled: true
|
|
10
|
-
id: step_861205
|
|
11
|
-
label: Upload Rules Spreadsheet
|
|
12
|
-
max_retries: 0
|
|
13
|
-
method: null
|
|
14
|
-
params:
|
|
15
|
-
file_type: rules
|
|
16
|
-
retry_delay: 3
|
|
17
|
-
stype: file_uploader
|
|
18
|
-
system_component_id: null
|
|
19
|
-
transition_to:
|
|
20
|
-
- step_295479
|
|
21
|
-
trigger: true
|
|
22
|
-
ui_config:
|
|
23
|
-
pos_x: 629
|
|
24
|
-
pos_y: 57
|
|
25
|
-
- complex_configs: {}
|
|
26
|
-
configs:
|
|
27
|
-
File name: ''
|
|
28
|
-
Report formatter: BasicHTML
|
|
29
|
-
Role: infer
|
|
30
|
-
description: null
|
|
31
|
-
enabled: true
|
|
32
|
-
id: step_295479
|
|
33
|
-
label: Validate
|
|
34
|
-
max_retries: 0
|
|
35
|
-
method: ExcelToRules
|
|
36
|
-
params: {}
|
|
37
|
-
retry_delay: 3
|
|
38
|
-
stype: stdstep
|
|
39
|
-
system_component_id: null
|
|
40
|
-
transition_to:
|
|
41
|
-
- step_50885
|
|
42
|
-
trigger: false
|
|
43
|
-
ui_config:
|
|
44
|
-
pos_x: 629
|
|
45
|
-
pos_y: 161
|
|
46
|
-
- complex_configs:
|
|
47
|
-
Components:
|
|
48
|
-
containers: true
|
|
49
|
-
data_models: true
|
|
50
|
-
spaces: true
|
|
51
|
-
views: true
|
|
52
|
-
configs:
|
|
53
|
-
Dry run: 'False'
|
|
54
|
-
Existing component handling: update
|
|
55
|
-
Multi-space components create: 'True'
|
|
56
|
-
description: null
|
|
57
|
-
enabled: true
|
|
58
|
-
id: step_50885
|
|
59
|
-
label: Export Data Model to CDF
|
|
60
|
-
max_retries: 0
|
|
61
|
-
method: RulesToDMS
|
|
62
|
-
params: {}
|
|
63
|
-
retry_delay: 3
|
|
64
|
-
stype: stdstep
|
|
65
|
-
system_component_id: null
|
|
66
|
-
transition_to:
|
|
67
|
-
- step_171560
|
|
68
|
-
trigger: false
|
|
69
|
-
ui_config:
|
|
70
|
-
pos_x: 629
|
|
71
|
-
pos_y: 243
|
|
72
|
-
- complex_configs: {}
|
|
73
|
-
configs: {}
|
|
74
|
-
description: null
|
|
75
|
-
enabled: true
|
|
76
|
-
id: step_171560
|
|
77
|
-
label: Export Transformations
|
|
78
|
-
max_retries: 0
|
|
79
|
-
method: RulesToCDFTransformations
|
|
80
|
-
params: {}
|
|
81
|
-
retry_delay: 3
|
|
82
|
-
stype: stdstep
|
|
83
|
-
system_component_id: null
|
|
84
|
-
transition_to: []
|
|
85
|
-
trigger: false
|
|
86
|
-
ui_config:
|
|
87
|
-
pos_x: 629
|
|
88
|
-
pos_y: 342
|
|
89
|
-
system_components: []
|
|
1
|
+
configs: []
|
|
2
|
+
description: null
|
|
3
|
+
implementation_module: null
|
|
4
|
+
name: Export DMS
|
|
5
|
+
steps:
|
|
6
|
+
- complex_configs: {}
|
|
7
|
+
configs: {}
|
|
8
|
+
description: null
|
|
9
|
+
enabled: true
|
|
10
|
+
id: step_861205
|
|
11
|
+
label: Upload Rules Spreadsheet
|
|
12
|
+
max_retries: 0
|
|
13
|
+
method: null
|
|
14
|
+
params:
|
|
15
|
+
file_type: rules
|
|
16
|
+
retry_delay: 3
|
|
17
|
+
stype: file_uploader
|
|
18
|
+
system_component_id: null
|
|
19
|
+
transition_to:
|
|
20
|
+
- step_295479
|
|
21
|
+
trigger: true
|
|
22
|
+
ui_config:
|
|
23
|
+
pos_x: 629
|
|
24
|
+
pos_y: 57
|
|
25
|
+
- complex_configs: {}
|
|
26
|
+
configs:
|
|
27
|
+
File name: ''
|
|
28
|
+
Report formatter: BasicHTML
|
|
29
|
+
Role: infer
|
|
30
|
+
description: null
|
|
31
|
+
enabled: true
|
|
32
|
+
id: step_295479
|
|
33
|
+
label: Validate
|
|
34
|
+
max_retries: 0
|
|
35
|
+
method: ExcelToRules
|
|
36
|
+
params: {}
|
|
37
|
+
retry_delay: 3
|
|
38
|
+
stype: stdstep
|
|
39
|
+
system_component_id: null
|
|
40
|
+
transition_to:
|
|
41
|
+
- step_50885
|
|
42
|
+
trigger: false
|
|
43
|
+
ui_config:
|
|
44
|
+
pos_x: 629
|
|
45
|
+
pos_y: 161
|
|
46
|
+
- complex_configs:
|
|
47
|
+
Components:
|
|
48
|
+
containers: true
|
|
49
|
+
data_models: true
|
|
50
|
+
spaces: true
|
|
51
|
+
views: true
|
|
52
|
+
configs:
|
|
53
|
+
Dry run: 'False'
|
|
54
|
+
Existing component handling: update
|
|
55
|
+
Multi-space components create: 'True'
|
|
56
|
+
description: null
|
|
57
|
+
enabled: true
|
|
58
|
+
id: step_50885
|
|
59
|
+
label: Export Data Model to CDF
|
|
60
|
+
max_retries: 0
|
|
61
|
+
method: RulesToDMS
|
|
62
|
+
params: {}
|
|
63
|
+
retry_delay: 3
|
|
64
|
+
stype: stdstep
|
|
65
|
+
system_component_id: null
|
|
66
|
+
transition_to:
|
|
67
|
+
- step_171560
|
|
68
|
+
trigger: false
|
|
69
|
+
ui_config:
|
|
70
|
+
pos_x: 629
|
|
71
|
+
pos_y: 243
|
|
72
|
+
- complex_configs: {}
|
|
73
|
+
configs: {}
|
|
74
|
+
description: null
|
|
75
|
+
enabled: true
|
|
76
|
+
id: step_171560
|
|
77
|
+
label: Export Transformations
|
|
78
|
+
max_retries: 0
|
|
79
|
+
method: RulesToCDFTransformations
|
|
80
|
+
params: {}
|
|
81
|
+
retry_delay: 3
|
|
82
|
+
stype: stdstep
|
|
83
|
+
system_component_id: null
|
|
84
|
+
transition_to: []
|
|
85
|
+
trigger: false
|
|
86
|
+
ui_config:
|
|
87
|
+
pos_x: 629
|
|
88
|
+
pos_y: 342
|
|
89
|
+
system_components: []
|
|
@@ -9,12 +9,12 @@ from cognite.client import CogniteClient
|
|
|
9
9
|
from prometheus_client import Gauge
|
|
10
10
|
from pydantic import BaseModel
|
|
11
11
|
|
|
12
|
-
from cognite.neat.
|
|
13
|
-
from cognite.neat.
|
|
14
|
-
from cognite.neat.
|
|
15
|
-
from cognite.neat.
|
|
16
|
-
from cognite.neat.
|
|
17
|
-
from cognite.neat.
|
|
12
|
+
from cognite.neat._config import Config
|
|
13
|
+
from cognite.neat._workflows import BaseWorkflow
|
|
14
|
+
from cognite.neat._workflows.base import WorkflowDefinition
|
|
15
|
+
from cognite.neat._workflows.model import FlowMessage, InstanceStartMethod, WorkflowState, WorkflowStepDefinition
|
|
16
|
+
from cognite.neat._workflows.steps_registry import StepsRegistry
|
|
17
|
+
from cognite.neat._workflows.tasks import WorkflowTaskBuilder
|
|
18
18
|
|
|
19
19
|
live_workflow_instances = Gauge("neat_workflow_live_instances", "Count of live workflow instances", ["itype"])
|
|
20
20
|
|
|
@@ -9,14 +9,14 @@ from cognite.client.data_classes import (
|
|
|
9
9
|
)
|
|
10
10
|
from cognite.client.data_classes.data_modeling import EdgeApply, NodeApply
|
|
11
11
|
|
|
12
|
-
from cognite.neat.
|
|
12
|
+
from cognite.neat._rules.models import (
|
|
13
13
|
AssetRules,
|
|
14
14
|
DMSRules,
|
|
15
15
|
DomainRules,
|
|
16
16
|
InformationRules,
|
|
17
17
|
)
|
|
18
|
-
from cognite.neat.
|
|
19
|
-
from cognite.neat.
|
|
18
|
+
from cognite.neat._store import NeatGraphStore
|
|
19
|
+
from cognite.neat._workflows.steps.step_model import DataContract
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class MultiRuleData(DataContract):
|
|
@@ -2,16 +2,13 @@ import json
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import ClassVar, cast
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
|
|
7
|
-
from cognite.neat.
|
|
8
|
-
from cognite.neat.
|
|
9
|
-
from cognite.neat.
|
|
10
|
-
from cognite.neat.
|
|
11
|
-
from cognite.neat.
|
|
12
|
-
from cognite.neat.workflows.model import FlowMessage, StepExecutionStatus
|
|
13
|
-
from cognite.neat.workflows.steps.data_contracts import MultiRuleData, NeatGraph
|
|
14
|
-
from cognite.neat.workflows.steps.step_model import Configurable, Step
|
|
5
|
+
from cognite.neat._graph.extractors import RdfFileExtractor
|
|
6
|
+
from cognite.neat._graph.extractors._mock_graph_generator import MockGraphGenerator
|
|
7
|
+
from cognite.neat._issues.errors import WorkflowStepNotInitializedError
|
|
8
|
+
from cognite.neat._rules._shared import DMSRules, InformationRules
|
|
9
|
+
from cognite.neat._workflows.model import FlowMessage, StepExecutionStatus
|
|
10
|
+
from cognite.neat._workflows.steps.data_contracts import MultiRuleData, NeatGraph
|
|
11
|
+
from cognite.neat._workflows.steps.step_model import Configurable, Step
|
|
15
12
|
|
|
16
13
|
__all__ = ["GraphFromRdfFile", "GraphFromMockData"]
|
|
17
14
|
|
|
@@ -83,25 +80,7 @@ class GraphFromRdfFile(Step):
|
|
|
83
80
|
name="File path",
|
|
84
81
|
value="source-graphs/source-graph-dump.xml",
|
|
85
82
|
label="File name of source graph data dump in RDF format",
|
|
86
|
-
)
|
|
87
|
-
Configurable(
|
|
88
|
-
name="MIME type",
|
|
89
|
-
value="application/rdf+xml",
|
|
90
|
-
label="MIME type of file containing RDF graph",
|
|
91
|
-
options=[
|
|
92
|
-
"application/rdf+xml",
|
|
93
|
-
"text/turtle",
|
|
94
|
-
"application/n-triples",
|
|
95
|
-
"application/n-quads",
|
|
96
|
-
"application/trig",
|
|
97
|
-
],
|
|
98
|
-
),
|
|
99
|
-
Configurable(
|
|
100
|
-
name="Add base URI",
|
|
101
|
-
value="True",
|
|
102
|
-
label="Whether to add base URI to graph in case if entity ids are relative",
|
|
103
|
-
options=["True", "False"],
|
|
104
|
-
),
|
|
83
|
+
)
|
|
105
84
|
]
|
|
106
85
|
|
|
107
86
|
def run(self, store: NeatGraph) -> FlowMessage: # type: ignore[override, syntax]
|
|
@@ -112,8 +91,6 @@ class GraphFromRdfFile(Step):
|
|
|
112
91
|
store.graph.write(
|
|
113
92
|
RdfFileExtractor( # type: ignore[abstract]
|
|
114
93
|
filepath=self.data_store_path / Path(source_file),
|
|
115
|
-
mime_type=self.configs["MIME type"], # type: ignore[arg-type]
|
|
116
|
-
base_uri=(URIRef(DEFAULT_NAMESPACE) if self.configs["Add base URI"] == "True" else None),
|
|
117
94
|
)
|
|
118
95
|
)
|
|
119
96
|
|
|
@@ -2,10 +2,10 @@ import time
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import ClassVar
|
|
4
4
|
|
|
5
|
-
from cognite.neat.
|
|
6
|
-
from cognite.neat.
|
|
7
|
-
from cognite.neat.
|
|
8
|
-
from cognite.neat.
|
|
5
|
+
from cognite.neat._issues.errors import WorkflowStepNotInitializedError
|
|
6
|
+
from cognite.neat._workflows.model import FlowMessage
|
|
7
|
+
from cognite.neat._workflows.steps.data_contracts import NeatGraph
|
|
8
|
+
from cognite.neat._workflows.steps.step_model import Configurable, Step
|
|
9
9
|
|
|
10
10
|
__all__ = [
|
|
11
11
|
"GraphToRdfFile",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from typing import ClassVar
|
|
2
2
|
|
|
3
|
-
from cognite.neat.
|
|
4
|
-
from cognite.neat.
|
|
5
|
-
from cognite.neat.
|
|
3
|
+
from cognite.neat._store import NeatGraphStore
|
|
4
|
+
from cognite.neat._workflows.model import FlowMessage
|
|
5
|
+
from cognite.neat._workflows.steps.data_contracts import (
|
|
6
6
|
MultiRuleData,
|
|
7
7
|
NeatGraph,
|
|
8
8
|
)
|
|
9
|
-
from cognite.neat.
|
|
9
|
+
from cognite.neat._workflows.steps.step_model import Configurable, Step
|
|
10
10
|
|
|
11
11
|
__all__ = ["GraphStoreConfiguration"]
|
|
12
12
|
|
|
@@ -2,20 +2,20 @@ import time
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import ClassVar, Literal, cast
|
|
4
4
|
|
|
5
|
-
from cognite.neat.
|
|
6
|
-
from cognite.neat.
|
|
7
|
-
from cognite.neat.
|
|
8
|
-
from cognite.neat.
|
|
9
|
-
from cognite.neat.
|
|
5
|
+
from cognite.neat._issues.errors import WorkflowStepNotInitializedError
|
|
6
|
+
from cognite.neat._rules import exporters
|
|
7
|
+
from cognite.neat._rules._shared import DMSRules, InformationRules, VerifiedRules
|
|
8
|
+
from cognite.neat._rules.models import AssetRules, RoleTypes
|
|
9
|
+
from cognite.neat._rules.transformers import (
|
|
10
10
|
AssetToInformation,
|
|
11
11
|
DMSToInformation,
|
|
12
12
|
InformationToAsset,
|
|
13
13
|
InformationToDMS,
|
|
14
14
|
RulesPipeline,
|
|
15
15
|
)
|
|
16
|
-
from cognite.neat.
|
|
17
|
-
from cognite.neat.
|
|
18
|
-
from cognite.neat.
|
|
16
|
+
from cognite.neat._workflows.model import FlowMessage, StepExecutionStatus
|
|
17
|
+
from cognite.neat._workflows.steps.data_contracts import CogniteClient, MultiRuleData
|
|
18
|
+
from cognite.neat._workflows.steps.step_model import Configurable, Step
|
|
19
19
|
|
|
20
20
|
__all__ = [
|
|
21
21
|
"RulesToDMS",
|