cognite-neat 0.92.3__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 +12 -8
- 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 +7 -7
- 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 +15 -6
- cognite/neat/{rules → _rules}/models/_base_rules.py +14 -2
- 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 +26 -23
- 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 +7 -4
- cognite/neat/{rules → _rules}/models/information/_rules.py +34 -22
- 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.3.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.3.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.3.dist-info/RECORD +0 -224
- cognite_neat-0.92.3.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.3.dist-info → cognite_neat-0.93.0.dist-info}/LICENSE +0 -0
|
@@ -22,7 +22,7 @@ from pydantic import (
|
|
|
22
22
|
model_validator,
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
-
from cognite.neat.
|
|
25
|
+
from cognite.neat._utils.text import replace_non_alphanumeric_with_underscore
|
|
26
26
|
|
|
27
27
|
if sys.version_info >= (3, 11):
|
|
28
28
|
from enum import StrEnum
|
|
@@ -31,12 +31,15 @@ else:
|
|
|
31
31
|
from backports.strenum import StrEnum
|
|
32
32
|
from typing_extensions import Self
|
|
33
33
|
|
|
34
|
-
from cognite.neat.
|
|
34
|
+
from cognite.neat._rules._constants import (
|
|
35
|
+
ENTITY_PATTERN,
|
|
36
|
+
SPLIT_ON_COMMA_PATTERN,
|
|
37
|
+
SPLIT_ON_EQUAL_PATTERN,
|
|
38
|
+
EntityTypes,
|
|
39
|
+
)
|
|
35
40
|
|
|
36
41
|
from ._constants import (
|
|
37
42
|
_PARSE,
|
|
38
|
-
ENTITY_PATTERN,
|
|
39
|
-
EntityTypes,
|
|
40
43
|
Undefined,
|
|
41
44
|
Unknown,
|
|
42
45
|
_UndefinedType,
|
|
@@ -8,38 +8,42 @@ from pydantic import Field, field_serializer, field_validator, model_validator
|
|
|
8
8
|
from pydantic_core.core_schema import SerializationInfo
|
|
9
9
|
from rdflib import Namespace
|
|
10
10
|
|
|
11
|
-
from cognite.neat.
|
|
12
|
-
from cognite.neat.
|
|
13
|
-
from cognite.neat.
|
|
11
|
+
from cognite.neat._constants import get_default_prefixes
|
|
12
|
+
from cognite.neat._issues.errors import NeatValueError, PropertyDefinitionError
|
|
13
|
+
from cognite.neat._rules._constants import EntityTypes
|
|
14
|
+
from cognite.neat._rules.models._base_rules import (
|
|
14
15
|
BaseMetadata,
|
|
15
16
|
BaseRules,
|
|
17
|
+
ClassRef,
|
|
16
18
|
DataModelType,
|
|
17
19
|
ExtensionCategory,
|
|
18
20
|
ExtensionCategoryType,
|
|
19
21
|
MatchType,
|
|
22
|
+
PropertyRef,
|
|
20
23
|
RoleTypes,
|
|
21
24
|
SchemaCompleteness,
|
|
22
25
|
SheetList,
|
|
23
26
|
SheetRow,
|
|
24
27
|
)
|
|
25
|
-
from cognite.neat.
|
|
28
|
+
from cognite.neat._rules.models._rdfpath import (
|
|
26
29
|
RDFPath,
|
|
27
30
|
TransformationRuleType,
|
|
28
31
|
parse_rule,
|
|
29
32
|
)
|
|
30
|
-
from cognite.neat.
|
|
33
|
+
from cognite.neat._rules.models._types import (
|
|
34
|
+
ClassEntityType,
|
|
35
|
+
InformationPropertyType,
|
|
36
|
+
MultiValueTypeType,
|
|
31
37
|
NamespaceType,
|
|
32
38
|
PrefixType,
|
|
33
|
-
PropertyType,
|
|
34
39
|
StrListType,
|
|
35
40
|
VersionType,
|
|
36
41
|
)
|
|
37
|
-
from cognite.neat.
|
|
38
|
-
from cognite.neat.
|
|
42
|
+
from cognite.neat._rules.models.data_types import DataType
|
|
43
|
+
from cognite.neat._rules.models.entities import (
|
|
39
44
|
ClassEntity,
|
|
40
45
|
ClassEntityList,
|
|
41
46
|
Entity,
|
|
42
|
-
EntityTypes,
|
|
43
47
|
MultiValueTypeInfo,
|
|
44
48
|
ReferenceEntity,
|
|
45
49
|
Undefined,
|
|
@@ -48,7 +52,7 @@ from cognite.neat.rules.models.entities import (
|
|
|
48
52
|
)
|
|
49
53
|
|
|
50
54
|
if TYPE_CHECKING:
|
|
51
|
-
from cognite.neat.
|
|
55
|
+
from cognite.neat._rules.models import DMSRules
|
|
52
56
|
|
|
53
57
|
|
|
54
58
|
if sys.version_info >= (3, 11):
|
|
@@ -135,7 +139,7 @@ class InformationClass(SheetRow):
|
|
|
135
139
|
match_type: The match type of the resource being described and the source entity.
|
|
136
140
|
"""
|
|
137
141
|
|
|
138
|
-
class_:
|
|
142
|
+
class_: ClassEntityType = Field(alias="Class")
|
|
139
143
|
name: str | None = Field(alias="Name", default=None)
|
|
140
144
|
description: str | None = Field(alias="Description", default=None)
|
|
141
145
|
parent: ClassEntityList | None = Field(alias="Parent Class", default=None)
|
|
@@ -169,6 +173,9 @@ class InformationClass(SheetRow):
|
|
|
169
173
|
)
|
|
170
174
|
return ",".join(str(value) for value in value)
|
|
171
175
|
|
|
176
|
+
def as_reference(self) -> ClassRef:
|
|
177
|
+
return ClassRef(Class=self.class_)
|
|
178
|
+
|
|
172
179
|
|
|
173
180
|
class InformationProperty(SheetRow):
|
|
174
181
|
"""
|
|
@@ -189,11 +196,11 @@ class InformationProperty(SheetRow):
|
|
|
189
196
|
knowledge graph. Defaults to None (no transformation)
|
|
190
197
|
"""
|
|
191
198
|
|
|
192
|
-
class_:
|
|
193
|
-
property_:
|
|
199
|
+
class_: ClassEntityType = Field(alias="Class")
|
|
200
|
+
property_: InformationPropertyType = Field(alias="Property")
|
|
194
201
|
name: str | None = Field(alias="Name", default=None)
|
|
195
202
|
description: str | None = Field(alias="Description", default=None)
|
|
196
|
-
value_type: DataType |
|
|
203
|
+
value_type: DataType | ClassEntityType | MultiValueTypeType | UnknownEntity = Field(
|
|
197
204
|
alias="Value Type", union_mode="left_to_right"
|
|
198
205
|
)
|
|
199
206
|
min_count: int | None = Field(alias="Min Count", default=None)
|
|
@@ -201,7 +208,7 @@ class InformationProperty(SheetRow):
|
|
|
201
208
|
default: Any | None = Field(alias="Default", default=None)
|
|
202
209
|
reference: URLEntity | ReferenceEntity | None = Field(alias="Reference", default=None, union_mode="left_to_right")
|
|
203
210
|
match_type: MatchType | None = Field(alias="Match Type", default=None)
|
|
204
|
-
transformation:
|
|
211
|
+
transformation: RDFPath | None = Field(alias="Transformation", default=None)
|
|
205
212
|
comment: str | None = Field(alias="Comment", default=None)
|
|
206
213
|
inherited: bool = Field(
|
|
207
214
|
default=False,
|
|
@@ -219,12 +226,14 @@ class InformationProperty(SheetRow):
|
|
|
219
226
|
return float("inf")
|
|
220
227
|
return value
|
|
221
228
|
|
|
222
|
-
@
|
|
223
|
-
def
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
229
|
+
@field_validator("transformation", mode="before")
|
|
230
|
+
def generate_rdfpath(cls, value: str | RDFPath | None) -> RDFPath | None:
|
|
231
|
+
if value is None or isinstance(value, RDFPath):
|
|
232
|
+
return value
|
|
233
|
+
elif isinstance(value, str):
|
|
234
|
+
return parse_rule(value, TransformationRuleType.rdfpath)
|
|
235
|
+
else:
|
|
236
|
+
raise NeatValueError(f"Invalid RDF Path: {value!s}")
|
|
228
237
|
|
|
229
238
|
@model_validator(mode="after")
|
|
230
239
|
def set_default_as_list(self):
|
|
@@ -312,6 +321,9 @@ class InformationProperty(SheetRow):
|
|
|
312
321
|
isinstance(self.max_count, int | float) and self.max_count > 1
|
|
313
322
|
)
|
|
314
323
|
|
|
324
|
+
def as_reference(self) -> PropertyRef:
|
|
325
|
+
return PropertyRef(Class=self.class_, Property=self.property_)
|
|
326
|
+
|
|
315
327
|
|
|
316
328
|
class InformationRules(BaseRules):
|
|
317
329
|
metadata: InformationMetadata = Field(alias="Metadata")
|
|
@@ -365,6 +377,6 @@ class InformationRules(BaseRules):
|
|
|
365
377
|
return self
|
|
366
378
|
|
|
367
379
|
def as_dms_rules(self) -> "DMSRules":
|
|
368
|
-
from cognite.neat.
|
|
380
|
+
from cognite.neat._rules.transformers._converters import _InformationRulesConverter
|
|
369
381
|
|
|
370
382
|
return _InformationRulesConverter(self).as_dms_rules()
|
|
@@ -4,9 +4,9 @@ from typing import Any, Literal
|
|
|
4
4
|
|
|
5
5
|
from rdflib import Namespace
|
|
6
6
|
|
|
7
|
-
from cognite.neat.
|
|
8
|
-
from cognite.neat.
|
|
9
|
-
from cognite.neat.
|
|
7
|
+
from cognite.neat._rules.models._base_input import InputComponent, InputRules
|
|
8
|
+
from cognite.neat._rules.models.data_types import DataType
|
|
9
|
+
from cognite.neat._rules.models.entities import (
|
|
10
10
|
ClassEntity,
|
|
11
11
|
MultiValueTypeInfo,
|
|
12
12
|
UnknownEntity,
|
|
@@ -2,11 +2,12 @@ import itertools
|
|
|
2
2
|
from collections import Counter
|
|
3
3
|
from typing import 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 import IssueList
|
|
6
|
+
from cognite.neat._issues.errors import NeatValueError, ResourceNotDefinedError
|
|
7
|
+
from cognite.neat._rules._constants import EntityTypes
|
|
8
|
+
from cognite.neat._rules.models._base_rules import DataModelType, SchemaCompleteness
|
|
9
|
+
from cognite.neat._rules.models.entities import ClassEntity, UnknownEntity
|
|
10
|
+
from cognite.neat._utils.rdf_ import get_inheritance_path
|
|
10
11
|
|
|
11
12
|
from ._rules import InformationRules
|
|
12
13
|
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
from collections import Counter, defaultdict
|
|
2
|
+
from collections.abc import Iterator, MutableSequence, Sequence
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, Generic, SupportsIndex, TypeVar, cast, get_args, overload
|
|
5
|
+
|
|
6
|
+
import pandas as pd
|
|
7
|
+
from pydantic import BaseModel, GetCoreSchemaHandler, field_validator
|
|
8
|
+
from pydantic_core import core_schema
|
|
9
|
+
from pydantic_core.core_schema import ValidationInfo
|
|
10
|
+
|
|
11
|
+
from cognite.neat._issues.errors import NeatValueError
|
|
12
|
+
from cognite.neat._rules.models._base_rules import ClassRef, PropertyRef
|
|
13
|
+
from cognite.neat._rules.models.entities import ClassEntity, Undefined
|
|
14
|
+
|
|
15
|
+
T_Mapping = TypeVar("T_Mapping", bound=ClassRef | PropertyRef)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Mapping(BaseModel, Generic[T_Mapping]):
|
|
19
|
+
source: T_Mapping
|
|
20
|
+
destination: T_Mapping
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class MappingList(list, MutableSequence[Mapping[T_Mapping]]):
|
|
24
|
+
@classmethod
|
|
25
|
+
def __get_pydantic_core_schema__(cls, source: Any, handler: GetCoreSchemaHandler) -> core_schema.CoreSchema:
|
|
26
|
+
if args := get_args(source):
|
|
27
|
+
item_type = args[0]
|
|
28
|
+
else:
|
|
29
|
+
# Someone use SheetList without specifying the type
|
|
30
|
+
raise TypeError("SheetList must be used with a type argument, e.g., SheetList[InformationProperty]")
|
|
31
|
+
|
|
32
|
+
instance_schema = core_schema.is_instance_schema(cls)
|
|
33
|
+
sequence_row_schema = handler.generate_schema(Sequence[item_type]) # type: ignore[valid-type]
|
|
34
|
+
|
|
35
|
+
non_instance_schema = core_schema.no_info_after_validator_function(MappingList, sequence_row_schema)
|
|
36
|
+
return core_schema.union_schema([instance_schema, non_instance_schema])
|
|
37
|
+
|
|
38
|
+
def as_destination_by_source(self) -> dict[T_Mapping, T_Mapping]:
|
|
39
|
+
return {mapping.source: mapping.destination for mapping in self}
|
|
40
|
+
|
|
41
|
+
def to_pandas(self, drop_na_columns: bool = True, include: list[str] | None = None) -> pd.DataFrame:
|
|
42
|
+
"""Converts ResourceDict to pandas DataFrame."""
|
|
43
|
+
df = pd.DataFrame([entity.model_dump() for entity in self])
|
|
44
|
+
if drop_na_columns:
|
|
45
|
+
df = df.dropna(axis=1, how="all")
|
|
46
|
+
if include is not None:
|
|
47
|
+
df = df[include]
|
|
48
|
+
return df
|
|
49
|
+
|
|
50
|
+
def _repr_html_(self) -> str:
|
|
51
|
+
"""Returns HTML representation of ResourceDict."""
|
|
52
|
+
return self.to_pandas(drop_na_columns=True)._repr_html_() # type: ignore[operator]
|
|
53
|
+
|
|
54
|
+
# Implemented to get correct type hints
|
|
55
|
+
def __iter__(self) -> Iterator[Mapping[T_Mapping]]:
|
|
56
|
+
return super().__iter__()
|
|
57
|
+
|
|
58
|
+
@overload
|
|
59
|
+
def __getitem__(self, index: SupportsIndex) -> Mapping[T_Mapping]: ...
|
|
60
|
+
|
|
61
|
+
@overload
|
|
62
|
+
def __getitem__(self, index: slice) -> "MappingList[T_Mapping]": ...
|
|
63
|
+
|
|
64
|
+
def __getitem__(self, index: SupportsIndex | slice, /) -> "Mapping[T_Mapping] | MappingList[T_Mapping]":
|
|
65
|
+
if isinstance(index, slice):
|
|
66
|
+
return MappingList[T_Mapping](super().__getitem__(index))
|
|
67
|
+
return super().__getitem__(index)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class RuleMapping(BaseModel):
|
|
71
|
+
properties: MappingList[PropertyRef]
|
|
72
|
+
classes: MappingList[ClassRef]
|
|
73
|
+
|
|
74
|
+
@field_validator("properties", "classes", mode="before")
|
|
75
|
+
def as_mapping_list(cls, value: Sequence[Any], info: ValidationInfo) -> Any:
|
|
76
|
+
if isinstance(value, Sequence) and not isinstance(value, MappingList):
|
|
77
|
+
annotation = cast(type, cls.model_fields[info.field_name].annotation) # type: ignore[index]
|
|
78
|
+
ref_cls = get_args(annotation)[0]
|
|
79
|
+
return annotation([Mapping[ref_cls].model_validate(item) for item in value]) # type: ignore[valid-type, index]
|
|
80
|
+
return value
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def load_spreadsheet(
|
|
84
|
+
cls, path: str | Path, source_prefix: str | None = None, destination_prefix: str | None = None
|
|
85
|
+
) -> "RuleMapping":
|
|
86
|
+
"""Loads mapping from Excel spreadsheet.
|
|
87
|
+
|
|
88
|
+
This method expects four columns in the spreadsheet. The first two columns are the source class and
|
|
89
|
+
property, and the last two columns are the destination class and property. The method will create
|
|
90
|
+
a mapping for each row in the spreadsheet.
|
|
91
|
+
|
|
92
|
+
The class mapping will be inferred from the property mappings. If a source class has multiple
|
|
93
|
+
destination classes, the most common destination class will be used.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
path: Path to Excel spreadsheet.
|
|
97
|
+
source_prefix: Default prefix for source classes.
|
|
98
|
+
destination_prefix: Default prefix for destination classes.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Mapping object.
|
|
102
|
+
|
|
103
|
+
"""
|
|
104
|
+
df = pd.read_excel(path).dropna(axis=1, how="all")
|
|
105
|
+
properties = MappingList[PropertyRef]()
|
|
106
|
+
destination_classes_by_source: dict[ClassEntity, Counter[ClassEntity]] = defaultdict(Counter)
|
|
107
|
+
for _, row in df.iterrows():
|
|
108
|
+
if len(row) < 4:
|
|
109
|
+
raise NeatValueError(f"Row {row} is not valid. Expected 4 columns, got {len(row)}")
|
|
110
|
+
|
|
111
|
+
if any(pd.isna(row.iloc[:4])):
|
|
112
|
+
continue
|
|
113
|
+
source_class, source_property, destination_class, destination_property = row.iloc[:4]
|
|
114
|
+
source_entity = ClassEntity.load(source_class, prefix=source_prefix or Undefined)
|
|
115
|
+
destination_entity = ClassEntity.load(destination_class, prefix=destination_prefix or Undefined)
|
|
116
|
+
properties.append(
|
|
117
|
+
Mapping(
|
|
118
|
+
source=PropertyRef(Class=source_entity, Property=source_property),
|
|
119
|
+
destination=PropertyRef(Class=destination_entity, Property=destination_property),
|
|
120
|
+
)
|
|
121
|
+
)
|
|
122
|
+
destination_classes_by_source[source_entity][destination_entity] += 1
|
|
123
|
+
|
|
124
|
+
classes = MappingList[ClassRef]()
|
|
125
|
+
for source_entity, destination_classes in destination_classes_by_source.items():
|
|
126
|
+
destination_entity = destination_classes.most_common(1)[0][0]
|
|
127
|
+
classes.append(
|
|
128
|
+
Mapping(source=ClassRef(Class=source_entity), destination=ClassRef(Class=destination_entity))
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
return cls(properties=properties, classes=classes)
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
from ._base import RuleMapping
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def create_classic_to_core_mapping() -> RuleMapping:
|
|
5
|
+
return RuleMapping.model_validate(_CLASSIC_TO_CORE)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
_CLASSIC_TO_CORE = {
|
|
9
|
+
"classes": [
|
|
10
|
+
{"destination": {"Class": "cdf_cdm:CogniteAsset"}, "source": {"Class": "classic:Asset"}},
|
|
11
|
+
{"destination": {"Class": "cdf_cdm:DataProduct"}, "source": {"Class": "classic:DataSet"}},
|
|
12
|
+
{"destination": {"Class": "cdf_cdm:CogniteActivity"}, "source": {"Class": "classic:Event"}},
|
|
13
|
+
{"destination": {"Class": "cdf_cdm:CogniteFile"}, "source": {"Class": "classic:File"}},
|
|
14
|
+
{"destination": {"Class": "cdf_cdm:CogniteTimeSeries"}, "source": {"Class": "classic:TimeSeries"}},
|
|
15
|
+
],
|
|
16
|
+
"properties": [
|
|
17
|
+
{
|
|
18
|
+
"destination": {"Class": "cdf_cdm:CogniteAsset", "Property": "externalId"},
|
|
19
|
+
"source": {"Class": "classic:Asset", "Property": "externalId"},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"destination": {"Class": "cdf_cdm:CogniteAsset", "Property": "name"},
|
|
23
|
+
"source": {"Class": "classic:Asset", "Property": "name"},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"destination": {"Class": "cdf_cdm:CogniteAsset", "Property": "parent"},
|
|
27
|
+
"source": {"Class": "classic:Asset", "Property": "parentId"},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"destination": {"Class": "cdf_cdm:CogniteAsset", "Property": "description"},
|
|
31
|
+
"source": {"Class": "classic:Asset", "Property": "description"},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"destination": {"Class": "cdf_cdm:CogniteSourceSystem", "Property": "name"},
|
|
35
|
+
"source": {"Class": "classic:Asset", "Property": "source"},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"destination": {"Class": "cdf_cdm:CogniteAsset", "Property": "tag"},
|
|
39
|
+
"source": {"Class": "classic:Asset", "Property": "labels"},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"destination": {"Class": "cdf_cdm:DataProduct", "Property": "externalId"},
|
|
43
|
+
"source": {"Class": "classic:DataSet", "Property": "externalId"},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"destination": {"Class": "cdf_cdm:DataProduct", "Property": "name"},
|
|
47
|
+
"source": {"Class": "classic:DataSet", "Property": "name"},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"destination": {"Class": "cdf_cdm:DataProduct", "Property": "description"},
|
|
51
|
+
"source": {"Class": "classic:DataSet", "Property": "description"},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"destination": {"Class": "cdf_cdm:DataProduct", "Property": "metadata"},
|
|
55
|
+
"source": {"Class": "classic:DataSet", "Property": "metadata"},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"destination": {"Class": "cdf_cdm:DataProduct", "Property": "writeProtected"},
|
|
59
|
+
"source": {"Class": "classic:DataSet", "Property": "writeProtected"},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"destination": {"Class": "cdf_cdm:CogniteActivity", "Property": "externalId"},
|
|
63
|
+
"source": {"Class": "classic:Event", "Property": "externalId"},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"destination": {"Class": "cdf_cdm:CogniteSchedulable", "Property": "startTime"},
|
|
67
|
+
"source": {"Class": "classic:Event", "Property": "startTime"},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"destination": {"Class": "cdf_cdm:CogniteSchedulable", "Property": "endTime"},
|
|
71
|
+
"source": {"Class": "classic:Event", "Property": "endTime"},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"destination": {"Class": "cdf_cdm:CogniteActivity", "Property": "description"},
|
|
75
|
+
"source": {"Class": "classic:Event", "Property": "description"},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"destination": {"Class": "cdf_cdm:CogniteActivity", "Property": "assets"},
|
|
79
|
+
"source": {"Class": "classic:Event", "Property": "assetIds"},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"destination": {"Class": "cdf_cdm:CogniteSourceSystem", "Property": "name"},
|
|
83
|
+
"source": {"Class": "classic:Event", "Property": "source"},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"destination": {"Class": "cdf_cdm:CogniteFile", "Property": "externalId"},
|
|
87
|
+
"source": {"Class": "classic:File", "Property": "externalId"},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"destination": {"Class": "cdf_cdm:CogniteFile", "Property": "name"},
|
|
91
|
+
"source": {"Class": "classic:File", "Property": "name"},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"destination": {"Class": "cdf_cdm:CogniteFile", "Property": "directory"},
|
|
95
|
+
"source": {"Class": "classic:File", "Property": "directory"},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"destination": {"Class": "cdf_cdm:CogniteSourceSystem", "Property": "name"},
|
|
99
|
+
"source": {"Class": "classic:File", "Property": "source"},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"destination": {"Class": "cdf_cdm:CogniteFile", "Property": "mimeType"},
|
|
103
|
+
"source": {"Class": "classic:File", "Property": "mimeType"},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"destination": {"Class": "cdf_cdm:CogniteFile", "Property": "assets"},
|
|
107
|
+
"source": {"Class": "classic:File", "Property": "assetIds"},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"destination": {"Class": "cdf_cdm:CogniteFile", "Property": "sourceCreatedTime"},
|
|
111
|
+
"source": {"Class": "classic:File", "Property": "sourceCreatedTime"},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"destination": {"Class": "cdf_cdm:CogniteFile", "Property": "sourceUpdatedTime"},
|
|
115
|
+
"source": {"Class": "classic:File", "Property": "sourceModifiedTime"},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"destination": {"Class": "cdf_cdm:CogniteTimeSeries", "Property": "externalId"},
|
|
119
|
+
"source": {"Class": "classic:TimeSeries", "Property": "externalId"},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"destination": {"Class": "cdf_cdm:CogniteTimeSeries", "Property": "name"},
|
|
123
|
+
"source": {"Class": "classic:TimeSeries", "Property": "name"},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"destination": {"Class": "cdf_cdm:CogniteTimeSeries", "Property": "type"},
|
|
127
|
+
"source": {"Class": "classic:TimeSeries", "Property": "isString"},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"destination": {"Class": "cdf_cdm:CogniteTimeSeries", "Property": "sourceUnit"},
|
|
131
|
+
"source": {"Class": "classic:TimeSeries", "Property": "unit"},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"destination": {"Class": "cdf_cdm:CogniteTimeSeries", "Property": "unit"},
|
|
135
|
+
"source": {"Class": "classic:TimeSeries", "Property": "unitExternalId"},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"destination": {"Class": "cdf_cdm:CogniteTimeSeries", "Property": "assets"},
|
|
139
|
+
"source": {"Class": "classic:TimeSeries", "Property": "assetId"},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"destination": {"Class": "cdf_cdm:CogniteTimeSeries", "Property": "isStep"},
|
|
143
|
+
"source": {"Class": "classic:TimeSeries", "Property": "isStep"},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"destination": {"Class": "cdf_cdm:CogniteTimeSeries", "Property": "description"},
|
|
147
|
+
"source": {"Class": "classic:TimeSeries", "Property": "description"},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
from ._base import RulesPipeline, RulesTransformer
|
|
2
|
-
from ._converters import
|
|
3
|
-
|
|
2
|
+
from ._converters import (
|
|
3
|
+
AssetToInformation,
|
|
4
|
+
ConvertToRules,
|
|
5
|
+
DMSToInformation,
|
|
6
|
+
InformationToAsset,
|
|
7
|
+
InformationToDMS,
|
|
8
|
+
ReduceCogniteModel,
|
|
9
|
+
ToCompliantEntities,
|
|
10
|
+
ToExtension,
|
|
11
|
+
)
|
|
12
|
+
from ._mapping import MapOneToOne, RuleMapper
|
|
4
13
|
from ._pipelines import ImporterPipeline
|
|
5
14
|
from ._verification import VerifyAnyRules, VerifyAssetRules, VerifyDMSRules, VerifyInformationRules
|
|
6
15
|
|
|
@@ -18,4 +27,8 @@ __all__ = [
|
|
|
18
27
|
"VerifyInformationRules",
|
|
19
28
|
"VerifyAnyRules",
|
|
20
29
|
"MapOneToOne",
|
|
30
|
+
"ToCompliantEntities",
|
|
31
|
+
"RuleMapper",
|
|
32
|
+
"ToExtension",
|
|
33
|
+
"ReduceCogniteModel",
|
|
21
34
|
]
|
|
@@ -2,9 +2,9 @@ from abc import ABC, abstractmethod
|
|
|
2
2
|
from collections.abc import MutableSequence
|
|
3
3
|
from typing import Generic, TypeVar
|
|
4
4
|
|
|
5
|
-
from cognite.neat.
|
|
6
|
-
from cognite.neat.
|
|
7
|
-
from cognite.neat.
|
|
5
|
+
from cognite.neat._issues import IssueList, NeatError
|
|
6
|
+
from cognite.neat._issues.errors import NeatTypeError, NeatValueError
|
|
7
|
+
from cognite.neat._rules._shared import (
|
|
8
8
|
InputRules,
|
|
9
9
|
JustRules,
|
|
10
10
|
MaybeRules,
|