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
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic
|
|
3
3
|
|
|
4
|
-
from cognite.neat.
|
|
4
|
+
from cognite.neat._issues._base import ResourceType
|
|
5
5
|
|
|
6
6
|
from ._resources import ResourceNeatWarning, T_Identifier, T_ReferenceIdentifier
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
@dataclass(
|
|
9
|
+
@dataclass(unsafe_hash=True)
|
|
10
10
|
class PropertyWarning(ResourceNeatWarning[T_Identifier]):
|
|
11
11
|
"""Base class for property warnings {resource_type} with identifier {identifier}.{property_name}"""
|
|
12
12
|
|
|
13
13
|
property_name: str
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
@dataclass(
|
|
16
|
+
@dataclass(unsafe_hash=True)
|
|
17
17
|
class PropertyTypeNotSupportedWarning(PropertyWarning[T_Identifier]):
|
|
18
18
|
"""The {resource_type} with identifier {identifier} has a property {property_name}
|
|
19
19
|
of unsupported type {property_type}. This will be ignored."""
|
|
@@ -21,7 +21,7 @@ class PropertyTypeNotSupportedWarning(PropertyWarning[T_Identifier]):
|
|
|
21
21
|
property_type: str
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
@dataclass(
|
|
24
|
+
@dataclass(unsafe_hash=True)
|
|
25
25
|
class PropertyNotFoundWarning(PropertyWarning, Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
26
26
|
"""The {resource_type} with identifier {identifier} does not have a property {property_name} referred
|
|
27
27
|
to by {referred_type} {referred_by} does not exist. This will be ignored.
|
|
@@ -32,7 +32,7 @@ class PropertyNotFoundWarning(PropertyWarning, Generic[T_Identifier, T_Reference
|
|
|
32
32
|
referred_type: ResourceType
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
@dataclass(
|
|
35
|
+
@dataclass(unsafe_hash=True)
|
|
36
36
|
class PropertyDefinitionDuplicatedWarning(PropertyWarning[T_Identifier]):
|
|
37
37
|
"""Got multiple values for the {resource_type} {identifier}.{property_name} {values}.
|
|
38
38
|
{default_action}"""
|
|
@@ -44,7 +44,7 @@ class PropertyDefinitionDuplicatedWarning(PropertyWarning[T_Identifier]):
|
|
|
44
44
|
recommended_action: str | None = None
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
@dataclass(
|
|
47
|
+
@dataclass(unsafe_hash=True)
|
|
48
48
|
class PropertyValueTypeUndefinedWarning(PropertyWarning[T_Identifier]):
|
|
49
49
|
"""The {resource_type} with identifier {identifier} has a property {property_name}
|
|
50
50
|
which has undefined value type. This may result in unexpected behavior when exporting rules.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic
|
|
3
3
|
|
|
4
|
-
from cognite.neat.
|
|
4
|
+
from cognite.neat._issues._base import NeatWarning, ResourceType, T_Identifier, T_ReferenceIdentifier
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
# Name ResourceNeatWarning to avoid conflicts with the built-in ResourceWarning
|
|
8
|
-
@dataclass(
|
|
8
|
+
@dataclass(unsafe_hash=True)
|
|
9
9
|
class ResourceNeatWarning(NeatWarning, Generic[T_Identifier]):
|
|
10
10
|
"""Base class for resource warnings {resource_type} with identifier {identifier}"""
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ class ResourceNeatWarning(NeatWarning, Generic[T_Identifier]):
|
|
|
13
13
|
resource_type: ResourceType
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
@dataclass(
|
|
16
|
+
@dataclass(unsafe_hash=True)
|
|
17
17
|
class ResourceNotFoundWarning(ResourceNeatWarning, Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
18
18
|
"""The {resource_type} with identifier {identifier} referred by {referred_type} {referred_by} does not exist.
|
|
19
19
|
This will be ignored."""
|
|
@@ -24,7 +24,7 @@ class ResourceNotFoundWarning(ResourceNeatWarning, Generic[T_Identifier, T_Refer
|
|
|
24
24
|
referred_type: str
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
@dataclass(
|
|
27
|
+
@dataclass(unsafe_hash=True)
|
|
28
28
|
class ResourcesDuplicatedWarning(NeatWarning, Generic[T_Identifier]):
|
|
29
29
|
"""Duplicated {resource_type} with identifiers {resources} were found. {default_action}"""
|
|
30
30
|
|
|
@@ -35,7 +35,7 @@ class ResourcesDuplicatedWarning(NeatWarning, Generic[T_Identifier]):
|
|
|
35
35
|
default_action: str
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
@dataclass(
|
|
38
|
+
@dataclass(unsafe_hash=True)
|
|
39
39
|
class ResourceRetrievalWarning(NeatWarning, Generic[T_Identifier]):
|
|
40
40
|
"""Failed to retrieve {resource_type} with identifiers {resources}. Continuing without
|
|
41
41
|
these resources."""
|
|
@@ -7,7 +7,7 @@ from dataclasses import dataclass
|
|
|
7
7
|
|
|
8
8
|
from cognite.client.data_classes.data_modeling import ContainerId, ViewId
|
|
9
9
|
|
|
10
|
-
from cognite.neat.
|
|
10
|
+
from cognite.neat._constants import DMS_CONTAINER_PROPERTY_SIZE_LIMIT
|
|
11
11
|
|
|
12
12
|
from ._models import UserModelingWarning
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ __all__ = [
|
|
|
23
23
|
]
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
@dataclass(
|
|
26
|
+
@dataclass(unsafe_hash=True)
|
|
27
27
|
class DirectRelationMissingSourceWarning(UserModelingWarning):
|
|
28
28
|
"""The view {view_id}.{prop_name} is a direct relation without a source.
|
|
29
29
|
Direct relations in views should point to a single other view, if not, you end up
|
|
@@ -35,7 +35,7 @@ class DirectRelationMissingSourceWarning(UserModelingWarning):
|
|
|
35
35
|
prop_name: str
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
@dataclass(
|
|
38
|
+
@dataclass(unsafe_hash=True)
|
|
39
39
|
class ParentInDifferentSpaceWarning(UserModelingWarning):
|
|
40
40
|
"""The view {view_id} has multiple parents in different spaces.
|
|
41
41
|
Neat recommends maximum one implementation of a view from another space."""
|
|
@@ -45,7 +45,7 @@ class ParentInDifferentSpaceWarning(UserModelingWarning):
|
|
|
45
45
|
view_id: ViewId
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
@dataclass(
|
|
48
|
+
@dataclass(unsafe_hash=True)
|
|
49
49
|
class EmptyContainerWarning(UserModelingWarning):
|
|
50
50
|
"""Container {container_id} is empty and will be skipped.
|
|
51
51
|
The container does not have any properties."""
|
|
@@ -55,7 +55,7 @@ class EmptyContainerWarning(UserModelingWarning):
|
|
|
55
55
|
container_id: ContainerId
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
@dataclass(
|
|
58
|
+
@dataclass(unsafe_hash=True)
|
|
59
59
|
class HasDataFilterOnNoPropertiesViewWarning(UserModelingWarning):
|
|
60
60
|
"""Cannot set hasData filter on view {view_id}.
|
|
61
61
|
The view does not have properties in any containers.
|
|
@@ -66,7 +66,7 @@ class HasDataFilterOnNoPropertiesViewWarning(UserModelingWarning):
|
|
|
66
66
|
view_id: ViewId
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
@dataclass(
|
|
69
|
+
@dataclass(unsafe_hash=True)
|
|
70
70
|
class NodeTypeFilterOnParentViewWarning(UserModelingWarning):
|
|
71
71
|
"""Setting a node type filter on parent view {view_id}.
|
|
72
72
|
This is not recommended as parent views are typically used for multiple types of nodes."""
|
|
@@ -76,7 +76,7 @@ class NodeTypeFilterOnParentViewWarning(UserModelingWarning):
|
|
|
76
76
|
view_id: ViewId
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
@dataclass(
|
|
79
|
+
@dataclass(unsafe_hash=True)
|
|
80
80
|
class HasDataFilterOnViewWithReferencesWarning(UserModelingWarning):
|
|
81
81
|
"""Setting a hasData filter on view {view_id} which references other views {references}.
|
|
82
82
|
This is not recommended as it will lead to no nodes being returned when querying the solution view.
|
|
@@ -88,7 +88,7 @@ class HasDataFilterOnViewWithReferencesWarning(UserModelingWarning):
|
|
|
88
88
|
references: frozenset[ViewId]
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
@dataclass(
|
|
91
|
+
@dataclass(unsafe_hash=True)
|
|
92
92
|
class ViewPropertyLimitWarning(UserModelingWarning):
|
|
93
93
|
"""The number of properties in the {view_id} view is {count} which
|
|
94
94
|
is more than the API limit {limit} properties.
|
|
@@ -102,7 +102,7 @@ class ViewPropertyLimitWarning(UserModelingWarning):
|
|
|
102
102
|
limit: int = DMS_CONTAINER_PROPERTY_SIZE_LIMIT
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
@dataclass(
|
|
105
|
+
@dataclass(unsafe_hash=True)
|
|
106
106
|
class NotNeatSupportedFilterWarning(UserModelingWarning):
|
|
107
107
|
"""The view {view_id} uses a non-standard filter.
|
|
108
108
|
This will not be validated by Neat, and is thus not recommended.
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import sys
|
|
3
|
+
from functools import cached_property
|
|
4
|
+
|
|
5
|
+
if sys.version_info >= (3, 11):
|
|
6
|
+
from enum import StrEnum
|
|
7
|
+
else:
|
|
8
|
+
from backports.strenum import StrEnum
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class EntityTypes(StrEnum):
|
|
12
|
+
view_non_versioned = "view_non_versioned"
|
|
13
|
+
subject = "subject"
|
|
14
|
+
predicate = "predicate"
|
|
15
|
+
object = "object"
|
|
16
|
+
class_ = "class"
|
|
17
|
+
parent_class = "parent_class"
|
|
18
|
+
property_ = "property"
|
|
19
|
+
dms_property = "dms_property"
|
|
20
|
+
information_property = "information_property"
|
|
21
|
+
object_property = "ObjectProperty"
|
|
22
|
+
data_property = "DatatypeProperty"
|
|
23
|
+
annotation_property = "AnnotationProperty"
|
|
24
|
+
object_value_type = "object_value_type"
|
|
25
|
+
data_value_type = "data_value_type" # these are strings, floats, ...
|
|
26
|
+
xsd_value_type = "xsd_value_type"
|
|
27
|
+
dms_value_type = "dms_value_type"
|
|
28
|
+
dms_node = "dms_node"
|
|
29
|
+
view = "view"
|
|
30
|
+
reference_entity = "reference_entity"
|
|
31
|
+
container = "container"
|
|
32
|
+
datamodel = "datamodel"
|
|
33
|
+
undefined = "undefined"
|
|
34
|
+
multi_value_type = "multi_value_type"
|
|
35
|
+
asset = "asset"
|
|
36
|
+
relationship = "relationship"
|
|
37
|
+
edge = "edge"
|
|
38
|
+
reverse = "reverse"
|
|
39
|
+
unit = "unit"
|
|
40
|
+
version = "version"
|
|
41
|
+
prefix = "prefix"
|
|
42
|
+
space = "space"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_reserved_words() -> dict[str, list[str]]:
|
|
46
|
+
return {
|
|
47
|
+
"class": ["Class", "class"],
|
|
48
|
+
"view": [
|
|
49
|
+
"Query",
|
|
50
|
+
"Mutation",
|
|
51
|
+
"Subscription",
|
|
52
|
+
"String",
|
|
53
|
+
"Int32",
|
|
54
|
+
"Int64",
|
|
55
|
+
"Int",
|
|
56
|
+
"Float32",
|
|
57
|
+
"Float64",
|
|
58
|
+
"Float",
|
|
59
|
+
"Timestamp",
|
|
60
|
+
"JSONObject",
|
|
61
|
+
"Date",
|
|
62
|
+
"Numeric",
|
|
63
|
+
"Boolean",
|
|
64
|
+
"PageInfo",
|
|
65
|
+
"File",
|
|
66
|
+
"Sequence",
|
|
67
|
+
"TimeSeries",
|
|
68
|
+
],
|
|
69
|
+
"property": [
|
|
70
|
+
"property",
|
|
71
|
+
"space",
|
|
72
|
+
"externalId",
|
|
73
|
+
"createdTime",
|
|
74
|
+
"lastUpdatedTime",
|
|
75
|
+
"deletedTime",
|
|
76
|
+
"edge_id",
|
|
77
|
+
"node_id",
|
|
78
|
+
"project_id",
|
|
79
|
+
"property_group",
|
|
80
|
+
"seq",
|
|
81
|
+
"tg_table_name",
|
|
82
|
+
"extensions",
|
|
83
|
+
],
|
|
84
|
+
"space": ["space", "cdf", "dms", "pg3", "shared", "system", "node", "edge"],
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
ENTITY_PATTERN = re.compile(r"^(?P<prefix>.*?):?(?P<suffix>[^(:]*)(\((?P<content>.+)\))?$")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# REGEX FOR VALIDATIONS
|
|
92
|
+
MORE_THAN_ONE_NONE_ALPHANUMERIC_REGEX = r"([_-]{2,})"
|
|
93
|
+
PREFIX_COMPLIANCE_REGEX = r"^([a-zA-Z]+)([a-zA-Z0-9]*[_-]{0,1}[a-zA-Z0-9_-]*)([a-zA-Z0-9]*)$"
|
|
94
|
+
|
|
95
|
+
SPACE_COMPLIANCE_REGEX = (
|
|
96
|
+
rf"(?!^({'|'.join(get_reserved_words()['space'])})$)" r"(^[a-zA-Z][a-zA-Z0-9_-]{0,41}[a-zA-Z0-9]?$)"
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
DATA_MODEL_COMPLIANCE_REGEX = r"^[a-zA-Z]([a-zA-Z0-9_]{0,253}[a-zA-Z0-9])?$"
|
|
101
|
+
|
|
102
|
+
VIEW_ID_COMPLIANCE_REGEX = (
|
|
103
|
+
rf"(?!^({'|'.join(get_reserved_words()['view'])})$)" r"(^[a-zA-Z][a-zA-Z0-9_]{0,253}[a-zA-Z0-9]?$)"
|
|
104
|
+
)
|
|
105
|
+
DMS_PROPERTY_ID_COMPLIANCE_REGEX = (
|
|
106
|
+
rf"(?!^({'|'.join(get_reserved_words()['property'])})$)" r"(^[a-zA-Z][a-zA-Z0-9_]{0,253}[a-zA-Z0-9]?$)"
|
|
107
|
+
)
|
|
108
|
+
CLASS_ID_COMPLIANCE_REGEX = (
|
|
109
|
+
rf"(?!^({'|'.join(get_reserved_words()['class'])})$)" r"(^[a-zA-Z][a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$)"
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
INFORMATION_PROPERTY_ID_COMPLIANCE_REGEX = (
|
|
113
|
+
r"^(\*)|(?!^(Property|property)$)(^[a-zA-Z][a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$)"
|
|
114
|
+
)
|
|
115
|
+
VERSION_COMPLIANCE_REGEX = r"^[a-zA-Z0-9]([.a-zA-Z0-9_-]{0,41}[a-zA-Z0-9])?$"
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# This pattern ignores commas inside brackets
|
|
119
|
+
SPLIT_ON_COMMA_PATTERN = re.compile(r",(?![^(]*\))")
|
|
120
|
+
# This pattern ignores equal signs inside brackets
|
|
121
|
+
SPLIT_ON_EQUAL_PATTERN = re.compile(r"=(?![^(]*\))")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class _Patterns:
|
|
125
|
+
@cached_property
|
|
126
|
+
def more_than_one_alphanumeric(self) -> re.Pattern:
|
|
127
|
+
return re.compile(MORE_THAN_ONE_NONE_ALPHANUMERIC_REGEX)
|
|
128
|
+
|
|
129
|
+
@cached_property
|
|
130
|
+
def prefix_compliance(self) -> re.Pattern[str]:
|
|
131
|
+
return re.compile(PREFIX_COMPLIANCE_REGEX)
|
|
132
|
+
|
|
133
|
+
@cached_property
|
|
134
|
+
def space_compliance(self) -> re.Pattern[str]:
|
|
135
|
+
return re.compile(SPACE_COMPLIANCE_REGEX)
|
|
136
|
+
|
|
137
|
+
@cached_property
|
|
138
|
+
def view_id_compliance(self) -> re.Pattern[str]:
|
|
139
|
+
return re.compile(VIEW_ID_COMPLIANCE_REGEX)
|
|
140
|
+
|
|
141
|
+
@cached_property
|
|
142
|
+
def dms_property_id_compliance(self) -> re.Pattern[str]:
|
|
143
|
+
return re.compile(DMS_PROPERTY_ID_COMPLIANCE_REGEX)
|
|
144
|
+
|
|
145
|
+
@cached_property
|
|
146
|
+
def class_id_compliance(self) -> re.Pattern[str]:
|
|
147
|
+
return re.compile(CLASS_ID_COMPLIANCE_REGEX)
|
|
148
|
+
|
|
149
|
+
@cached_property
|
|
150
|
+
def information_property_id_compliance(self) -> re.Pattern[str]:
|
|
151
|
+
return re.compile(INFORMATION_PROPERTY_ID_COMPLIANCE_REGEX)
|
|
152
|
+
|
|
153
|
+
@cached_property
|
|
154
|
+
def version_compliance(self) -> re.Pattern[str]:
|
|
155
|
+
return re.compile(VERSION_COMPLIANCE_REGEX)
|
|
156
|
+
|
|
157
|
+
def entity_pattern(
|
|
158
|
+
self,
|
|
159
|
+
entity: EntityTypes,
|
|
160
|
+
) -> re.Pattern:
|
|
161
|
+
if entity == EntityTypes.class_:
|
|
162
|
+
return self.class_id_compliance
|
|
163
|
+
|
|
164
|
+
elif entity == EntityTypes.information_property:
|
|
165
|
+
return self.information_property_id_compliance
|
|
166
|
+
|
|
167
|
+
elif entity == EntityTypes.view:
|
|
168
|
+
return self.view_id_compliance
|
|
169
|
+
|
|
170
|
+
# container regex same as view regex
|
|
171
|
+
elif entity == EntityTypes.container:
|
|
172
|
+
return self.view_id_compliance
|
|
173
|
+
|
|
174
|
+
elif entity == EntityTypes.dms_property:
|
|
175
|
+
return self.dms_property_id_compliance
|
|
176
|
+
|
|
177
|
+
elif entity == EntityTypes.version:
|
|
178
|
+
return self.version_compliance
|
|
179
|
+
|
|
180
|
+
elif entity == EntityTypes.prefix:
|
|
181
|
+
return self.prefix_compliance
|
|
182
|
+
|
|
183
|
+
elif entity == EntityTypes.space:
|
|
184
|
+
return self.space_compliance
|
|
185
|
+
|
|
186
|
+
else:
|
|
187
|
+
raise ValueError(f"Unsupported entity type {entity}")
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
PATTERNS = _Patterns()
|
|
@@ -2,16 +2,16 @@ from abc import ABC, abstractmethod
|
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
from typing import Any, Generic, TypeAlias, TypeVar
|
|
4
4
|
|
|
5
|
-
from cognite.neat.
|
|
6
|
-
from cognite.neat.
|
|
5
|
+
from cognite.neat._issues import IssueList
|
|
6
|
+
from cognite.neat._rules.models import (
|
|
7
7
|
AssetRules,
|
|
8
8
|
DMSRules,
|
|
9
9
|
DomainRules,
|
|
10
10
|
InformationRules,
|
|
11
11
|
)
|
|
12
|
-
from cognite.neat.
|
|
13
|
-
from cognite.neat.
|
|
14
|
-
from cognite.neat.
|
|
12
|
+
from cognite.neat._rules.models.asset._rules_input import AssetInputRules
|
|
13
|
+
from cognite.neat._rules.models.dms._rules_input import DMSInputRules
|
|
14
|
+
from cognite.neat._rules.models.information._rules_input import InformationInputRules
|
|
15
15
|
|
|
16
16
|
VerifiedRules: TypeAlias = DomainRules | InformationRules | DMSRules | AssetRules
|
|
17
17
|
InputRules: TypeAlias = AssetInputRules | DMSInputRules | InformationInputRules
|
|
@@ -2,14 +2,14 @@ import warnings
|
|
|
2
2
|
from graphlib import TopologicalSorter
|
|
3
3
|
from typing import cast
|
|
4
4
|
|
|
5
|
-
from cognite.neat.
|
|
6
|
-
from cognite.neat.
|
|
7
|
-
from cognite.neat.
|
|
8
|
-
from cognite.neat.
|
|
5
|
+
from cognite.neat._rules._constants import EntityTypes
|
|
6
|
+
from cognite.neat._rules.models import AssetRules
|
|
7
|
+
from cognite.neat._rules.models._rdfpath import RDFPath
|
|
8
|
+
from cognite.neat._rules.models.asset import AssetClass, AssetProperty
|
|
9
|
+
from cognite.neat._rules.models.entities import (
|
|
9
10
|
AssetEntity,
|
|
10
11
|
AssetFields,
|
|
11
12
|
ClassEntity,
|
|
12
|
-
EntityTypes,
|
|
13
13
|
ReferenceEntity,
|
|
14
14
|
RelationshipEntity,
|
|
15
15
|
)
|
|
@@ -9,15 +9,15 @@ from typing import Generic, TypeVar
|
|
|
9
9
|
import pandas as pd
|
|
10
10
|
from pydantic import BaseModel
|
|
11
11
|
|
|
12
|
-
from cognite.neat.
|
|
13
|
-
from cognite.neat.
|
|
14
|
-
from cognite.neat.
|
|
12
|
+
from cognite.neat._rules.models._base_rules import BaseRules
|
|
13
|
+
from cognite.neat._rules.models._rdfpath import RDFPath
|
|
14
|
+
from cognite.neat._rules.models.entities import (
|
|
15
15
|
ClassEntity,
|
|
16
16
|
Entity,
|
|
17
17
|
ReferenceEntity,
|
|
18
18
|
)
|
|
19
|
-
from cognite.neat.
|
|
20
|
-
from cognite.neat.
|
|
19
|
+
from cognite.neat._rules.models.information import InformationProperty
|
|
20
|
+
from cognite.neat._utils.rdf_ import get_inheritance_path
|
|
21
21
|
|
|
22
22
|
T_Rules = TypeVar("T_Rules", bound=BaseRules)
|
|
23
23
|
T_Property = TypeVar("T_Property", bound=BaseModel)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from cognite.neat._constants import DMS_LISTABLE_PROPERTY_LIMIT
|
|
2
|
+
from cognite.neat._rules.models.dms import DMSProperty, DMSRules, DMSView
|
|
3
|
+
from cognite.neat._rules.models.entities import ReferenceEntity, ViewEntity
|
|
4
|
+
|
|
5
|
+
from ._base import BaseAnalysis
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DMSAnalysis(BaseAnalysis[DMSRules, DMSView, DMSProperty, ViewEntity, str]):
|
|
9
|
+
"""Assumes analysis over only the complete schema"""
|
|
10
|
+
|
|
11
|
+
def _get_classes(self) -> list[DMSView]:
|
|
12
|
+
return list(self.rules.views)
|
|
13
|
+
|
|
14
|
+
def _get_properties(self) -> list[DMSProperty]:
|
|
15
|
+
return list(self.rules.properties)
|
|
16
|
+
|
|
17
|
+
def _get_reference(self, class_or_property: DMSView | DMSProperty) -> ReferenceEntity | None:
|
|
18
|
+
return class_or_property.reference if isinstance(class_or_property.reference, ReferenceEntity) else None
|
|
19
|
+
|
|
20
|
+
def _get_cls_entity(self, class_: DMSView | DMSProperty) -> ViewEntity:
|
|
21
|
+
return class_.view
|
|
22
|
+
|
|
23
|
+
def _get_prop_entity(self, property_: DMSProperty) -> str:
|
|
24
|
+
return property_.property_
|
|
25
|
+
|
|
26
|
+
def _get_cls_parents(self, class_: DMSView) -> list[ViewEntity] | None:
|
|
27
|
+
return list(class_.implements) if class_.implements else None
|
|
28
|
+
|
|
29
|
+
def _get_reference_rules(self) -> DMSRules | None:
|
|
30
|
+
return self.rules.reference
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def _set_cls_entity(cls, property_: DMSProperty, class_: ViewEntity) -> None:
|
|
34
|
+
property_.view = class_
|
|
35
|
+
|
|
36
|
+
def _get_object(self, property_: DMSProperty) -> ViewEntity | None:
|
|
37
|
+
return property_.value_type if isinstance(property_.value_type, ViewEntity) else None
|
|
38
|
+
|
|
39
|
+
def _get_max_occurrence(self, property_: DMSProperty) -> int | float | None:
|
|
40
|
+
return DMS_LISTABLE_PROPERTY_LIMIT if property_.is_list else 1
|
|
41
|
+
|
|
42
|
+
def subset_rules(self, desired_classes: set[ViewEntity]) -> DMSRules:
|
|
43
|
+
raise NotImplementedError()
|
|
@@ -4,21 +4,23 @@ from typing import Any, cast
|
|
|
4
4
|
from pydantic import ValidationError
|
|
5
5
|
from rdflib import URIRef
|
|
6
6
|
|
|
7
|
-
from cognite.neat.
|
|
8
|
-
from cognite.neat.
|
|
7
|
+
from cognite.neat._rules._constants import EntityTypes
|
|
8
|
+
from cognite.neat._rules.models import SchemaCompleteness
|
|
9
|
+
from cognite.neat._rules.models._rdfpath import (
|
|
9
10
|
Hop,
|
|
10
11
|
RDFPath,
|
|
11
12
|
SelfReferenceProperty,
|
|
12
13
|
SingleProperty,
|
|
13
14
|
)
|
|
14
|
-
from cognite.neat.
|
|
15
|
-
from cognite.neat.
|
|
15
|
+
from cognite.neat._rules.models.entities import ClassEntity, ReferenceEntity
|
|
16
|
+
from cognite.neat._rules.models.entities._multi_value import MultiValueTypeInfo
|
|
17
|
+
from cognite.neat._rules.models.information import (
|
|
16
18
|
InformationClass,
|
|
17
19
|
InformationProperty,
|
|
18
20
|
InformationRules,
|
|
19
21
|
)
|
|
20
|
-
from cognite.neat.
|
|
21
|
-
from cognite.neat.
|
|
22
|
+
from cognite.neat._utils.collection_ import most_occurring_element
|
|
23
|
+
from cognite.neat._utils.rdf_ import get_inheritance_path
|
|
22
24
|
|
|
23
25
|
from ._base import BaseAnalysis
|
|
24
26
|
|
|
@@ -226,3 +228,7 @@ class InformationAnalysis(BaseAnalysis[InformationRules, InformationClass, Infor
|
|
|
226
228
|
# case 3 when class prefix is not found in prefixes of rules
|
|
227
229
|
else:
|
|
228
230
|
return None
|
|
231
|
+
|
|
232
|
+
@property
|
|
233
|
+
def multi_value_properties(self) -> list[InformationProperty]:
|
|
234
|
+
return [prop_ for prop_ in self.rules.properties if isinstance(prop_.value_type, MultiValueTypeInfo)]
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from ._base import BaseExporter, CDFExporter
|
|
2
2
|
from ._rules2dms import DMSExporter
|
|
3
3
|
from ._rules2excel import ExcelExporter
|
|
4
|
+
from ._rules2instance_template import InstanceTemplateExporter
|
|
4
5
|
from ._rules2ontology import GraphExporter, OWLExporter, SemanticDataModelExporter, SHACLExporter
|
|
5
6
|
from ._rules2yaml import YAMLExporter
|
|
6
7
|
|
|
@@ -14,6 +15,7 @@ __all__ = [
|
|
|
14
15
|
"SHACLExporter",
|
|
15
16
|
"ExcelExporter",
|
|
16
17
|
"YAMLExporter",
|
|
18
|
+
"InstanceTemplateExporter",
|
|
17
19
|
]
|
|
18
20
|
|
|
19
21
|
|
|
@@ -5,9 +5,9 @@ from typing import Generic, TypeVar
|
|
|
5
5
|
|
|
6
6
|
from cognite.client import CogniteClient
|
|
7
7
|
|
|
8
|
-
from cognite.neat.
|
|
9
|
-
from cognite.neat.
|
|
10
|
-
from cognite.neat.
|
|
8
|
+
from cognite.neat._rules._shared import T_VerifiedRules
|
|
9
|
+
from cognite.neat._utils.auxiliary import class_html_doc
|
|
10
|
+
from cognite.neat._utils.upload import UploadResult, UploadResultList
|
|
11
11
|
|
|
12
12
|
T_Export = TypeVar("T_Export")
|
|
13
13
|
|
|
@@ -15,13 +15,13 @@ from cognite.client.data_classes.data_modeling import (
|
|
|
15
15
|
)
|
|
16
16
|
from cognite.client.exceptions import CogniteAPIError
|
|
17
17
|
|
|
18
|
-
from cognite.neat.
|
|
19
|
-
from cognite.neat.
|
|
18
|
+
from cognite.neat._issues import IssueList
|
|
19
|
+
from cognite.neat._issues.warnings import (
|
|
20
20
|
PrincipleOneModelOneSpaceWarning,
|
|
21
21
|
ResourceRetrievalWarning,
|
|
22
22
|
)
|
|
23
|
-
from cognite.neat.
|
|
24
|
-
from cognite.neat.
|
|
23
|
+
from cognite.neat._rules.models.dms import DMSRules, DMSSchema, PipelineSchema
|
|
24
|
+
from cognite.neat._utils.cdf.loaders import (
|
|
25
25
|
ContainerLoader,
|
|
26
26
|
DataModelingLoader,
|
|
27
27
|
DataModelLoader,
|
|
@@ -32,7 +32,7 @@ from cognite.neat.utils.cdf.loaders import (
|
|
|
32
32
|
TransformationLoader,
|
|
33
33
|
ViewLoader,
|
|
34
34
|
)
|
|
35
|
-
from cognite.neat.
|
|
35
|
+
from cognite.neat._utils.upload import UploadResult
|
|
36
36
|
|
|
37
37
|
from ._base import CDFExporter
|
|
38
38
|
|
|
@@ -13,20 +13,22 @@ from openpyxl.styles import Alignment, Border, Font, PatternFill, Side
|
|
|
13
13
|
from openpyxl.worksheet.worksheet import Worksheet
|
|
14
14
|
from rdflib import Namespace
|
|
15
15
|
|
|
16
|
-
from cognite.neat.
|
|
17
|
-
from cognite.neat.
|
|
16
|
+
from cognite.neat._rules._shared import VerifiedRules
|
|
17
|
+
from cognite.neat._rules.models import (
|
|
18
18
|
DataModelType,
|
|
19
19
|
ExtensionCategory,
|
|
20
20
|
SchemaCompleteness,
|
|
21
21
|
SheetRow,
|
|
22
22
|
)
|
|
23
|
-
from cognite.neat.
|
|
24
|
-
from cognite.neat.
|
|
25
|
-
from cognite.neat.
|
|
26
|
-
from cognite.neat.
|
|
23
|
+
from cognite.neat._rules.models.dms import DMSMetadata
|
|
24
|
+
from cognite.neat._rules.models.domain import DomainMetadata
|
|
25
|
+
from cognite.neat._rules.models.information import InformationMetadata
|
|
26
|
+
from cognite.neat._rules.models.information._rules import InformationRules
|
|
27
27
|
|
|
28
28
|
from ._base import BaseExporter
|
|
29
29
|
|
|
30
|
+
MAX_COLUMN_WIDTH = 70.0
|
|
31
|
+
|
|
30
32
|
|
|
31
33
|
class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
|
|
32
34
|
"""Export rules to Excel.
|
|
@@ -251,7 +253,9 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
|
|
|
251
253
|
selected_column = column_cells[1]
|
|
252
254
|
|
|
253
255
|
current = sheet.column_dimensions[selected_column.column_letter].width or (max_length + 0.5)
|
|
254
|
-
sheet.column_dimensions[selected_column.column_letter].width =
|
|
256
|
+
sheet.column_dimensions[selected_column.column_letter].width = min(
|
|
257
|
+
max(current, max_length + 0.5), MAX_COLUMN_WIDTH
|
|
258
|
+
)
|
|
255
259
|
return None
|
|
256
260
|
|
|
257
261
|
|
|
@@ -289,7 +293,7 @@ class _MetadataCreator:
|
|
|
289
293
|
|
|
290
294
|
new_metadata = self._create_new_info(now)
|
|
291
295
|
if isinstance(metadata, DMSMetadata):
|
|
292
|
-
from cognite.neat.
|
|
296
|
+
from cognite.neat._rules.transformers._converters import _InformationRulesConverter
|
|
293
297
|
|
|
294
298
|
output_metadata: DMSMetadata | InformationMetadata = _InformationRulesConverter._convert_metadata_to_dms(
|
|
295
299
|
new_metadata
|