cognite-neat 0.88.3__tar.gz → 0.89.0__tar.gz
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-0.88.3 → cognite_neat-0.89.0}/PKG-INFO +1 -1
- cognite_neat-0.89.0/cognite/neat/_version.py +1 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/constants.py +3 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_mock_graph_generator.py +2 -1
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/_base.py +2 -1
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/__init__.py +2 -1
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_general.py +7 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_models.py +1 -1
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/user_modeling.py +1 -1
- cognite_neat-0.89.0/cognite/neat/rules/_shared.py +61 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/analysis/_base.py +1 -1
- cognite_neat-0.89.0/cognite/neat/rules/exporters/_base.py +40 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_rules2dms.py +8 -18
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_rules2excel.py +5 -12
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_rules2ontology.py +9 -19
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_rules2yaml.py +3 -6
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_base.py +7 -52
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dms2rules.py +171 -115
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +26 -18
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +14 -30
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2classes.py +7 -3
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2metadata.py +3 -3
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2properties.py +18 -11
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2rules.py +9 -18
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_inference2rules.py +10 -33
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +9 -20
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_shared.py +1 -1
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_spreadsheet2rules.py +22 -86
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_yaml2rules.py +14 -41
- cognite_neat-0.89.0/cognite/neat/rules/models/__init__.py +46 -0
- cognite_neat-0.89.0/cognite/neat/rules/models/_base_input.py +162 -0
- cognite_neat-0.88.3/cognite/neat/rules/models/_base.py → cognite_neat-0.89.0/cognite/neat/rules/models/_base_rules.py +1 -12
- cognite_neat-0.89.0/cognite/neat/rules/models/asset/__init__.py +13 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/asset/_rules.py +2 -20
- cognite_neat-0.89.0/cognite/neat/rules/models/asset/_rules_input.py +96 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/asset/_validation.py +1 -1
- cognite_neat-0.89.0/cognite/neat/rules/models/data_types.py +388 -0
- cognite_neat-0.89.0/cognite/neat/rules/models/dms/__init__.py +30 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_exporter.py +72 -26
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_rules.py +42 -155
- cognite_neat-0.89.0/cognite/neat/rules/models/dms/_rules_input.py +293 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_serializer.py +44 -3
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_validation.py +3 -4
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/domain.py +52 -1
- cognite_neat-0.89.0/cognite/neat/rules/models/entities/__init__.py +63 -0
- cognite_neat-0.89.0/cognite/neat/rules/models/entities/_constants.py +73 -0
- cognite_neat-0.89.0/cognite/neat/rules/models/entities/_loaders.py +76 -0
- cognite_neat-0.89.0/cognite/neat/rules/models/entities/_multi_value.py +67 -0
- cognite_neat-0.88.3/cognite/neat/rules/models/entities.py → cognite_neat-0.89.0/cognite/neat/rules/models/entities/_single_value.py +74 -232
- cognite_neat-0.89.0/cognite/neat/rules/models/entities/_types.py +86 -0
- cognite_neat-0.88.3/cognite/neat/rules/models/wrapped_entities.py → cognite_neat-0.89.0/cognite/neat/rules/models/entities/_wrapped.py +1 -1
- cognite_neat-0.89.0/cognite/neat/rules/models/information/__init__.py +18 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/information/_rules.py +3 -14
- cognite_neat-0.89.0/cognite/neat/rules/models/information/_rules_input.py +146 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/information/_validation.py +1 -1
- cognite_neat-0.89.0/cognite/neat/rules/transformers/__init__.py +21 -0
- cognite_neat-0.89.0/cognite/neat/rules/transformers/_base.py +81 -0
- cognite_neat-0.88.3/cognite/neat/rules/models/information/_converter.py → cognite_neat-0.89.0/cognite/neat/rules/transformers/_converters.py +216 -20
- cognite_neat-0.89.0/cognite/neat/rules/transformers/_map_onto.py +97 -0
- cognite_neat-0.89.0/cognite/neat/rules/transformers/_pipelines.py +61 -0
- cognite_neat-0.89.0/cognite/neat/rules/transformers/_verification.py +136 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/store/_provenance.py +10 -1
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/data_classes.py +20 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/regex_patterns.py +6 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +106 -37
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/rules_importer.py +24 -22
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/pyproject.toml +1 -1
- cognite_neat-0.88.3/cognite/neat/_version.py +0 -1
- cognite_neat-0.88.3/cognite/neat/rules/_shared.py +0 -18
- cognite_neat-0.88.3/cognite/neat/rules/exporters/_base.py +0 -51
- cognite_neat-0.88.3/cognite/neat/rules/models/__init__.py +0 -30
- cognite_neat-0.88.3/cognite/neat/rules/models/_constants.py +0 -2
- cognite_neat-0.88.3/cognite/neat/rules/models/_types/__init__.py +0 -19
- cognite_neat-0.88.3/cognite/neat/rules/models/asset/__init__.py +0 -10
- cognite_neat-0.88.3/cognite/neat/rules/models/asset/_converter.py +0 -4
- cognite_neat-0.88.3/cognite/neat/rules/models/asset/_rules_input.py +0 -171
- cognite_neat-0.88.3/cognite/neat/rules/models/data_types.py +0 -282
- cognite_neat-0.88.3/cognite/neat/rules/models/dms/__init__.py +0 -18
- cognite_neat-0.88.3/cognite/neat/rules/models/dms/_converter.py +0 -143
- cognite_neat-0.88.3/cognite/neat/rules/models/dms/_rules_input.py +0 -361
- cognite_neat-0.88.3/cognite/neat/rules/models/information/__init__.py +0 -10
- cognite_neat-0.88.3/cognite/neat/rules/models/information/_rules_input.py +0 -293
- cognite_neat-0.88.3/cognite/neat/rules/transformers/_base.py +0 -15
- cognite_neat-0.88.3/cognite/neat/workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/LICENSE +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/README.md +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/configuration.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/explorer.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/routers/configuration.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/routers/crud.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/routers/metrics.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/routers/workflows.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/utils/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/utils/logging.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/main.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/monitoring/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/monitoring/metrics.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/index.html +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/config.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/_shared.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/_tracking/base.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/_tracking/log.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/examples/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_base.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_base.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/loaders/_base.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/loaders/_rdf2asset.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/loaders/_rdf2dms.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/models.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/queries/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/queries/_base.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/queries/_construct.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/queries/_shared.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/transformers/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/transformers/_base.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_external.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_properties.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_resources.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_workflow.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/formatters.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_external.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_general.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_properties.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_resources.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/py.typed +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/analysis/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/analysis/_asset.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/analysis/_information.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/examples/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/_rdfpath.py +0 -0
- /cognite_neat-0.88.3/cognite/neat/rules/models/_types/_field.py → /cognite_neat-0.89.0/cognite/neat/rules/models/_types.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/asset/_serializer.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_schema.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/information/_serializer.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/store/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/store/_base.py +0 -0
- {cognite_neat-0.88.3/cognite/neat/rules/transformers → cognite_neat-0.89.0/cognite/neat/utils}/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/auth.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/auxiliary.py +0 -0
- {cognite_neat-0.88.3/cognite/neat/utils → cognite_neat-0.89.0/cognite/neat/utils/cdf}/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/loaders/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/loaders/_base.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/loaders/_data_modeling.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/loaders/_ingestion.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/collection_.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/rdf_.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/spreadsheet.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/text.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/time_.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/upload.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/xml_.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/base.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/cdf_store.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/manager.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/model.py +0 -0
- {cognite_neat-0.88.3/cognite/neat/utils/cdf → cognite_neat-0.89.0/cognite/neat/workflows/steps}/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.88.3/cognite/neat/workflows/steps → cognite_neat-0.89.0/cognite/neat/workflows/steps/lib}/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/step_model.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps_registry.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/tasks.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/triggers.py +0 -0
- {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.89.0"
|
{cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_mock_graph_generator.py
RENAMED
|
@@ -17,6 +17,7 @@ from cognite.neat.rules.models import DMSRules, InformationRules
|
|
|
17
17
|
from cognite.neat.rules.models.data_types import DataType
|
|
18
18
|
from cognite.neat.rules.models.entities import ClassEntity, EntityTypes
|
|
19
19
|
from cognite.neat.rules.models.information import InformationProperty
|
|
20
|
+
from cognite.neat.rules.transformers import DMSToInformation
|
|
20
21
|
from cognite.neat.utils.rdf_ import remove_namespace_from_uri
|
|
21
22
|
|
|
22
23
|
from ._base import BaseExtractor
|
|
@@ -42,7 +43,7 @@ class MockGraphGenerator(BaseExtractor):
|
|
|
42
43
|
allow_isolated_classes: bool = True,
|
|
43
44
|
):
|
|
44
45
|
if isinstance(rules, DMSRules):
|
|
45
|
-
self.rules =
|
|
46
|
+
self.rules = DMSToInformation().transform(rules).rules
|
|
46
47
|
elif isinstance(rules, InformationRules):
|
|
47
48
|
self.rules = rules
|
|
48
49
|
else:
|
|
@@ -50,6 +50,7 @@ ResourceType: TypeAlias = (
|
|
|
50
50
|
"data model",
|
|
51
51
|
"edge",
|
|
52
52
|
"node",
|
|
53
|
+
"enum collection",
|
|
53
54
|
"unknown",
|
|
54
55
|
]
|
|
55
56
|
# String to handle all unknown types in different importers.
|
|
@@ -339,7 +340,7 @@ class DefaultWarning(NeatWarning):
|
|
|
339
340
|
T_NeatIssue = TypeVar("T_NeatIssue", bound=NeatIssue)
|
|
340
341
|
|
|
341
342
|
|
|
342
|
-
class NeatIssueList(UserList[T_NeatIssue], ABC):
|
|
343
|
+
class NeatIssueList(UserList[T_NeatIssue], Sequence[T_NeatIssue], ABC):
|
|
343
344
|
"""This is a generic list of NeatIssues."""
|
|
344
345
|
|
|
345
346
|
def __init__(self, issues: Sequence[T_NeatIssue] | None = None, title: str | None = None):
|
|
@@ -9,7 +9,7 @@ from ._external import (
|
|
|
9
9
|
FileTypeUnexpectedError,
|
|
10
10
|
NeatYamlError,
|
|
11
11
|
)
|
|
12
|
-
from ._general import NeatImportError, NeatValueError, RegexViolationError
|
|
12
|
+
from ._general import NeatImportError, NeatTypeError, NeatValueError, RegexViolationError
|
|
13
13
|
from ._properties import (
|
|
14
14
|
PropertyDefinitionDuplicatedError,
|
|
15
15
|
PropertyDefinitionError,
|
|
@@ -67,6 +67,7 @@ __all__ = [
|
|
|
67
67
|
"DefaultPydanticError",
|
|
68
68
|
"PropertyMappingDuplicatedError",
|
|
69
69
|
"RowError",
|
|
70
|
+
"NeatTypeError",
|
|
70
71
|
]
|
|
71
72
|
|
|
72
73
|
_NEAT_ERRORS_BY_NAME = {error.__name__: error for error in _get_subclasses(NeatError, include_base=True)}
|
|
@@ -10,6 +10,13 @@ class NeatValueError(NeatError, ValueError):
|
|
|
10
10
|
raw_message: str
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
@dataclass(frozen=True)
|
|
14
|
+
class NeatTypeError(NeatError, TypeError):
|
|
15
|
+
"""{raw_message}"""
|
|
16
|
+
|
|
17
|
+
raw_message: str
|
|
18
|
+
|
|
19
|
+
|
|
13
20
|
@dataclass(frozen=True)
|
|
14
21
|
class RegexViolationError(NeatError, ValueError):
|
|
15
22
|
"""Value, {value} failed regex, {regex}, validation. Make sure that the name follows the regex pattern."""
|
|
@@ -4,8 +4,8 @@ from typing import ClassVar
|
|
|
4
4
|
|
|
5
5
|
from cognite.client.data_classes.data_modeling import ViewId
|
|
6
6
|
|
|
7
|
+
from cognite.neat.constants import DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
7
8
|
from cognite.neat.issues import NeatWarning
|
|
8
|
-
from cognite.neat.rules.models._constants import DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
9
9
|
|
|
10
10
|
_BASE_URL = "https://cognite-neat.readthedocs-hosted.com/en/latest/data-modeling-principles.html"
|
|
11
11
|
|
|
@@ -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
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any, Generic, TypeAlias, TypeVar
|
|
4
|
+
|
|
5
|
+
from cognite.neat.issues import IssueList
|
|
6
|
+
from cognite.neat.rules.models import (
|
|
7
|
+
AssetRules,
|
|
8
|
+
DMSRules,
|
|
9
|
+
DomainRules,
|
|
10
|
+
InformationRules,
|
|
11
|
+
)
|
|
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
|
+
|
|
16
|
+
VerifiedRules: TypeAlias = DomainRules | InformationRules | DMSRules | AssetRules
|
|
17
|
+
InputRules: TypeAlias = AssetInputRules | DMSInputRules | InformationInputRules
|
|
18
|
+
Rules: TypeAlias = (
|
|
19
|
+
AssetInputRules | DMSInputRules | InformationInputRules | DomainRules | InformationRules | DMSRules | AssetRules
|
|
20
|
+
)
|
|
21
|
+
T_Rules = TypeVar("T_Rules", bound=Rules)
|
|
22
|
+
T_VerifiedRules = TypeVar("T_VerifiedRules", bound=VerifiedRules)
|
|
23
|
+
T_InputRules = TypeVar("T_InputRules", bound=InputRules)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass
|
|
27
|
+
class OutRules(Generic[T_Rules], ABC):
|
|
28
|
+
"""This is a base class for all rule states."""
|
|
29
|
+
|
|
30
|
+
@abstractmethod
|
|
31
|
+
def get_rules(self) -> T_Rules | None:
|
|
32
|
+
"""Get the rules from the state."""
|
|
33
|
+
raise NotImplementedError()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class JustRules(OutRules[T_Rules]):
|
|
38
|
+
"""This represents a rule that exists"""
|
|
39
|
+
|
|
40
|
+
rules: T_Rules
|
|
41
|
+
|
|
42
|
+
def get_rules(self) -> T_Rules:
|
|
43
|
+
return self.rules
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass
|
|
47
|
+
class MaybeRules(OutRules[T_Rules]):
|
|
48
|
+
"""This represents a rule that may or may not exist"""
|
|
49
|
+
|
|
50
|
+
rules: T_Rules | None
|
|
51
|
+
issues: IssueList
|
|
52
|
+
|
|
53
|
+
def get_rules(self) -> T_Rules | None:
|
|
54
|
+
return self.rules
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass
|
|
58
|
+
class ReadRules(MaybeRules[T_Rules]):
|
|
59
|
+
"""This represents a rule that does not exist"""
|
|
60
|
+
|
|
61
|
+
read_context: dict[str, Any]
|
|
@@ -9,7 +9,7 @@ from typing import Generic, TypeVar
|
|
|
9
9
|
import pandas as pd
|
|
10
10
|
from pydantic import BaseModel
|
|
11
11
|
|
|
12
|
-
from cognite.neat.rules.models.
|
|
12
|
+
from cognite.neat.rules.models._base_rules import BaseRules
|
|
13
13
|
from cognite.neat.rules.models._rdfpath import RDFPath
|
|
14
14
|
from cognite.neat.rules.models.entities import (
|
|
15
15
|
ClassEntity,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from collections.abc import Iterable
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Generic, TypeVar
|
|
5
|
+
|
|
6
|
+
from cognite.client import CogniteClient
|
|
7
|
+
|
|
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
|
+
|
|
12
|
+
T_Export = TypeVar("T_Export")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BaseExporter(ABC, Generic[T_VerifiedRules, T_Export]):
|
|
16
|
+
_new_line = "\n"
|
|
17
|
+
_encoding = "utf-8"
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def export_to_file(self, rules: T_VerifiedRules, filepath: Path) -> None:
|
|
21
|
+
raise NotImplementedError
|
|
22
|
+
|
|
23
|
+
@abstractmethod
|
|
24
|
+
def export(self, rules: T_VerifiedRules) -> T_Export:
|
|
25
|
+
raise NotImplementedError
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
def _repr_html_(cls) -> str:
|
|
29
|
+
return class_html_doc(cls, include_factory_methods=False)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class CDFExporter(BaseExporter[T_VerifiedRules, T_Export]):
|
|
33
|
+
@abstractmethod
|
|
34
|
+
def export_to_cdf_iterable(
|
|
35
|
+
self, rules: T_VerifiedRules, client: CogniteClient, dry_run: bool = False
|
|
36
|
+
) -> Iterable[UploadResult]:
|
|
37
|
+
raise NotImplementedError
|
|
38
|
+
|
|
39
|
+
def export_to_cdf(self, rules: T_VerifiedRules, client: CogniteClient, dry_run: bool = False) -> UploadResultList:
|
|
40
|
+
return UploadResultList(self.export_to_cdf_iterable(rules, client, dry_run))
|
|
@@ -20,8 +20,6 @@ from cognite.neat.issues.warnings import (
|
|
|
20
20
|
PrincipleOneModelOneSpaceWarning,
|
|
21
21
|
ResourceRetrievalWarning,
|
|
22
22
|
)
|
|
23
|
-
from cognite.neat.rules._shared import VerifiedRules
|
|
24
|
-
from cognite.neat.rules.models import InformationRules
|
|
25
23
|
from cognite.neat.rules.models.dms import DMSRules, DMSSchema, PipelineSchema
|
|
26
24
|
from cognite.neat.utils.cdf.loaders import (
|
|
27
25
|
ContainerLoader,
|
|
@@ -41,7 +39,7 @@ from ._base import CDFExporter
|
|
|
41
39
|
Component: TypeAlias = Literal["all", "spaces", "data_models", "views", "containers", "node_types"]
|
|
42
40
|
|
|
43
41
|
|
|
44
|
-
class DMSExporter(CDFExporter[DMSSchema]):
|
|
42
|
+
class DMSExporter(CDFExporter[DMSRules, DMSSchema]):
|
|
45
43
|
"""Export rules to Cognite Data Fusion's Data Model Storage (DMS) service.
|
|
46
44
|
|
|
47
45
|
Args:
|
|
@@ -82,7 +80,7 @@ class DMSExporter(CDFExporter[DMSSchema]):
|
|
|
82
80
|
self.suppress_warnings = suppress_warnings
|
|
83
81
|
self._schema: DMSSchema | None = None
|
|
84
82
|
|
|
85
|
-
def export_to_file(self, rules:
|
|
83
|
+
def export_to_file(self, rules: DMSRules, filepath: Path) -> None:
|
|
86
84
|
"""Export the rules to a file(s).
|
|
87
85
|
|
|
88
86
|
If the file is a directory, the components will be exported to separate files, otherwise they will be
|
|
@@ -97,12 +95,12 @@ class DMSExporter(CDFExporter[DMSSchema]):
|
|
|
97
95
|
else:
|
|
98
96
|
self._export_to_zip_file(filepath, rules)
|
|
99
97
|
|
|
100
|
-
def _export_to_directory(self, directory: Path, rules:
|
|
98
|
+
def _export_to_directory(self, directory: Path, rules: DMSRules) -> None:
|
|
101
99
|
schema = self.export(rules)
|
|
102
100
|
exclude = self._create_exclude_set()
|
|
103
101
|
schema.to_directory(directory, exclude=exclude, new_line=self._new_line, encoding=self._encoding)
|
|
104
102
|
|
|
105
|
-
def _export_to_zip_file(self, filepath: Path, rules:
|
|
103
|
+
def _export_to_zip_file(self, filepath: Path, rules: DMSRules) -> None:
|
|
106
104
|
if filepath.suffix not in {".zip"}:
|
|
107
105
|
warnings.warn("File extension is not .zip, adding it to the file name", stacklevel=2)
|
|
108
106
|
filepath = filepath.with_suffix(".zip")
|
|
@@ -117,18 +115,10 @@ class DMSExporter(CDFExporter[DMSSchema]):
|
|
|
117
115
|
exclude = {"spaces", "data_models", "views", "containers", "node_types"} - self.export_components
|
|
118
116
|
return exclude
|
|
119
117
|
|
|
120
|
-
def export(self, rules:
|
|
121
|
-
|
|
122
|
-
dms_rules = rules
|
|
123
|
-
elif isinstance(rules, InformationRules):
|
|
124
|
-
dms_rules = rules.as_dms_rules()
|
|
125
|
-
else:
|
|
126
|
-
raise ValueError(f"{type(rules).__name__} cannot be exported to DMS")
|
|
127
|
-
return dms_rules.as_schema(include_pipeline=self.export_pipeline, instance_space=self.instance_space)
|
|
118
|
+
def export(self, rules: DMSRules) -> DMSSchema:
|
|
119
|
+
return rules.as_schema(include_pipeline=self.export_pipeline, instance_space=self.instance_space)
|
|
128
120
|
|
|
129
|
-
def delete_from_cdf(
|
|
130
|
-
self, rules: VerifiedRules, client: CogniteClient, dry_run: bool = False
|
|
131
|
-
) -> Iterable[UploadResult]:
|
|
121
|
+
def delete_from_cdf(self, rules: DMSRules, client: CogniteClient, dry_run: bool = False) -> Iterable[UploadResult]:
|
|
132
122
|
to_export = self._prepare_exporters(rules, client)
|
|
133
123
|
|
|
134
124
|
# we need to reverse order in which we are picking up the items to delete
|
|
@@ -172,7 +162,7 @@ class DMSExporter(CDFExporter[DMSSchema]):
|
|
|
172
162
|
)
|
|
173
163
|
|
|
174
164
|
def export_to_cdf_iterable(
|
|
175
|
-
self, rules:
|
|
165
|
+
self, rules: DMSRules, client: CogniteClient, dry_run: bool = False
|
|
176
166
|
) -> Iterable[UploadResult]:
|
|
177
167
|
to_export = self._prepare_exporters(rules, client)
|
|
178
168
|
|
|
@@ -16,7 +16,6 @@ from cognite.neat.rules._shared import VerifiedRules
|
|
|
16
16
|
from cognite.neat.rules.models import (
|
|
17
17
|
DataModelType,
|
|
18
18
|
ExtensionCategory,
|
|
19
|
-
RoleTypes,
|
|
20
19
|
SchemaCompleteness,
|
|
21
20
|
SheetEntity,
|
|
22
21
|
)
|
|
@@ -27,7 +26,7 @@ from cognite.neat.rules.models.information import InformationMetadata
|
|
|
27
26
|
from ._base import BaseExporter
|
|
28
27
|
|
|
29
28
|
|
|
30
|
-
class ExcelExporter(BaseExporter[Workbook]):
|
|
29
|
+
class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
|
|
31
30
|
"""Export rules to Excel.
|
|
32
31
|
|
|
33
32
|
Args:
|
|
@@ -68,16 +67,14 @@ class ExcelExporter(BaseExporter[Workbook]):
|
|
|
68
67
|
"Classes": "Definition of Classes",
|
|
69
68
|
"Views": "Definition of Views",
|
|
70
69
|
"Containers": "Definition of Containers",
|
|
70
|
+
"Nodes": "Definition of Nodes",
|
|
71
|
+
"Enum": "Definition of Enum Collections",
|
|
71
72
|
}
|
|
72
73
|
style_options = get_args(Style)
|
|
73
74
|
dump_options = get_args(DumpOptions)
|
|
74
75
|
|
|
75
76
|
def __init__(
|
|
76
|
-
self,
|
|
77
|
-
styling: Style = "default",
|
|
78
|
-
output_role: RoleTypes | None = None,
|
|
79
|
-
dump_as: DumpOptions = "user",
|
|
80
|
-
new_model_id: tuple[str, str] | None = None,
|
|
77
|
+
self, styling: Style = "default", dump_as: DumpOptions = "user", new_model_id: tuple[str, str] | None = None
|
|
81
78
|
):
|
|
82
79
|
if styling not in self.style_options:
|
|
83
80
|
raise ValueError(f"Invalid styling: {styling}. Valid options are {self.style_options}")
|
|
@@ -85,7 +82,6 @@ class ExcelExporter(BaseExporter[Workbook]):
|
|
|
85
82
|
raise ValueError(f"Invalid dump_as: {dump_as}. Valid options are {self.dump_options}")
|
|
86
83
|
self.styling = styling
|
|
87
84
|
self._styling_level = self.style_options.index(styling)
|
|
88
|
-
self.output_role = output_role
|
|
89
85
|
self.new_model_id = new_model_id
|
|
90
86
|
self.dump_as = dump_as
|
|
91
87
|
|
|
@@ -99,7 +95,6 @@ class ExcelExporter(BaseExporter[Workbook]):
|
|
|
99
95
|
return None
|
|
100
96
|
|
|
101
97
|
def export(self, rules: VerifiedRules) -> Workbook:
|
|
102
|
-
rules = self._convert_to_output_role(rules, self.output_role)
|
|
103
98
|
workbook = Workbook()
|
|
104
99
|
# Remove default sheet named "Sheet"
|
|
105
100
|
workbook.remove(workbook["Sheet"])
|
|
@@ -279,9 +274,7 @@ class _MetadataCreator:
|
|
|
279
274
|
|
|
280
275
|
new_metadata = self._create_new_info(now)
|
|
281
276
|
if isinstance(metadata, DMSMetadata):
|
|
282
|
-
from cognite.neat.rules.
|
|
283
|
-
_InformationRulesConverter,
|
|
284
|
-
)
|
|
277
|
+
from cognite.neat.rules.transformers._converters import _InformationRulesConverter
|
|
285
278
|
|
|
286
279
|
output_metadata: DMSMetadata | InformationMetadata = _InformationRulesConverter._convert_metadata_to_dms(
|
|
287
280
|
new_metadata
|
|
@@ -15,7 +15,6 @@ from cognite.neat.issues.errors import (
|
|
|
15
15
|
)
|
|
16
16
|
from cognite.neat.issues.warnings import PropertyDefinitionDuplicatedWarning
|
|
17
17
|
from cognite.neat.rules.analysis import InformationAnalysis
|
|
18
|
-
from cognite.neat.rules.models import DMSRules
|
|
19
18
|
from cognite.neat.rules.models.data_types import DataType
|
|
20
19
|
from cognite.neat.rules.models.entities import ClassEntity, EntityTypes
|
|
21
20
|
from cognite.neat.rules.models.information import (
|
|
@@ -34,32 +33,30 @@ if sys.version_info >= (3, 11):
|
|
|
34
33
|
else:
|
|
35
34
|
from typing_extensions import Self
|
|
36
35
|
|
|
37
|
-
from cognite.neat.rules._shared import VerifiedRules
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def export_to_file(self, rules: VerifiedRules, filepath: Path) -> None:
|
|
37
|
+
class GraphExporter(BaseExporter[InformationRules, Graph], ABC):
|
|
38
|
+
def export_to_file(self, rules: InformationRules, filepath: Path) -> None:
|
|
42
39
|
self.export(rules).serialize(destination=filepath, encoding=self._encoding, newline=self._new_line)
|
|
43
40
|
|
|
44
41
|
|
|
45
42
|
class OWLExporter(GraphExporter):
|
|
46
|
-
"""Exports rules to an OWL ontology."""
|
|
43
|
+
"""Exports verified information rules to an OWL ontology."""
|
|
47
44
|
|
|
48
|
-
def export(self, rules:
|
|
45
|
+
def export(self, rules: InformationRules) -> Graph:
|
|
49
46
|
return Ontology.from_rules(rules).as_owl()
|
|
50
47
|
|
|
51
48
|
|
|
52
49
|
class SHACLExporter(GraphExporter):
|
|
53
50
|
"""Exports rules to a SHACL graph."""
|
|
54
51
|
|
|
55
|
-
def export(self, rules:
|
|
52
|
+
def export(self, rules: InformationRules) -> Graph:
|
|
56
53
|
return Ontology.from_rules(rules).as_shacl()
|
|
57
54
|
|
|
58
55
|
|
|
59
56
|
class SemanticDataModelExporter(GraphExporter):
|
|
60
|
-
"""Exports rules to a semantic data model."""
|
|
57
|
+
"""Exports verified information rules to a semantic data model."""
|
|
61
58
|
|
|
62
|
-
def export(self, rules:
|
|
59
|
+
def export(self, rules: InformationRules) -> Graph:
|
|
63
60
|
return Ontology.from_rules(rules).as_semantic_data_model()
|
|
64
61
|
|
|
65
62
|
|
|
@@ -86,23 +83,16 @@ class Ontology(OntologyModel):
|
|
|
86
83
|
prefixes: dict[str, Namespace]
|
|
87
84
|
|
|
88
85
|
@classmethod
|
|
89
|
-
def from_rules(cls,
|
|
86
|
+
def from_rules(cls, rules: InformationRules) -> Self:
|
|
90
87
|
"""
|
|
91
88
|
Generates an ontology from a set of transformation rules.
|
|
92
89
|
|
|
93
90
|
Args:
|
|
94
|
-
|
|
91
|
+
rules: The rules to generate the ontology from.
|
|
95
92
|
|
|
96
93
|
Returns:
|
|
97
94
|
An instance of Ontology.
|
|
98
95
|
"""
|
|
99
|
-
if isinstance(input_rules, InformationRules):
|
|
100
|
-
rules = input_rules
|
|
101
|
-
elif isinstance(input_rules, DMSRules):
|
|
102
|
-
rules = input_rules.as_information_rules()
|
|
103
|
-
else:
|
|
104
|
-
raise ValueError(f"{type(input_rules).__name__} cannot be exported to Ontology")
|
|
105
|
-
|
|
106
96
|
if duplicates := duplicated_properties(rules.properties):
|
|
107
97
|
errors = []
|
|
108
98
|
for (class_, property_), definitions in duplicates.items():
|
|
@@ -6,13 +6,12 @@ from typing import Literal, get_args
|
|
|
6
6
|
import yaml
|
|
7
7
|
|
|
8
8
|
from cognite.neat.rules._shared import VerifiedRules
|
|
9
|
-
from cognite.neat.rules.models import RoleTypes
|
|
10
9
|
|
|
11
10
|
from ._base import BaseExporter
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
class YAMLExporter(BaseExporter[str]):
|
|
15
|
-
"""Export rules to YAML.
|
|
13
|
+
class YAMLExporter(BaseExporter[VerifiedRules, str]):
|
|
14
|
+
"""Export rules (Information, DMS or Domain) to YAML.
|
|
16
15
|
|
|
17
16
|
Args:
|
|
18
17
|
files: The number of files to output. Defaults to "single".
|
|
@@ -38,14 +37,13 @@ class YAMLExporter(BaseExporter[str]):
|
|
|
38
37
|
file_option = get_args(Files)
|
|
39
38
|
format_option = get_args(Format)
|
|
40
39
|
|
|
41
|
-
def __init__(self, files: Files = "single", output: Format = "yaml"
|
|
40
|
+
def __init__(self, files: Files = "single", output: Format = "yaml"):
|
|
42
41
|
if files not in self.file_option:
|
|
43
42
|
raise ValueError(f"Invalid files: {files}. Valid options are {self.file_option}")
|
|
44
43
|
if output not in self.format_option:
|
|
45
44
|
raise ValueError(f"Invalid output: {output}. Valid options are {self.format_option}")
|
|
46
45
|
self.files = files
|
|
47
46
|
self.output = output
|
|
48
|
-
self.output_role = output_role
|
|
49
47
|
|
|
50
48
|
def export_to_file(self, rules: VerifiedRules, filepath: Path) -> None:
|
|
51
49
|
"""Exports transformation rules to YAML/JSON file(s)."""
|
|
@@ -66,7 +64,6 @@ class YAMLExporter(BaseExporter[str]):
|
|
|
66
64
|
Returns:
|
|
67
65
|
str: The rules in YAML (or JSON) format.
|
|
68
66
|
"""
|
|
69
|
-
rules = self._convert_to_output_role(rules, self.output_role)
|
|
70
67
|
# model_dump_json ensures that the output is in JSON format,
|
|
71
68
|
# if we don't do this, we will get Enums and other types that are not serializable to YAML
|
|
72
69
|
json_output = rules.dump(mode="json")
|
|
@@ -4,72 +4,27 @@ from abc import ABC, abstractmethod
|
|
|
4
4
|
from collections.abc import Iterator
|
|
5
5
|
from contextlib import contextmanager
|
|
6
6
|
from datetime import datetime
|
|
7
|
-
from typing import Any,
|
|
7
|
+
from typing import Any, Generic, Literal
|
|
8
8
|
|
|
9
9
|
from pydantic import ValidationError
|
|
10
10
|
from rdflib import Namespace
|
|
11
11
|
|
|
12
12
|
from cognite.neat.issues import IssueList, NeatError, NeatWarning
|
|
13
|
-
from cognite.neat.rules._shared import
|
|
14
|
-
from cognite.neat.rules.models import AssetRules, DMSRules, InformationRules, RoleTypes
|
|
13
|
+
from cognite.neat.rules._shared import ReadRules, T_InputRules
|
|
15
14
|
from cognite.neat.utils.auxiliary import class_html_doc
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
class BaseImporter(ABC):
|
|
17
|
+
class BaseImporter(ABC, Generic[T_InputRules]):
|
|
19
18
|
"""
|
|
20
19
|
BaseImporter class which all importers inherit from.
|
|
21
20
|
"""
|
|
22
21
|
|
|
23
|
-
@overload
|
|
24
|
-
def to_rules(self, errors: Literal["raise"], role: RoleTypes | None = None) -> VerifiedRules: ...
|
|
25
|
-
|
|
26
|
-
@overload
|
|
27
|
-
def to_rules(
|
|
28
|
-
self, errors: Literal["continue"] = "continue", role: RoleTypes | None = None
|
|
29
|
-
) -> tuple[VerifiedRules | None, IssueList]: ...
|
|
30
|
-
|
|
31
22
|
@abstractmethod
|
|
32
|
-
def to_rules(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
role: RoleTypes | None = None,
|
|
36
|
-
) -> tuple[VerifiedRules | None, IssueList] | VerifiedRules:
|
|
37
|
-
"""
|
|
38
|
-
Creates `Rules` object from the data for target role.
|
|
39
|
-
"""
|
|
40
|
-
...
|
|
41
|
-
|
|
42
|
-
@classmethod
|
|
43
|
-
def _to_output(
|
|
44
|
-
cls,
|
|
45
|
-
rules: VerifiedRules,
|
|
46
|
-
issues: IssueList,
|
|
47
|
-
errors: Literal["raise", "continue"] = "continue",
|
|
48
|
-
role: RoleTypes | None = None,
|
|
49
|
-
) -> tuple[VerifiedRules | None, IssueList] | VerifiedRules:
|
|
50
|
-
"""Converts the rules to the output format."""
|
|
51
|
-
|
|
52
|
-
if rules.metadata.role is role or role is None:
|
|
53
|
-
output = rules
|
|
54
|
-
elif isinstance(rules, DMSRules) or isinstance(rules, AssetRules) and role is RoleTypes.information:
|
|
55
|
-
output = rules.as_information_rules()
|
|
56
|
-
elif isinstance(rules, InformationRules) or isinstance(rules, AssetRules) and role is RoleTypes.dms:
|
|
57
|
-
output = rules.as_dms_rules()
|
|
58
|
-
else:
|
|
59
|
-
raise NotImplementedError(f"Role {role} is not supported for {type(rules).__name__} rules")
|
|
60
|
-
|
|
61
|
-
if errors == "raise":
|
|
62
|
-
return output
|
|
63
|
-
else:
|
|
64
|
-
return output, issues
|
|
65
|
-
|
|
66
|
-
@classmethod
|
|
67
|
-
def _return_or_raise(cls, issue_list: IssueList, errors: Literal["raise", "continue"]) -> tuple[None, IssueList]:
|
|
68
|
-
if errors == "raise":
|
|
69
|
-
raise issue_list.as_errors()
|
|
70
|
-
return None, issue_list
|
|
23
|
+
def to_rules(self) -> ReadRules[T_InputRules]:
|
|
24
|
+
"""Creates `Rules` object from the data for target role."""
|
|
25
|
+
raise NotImplementedError()
|
|
71
26
|
|
|
72
|
-
def _default_metadata(self):
|
|
27
|
+
def _default_metadata(self) -> dict[str, Any]:
|
|
73
28
|
return {
|
|
74
29
|
"prefix": "neat",
|
|
75
30
|
"schema": "partial",
|