cognite-neat 0.109.2__tar.gz → 0.109.3__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.109.2 → cognite_neat-0.109.3}/PKG-INFO +1 -1
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_alpha.py +1 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/testing.py +1 -1
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/_base.py +33 -9
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/errors/__init__.py +2 -10
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/errors/_general.py +1 -1
- cognite_neat-0.109.3/cognite/neat/_issues/errors/_wrapper.py +11 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/_rdfpath.py +2 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/_types.py +4 -2
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/dms/_rules.py +0 -36
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/entities/_constants.py +3 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/entities/_single_value.py +6 -1
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/transformers/__init__.py +4 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/transformers/_converters.py +221 -15
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_base.py +7 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_create.py +46 -12
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_prepare.py +11 -3
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_state.py +1 -1
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_to.py +3 -3
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/text.py +40 -9
- cognite_neat-0.109.3/cognite/neat/_version.py +2 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/pyproject.toml +1 -1
- cognite_neat-0.109.2/cognite/neat/_issues/errors/_workflow.py +0 -36
- cognite_neat-0.109.2/cognite/neat/_version.py +0 -2
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/LICENSE +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/README.md +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/_api/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/_api/data_modeling_loaders.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/_api/schema.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/_api_client.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/data_classes/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/data_classes/data_modeling.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/data_classes/neat_sequence.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_client/data_classes/schema.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_config.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_constants.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/_shared.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/_tracking/base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/_tracking/log.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/examples/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_dms.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_dms_graph.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_iodd.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/loaders/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/loaders/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/loaders/_rdf2dms.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/queries/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/queries/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/queries/_construct.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/queries/_shared.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/transformers/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/transformers/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/transformers/_iodd.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/transformers/_prune_graph.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_graph/transformers/_value_type.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/errors/_external.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/errors/_properties.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/errors/_resources.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/formatters.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/warnings/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/warnings/_external.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/warnings/_general.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/warnings/_models.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/warnings/_properties.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/warnings/_resources.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/_constants.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/_shared.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/analysis/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/analysis/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/analysis/_dms.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/analysis/_information.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/catalog/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/catalog/classic_model.xlsx +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/catalog/hello_world_pump.xlsx +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/exporters/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/exporters/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/exporters/_rules2instance_template.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/exporters/_validation.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_rdf/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_rdf/_imf2rules.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_rdf/_owl2rules.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/_base_input.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/_base_rules.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/data_types.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/entities/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/entities/_types.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/entities/_wrapped.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/information/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/information/_rules.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/information/_validation.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/mapping/_classic2core.yaml +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/transformers/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/transformers/_mapping.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/transformers/_verification.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_collector.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_drop.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_fix.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_inspect.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_mapping.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_read.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_set.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_show.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/_wizard.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/engine/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/engine/_import.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/engine/_interface.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/engine/_load.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_session/exceptions.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_store/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_store/_graph_store.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_store/_provenance.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_store/_rules_store.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_store/exceptions.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/auth.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/auxiliary.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/collection_.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/graph_transformations_report.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/io_.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/rdf_.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/reader/__init__.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/reader/_base.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/spreadsheet.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/time_.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/upload.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_utils/xml_.py +0 -0
- {cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/py.typed +0 -0
|
@@ -19,7 +19,7 @@ class NeatClientMock(CogniteClientMock):
|
|
|
19
19
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
20
20
|
if "parent" in kwargs:
|
|
21
21
|
super().__init__(*args, **kwargs)
|
|
22
|
-
return
|
|
22
|
+
return
|
|
23
23
|
super().__init__(*args, **kwargs)
|
|
24
24
|
self.schema = SchemaAPI(self)
|
|
25
25
|
self.loaders = DataModelLoaderAPI(self)
|
|
@@ -103,6 +103,8 @@ class NeatIssue:
|
|
|
103
103
|
variables[name] = var_.as_posix()
|
|
104
104
|
elif isinstance(var_, Collection):
|
|
105
105
|
variables[name] = humanize_collection(var_)
|
|
106
|
+
elif isinstance(var_, NeatError):
|
|
107
|
+
variables[name] = var_.as_message(include_type=False)
|
|
106
108
|
else:
|
|
107
109
|
variables[name] = repr(var_)
|
|
108
110
|
return variables, has_all_optional
|
|
@@ -138,6 +140,8 @@ class NeatIssue:
|
|
|
138
140
|
return value.dump(camel_case=True)
|
|
139
141
|
elif isinstance(value, DataModelId):
|
|
140
142
|
return value.dump(camel_case=True, include_type=False)
|
|
143
|
+
elif isinstance(value, NeatError):
|
|
144
|
+
return value.dump()
|
|
141
145
|
raise ValueError(f"Unsupported type: {type(value)}")
|
|
142
146
|
|
|
143
147
|
@classmethod
|
|
@@ -192,6 +196,8 @@ class NeatIssue:
|
|
|
192
196
|
return ContainerId.load(value)
|
|
193
197
|
elif inspect.isclass(type_) and issubclass(type_, Entity):
|
|
194
198
|
return type_.load(value)
|
|
199
|
+
elif type_ is NeatError:
|
|
200
|
+
return cls.load(value)
|
|
195
201
|
return value
|
|
196
202
|
|
|
197
203
|
def __lt__(self, other: "NeatIssue") -> bool:
|
|
@@ -227,22 +233,19 @@ class NeatError(NeatIssue, Exception):
|
|
|
227
233
|
# Skip the error for SheetList, as it is not relevant for the user. This is an
|
|
228
234
|
# internal class used to have helper methods for a lists as .to_pandas()
|
|
229
235
|
continue
|
|
236
|
+
|
|
230
237
|
neat_error: NeatError | None = None
|
|
231
238
|
if isinstance(error, dict) and isinstance(ctx := error.get("ctx"), dict) and "error" in ctx:
|
|
232
239
|
neat_error = ctx["error"]
|
|
233
240
|
elif isinstance(error, NeatError | MultiValueError):
|
|
234
241
|
neat_error = error
|
|
235
242
|
|
|
243
|
+
loc = error["loc"] if isinstance(error, dict) else tuple()
|
|
236
244
|
if isinstance(neat_error, MultiValueError):
|
|
237
|
-
|
|
238
|
-
for caught_error in neat_error.errors:
|
|
239
|
-
cls._adjust_row_numbers(caught_error, read_info_by_sheet) # type: ignore[arg-type]
|
|
240
|
-
all_errors.extend(neat_error.errors) # type: ignore[arg-type]
|
|
245
|
+
all_errors.extend([cls._adjust_error(e, loc, read_info_by_sheet) for e in neat_error.errors])
|
|
241
246
|
elif isinstance(neat_error, NeatError):
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
all_errors.append(neat_error)
|
|
245
|
-
elif isinstance(error, dict) and len(error["loc"]) >= 4 and read_info_by_sheet:
|
|
247
|
+
all_errors.append(cls._adjust_error(neat_error, loc, read_info_by_sheet))
|
|
248
|
+
elif isinstance(error, dict) and len(loc) >= 4 and read_info_by_sheet:
|
|
246
249
|
all_errors.append(RowError.from_pydantic_error(error, read_info_by_sheet))
|
|
247
250
|
elif isinstance(error, dict):
|
|
248
251
|
all_errors.append(DefaultPydanticError.from_pydantic_error(error))
|
|
@@ -251,6 +254,18 @@ class NeatError(NeatIssue, Exception):
|
|
|
251
254
|
raise ValueError(f"Unsupported error type: {error}")
|
|
252
255
|
return all_errors
|
|
253
256
|
|
|
257
|
+
@classmethod
|
|
258
|
+
def _adjust_error(
|
|
259
|
+
cls, error: "NeatError", loc: tuple[str | int, ...], read_info_by_sheet: dict[str, SpreadsheetRead] | None
|
|
260
|
+
) -> "NeatError":
|
|
261
|
+
from .errors._wrapper import MetadataValueError
|
|
262
|
+
|
|
263
|
+
if read_info_by_sheet:
|
|
264
|
+
cls._adjust_row_numbers(error, read_info_by_sheet)
|
|
265
|
+
if len(loc) == 2 and isinstance(loc[0], str) and loc[0].casefold() == "metadata":
|
|
266
|
+
return MetadataValueError(field_name=str(loc[1]), error=error)
|
|
267
|
+
return error
|
|
268
|
+
|
|
254
269
|
@staticmethod
|
|
255
270
|
def _adjust_row_numbers(caught_error: "NeatError", read_info_by_sheet: dict[str, SpreadsheetRead]) -> None:
|
|
256
271
|
from cognite.neat._issues.errors._properties import PropertyDefinitionDuplicatedError
|
|
@@ -288,7 +303,16 @@ class DefaultPydanticError(NeatError, ValueError):
|
|
|
288
303
|
msg: str
|
|
289
304
|
|
|
290
305
|
@classmethod
|
|
291
|
-
def from_pydantic_error(cls, error: ErrorDetails) -> "
|
|
306
|
+
def from_pydantic_error(cls, error: ErrorDetails) -> "NeatError":
|
|
307
|
+
loc = error["loc"]
|
|
308
|
+
if len(loc) >= 2 and isinstance(loc[0], str) and loc[0].casefold() == "metadata":
|
|
309
|
+
from .errors._general import NeatValueError
|
|
310
|
+
from .errors._wrapper import MetadataValueError
|
|
311
|
+
|
|
312
|
+
return MetadataValueError(
|
|
313
|
+
field_name=str(loc[1]), error=NeatValueError(f"{error['msg']} got '{error['input']}'")
|
|
314
|
+
)
|
|
315
|
+
|
|
292
316
|
return cls(
|
|
293
317
|
type=error["type"],
|
|
294
318
|
loc=error["loc"],
|
|
@@ -31,12 +31,7 @@ from ._resources import (
|
|
|
31
31
|
ResourceNotFoundError,
|
|
32
32
|
ResourceRetrievalError,
|
|
33
33
|
)
|
|
34
|
-
from .
|
|
35
|
-
WorkflowConfigurationNotSetError,
|
|
36
|
-
WorkFlowMissingDataError,
|
|
37
|
-
WorkflowStepNotInitializedError,
|
|
38
|
-
WorkflowStepOutputError,
|
|
39
|
-
)
|
|
34
|
+
from ._wrapper import MetadataValueError
|
|
40
35
|
|
|
41
36
|
__all__ = [
|
|
42
37
|
"AuthorizationError",
|
|
@@ -47,6 +42,7 @@ __all__ = [
|
|
|
47
42
|
"FileNotFoundNeatError",
|
|
48
43
|
"FileReadError",
|
|
49
44
|
"FileTypeUnexpectedError",
|
|
45
|
+
"MetadataValueError",
|
|
50
46
|
"NeatError",
|
|
51
47
|
"NeatImportError",
|
|
52
48
|
"NeatTypeError",
|
|
@@ -70,10 +66,6 @@ __all__ = [
|
|
|
70
66
|
"ResourceRetrievalError",
|
|
71
67
|
"ReversedConnectionNotFeasibleError",
|
|
72
68
|
"RowError",
|
|
73
|
-
"WorkFlowMissingDataError",
|
|
74
|
-
"WorkflowConfigurationNotSetError",
|
|
75
|
-
"WorkflowStepNotInitializedError",
|
|
76
|
-
"WorkflowStepOutputError",
|
|
77
69
|
]
|
|
78
70
|
|
|
79
71
|
_NEAT_ERRORS_BY_NAME = {error.__name__: error for error in _get_subclasses(NeatError, include_base=True)}
|
|
@@ -19,7 +19,7 @@ class NeatTypeError(NeatError, TypeError):
|
|
|
19
19
|
|
|
20
20
|
@dataclass(unsafe_hash=True)
|
|
21
21
|
class RegexViolationError(NeatError, ValueError):
|
|
22
|
-
"""
|
|
22
|
+
"""The value '{value}' failed regex, {regex}, validation in {location}.
|
|
23
23
|
Make sure that the name follows the regex pattern."""
|
|
24
24
|
|
|
25
25
|
value: str
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
import sys
|
|
5
|
+
import urllib.parse
|
|
5
6
|
from collections import Counter
|
|
6
7
|
from functools import total_ordering
|
|
7
8
|
from typing import ClassVar, Literal
|
|
@@ -327,6 +328,7 @@ def parse_table_lookup(raw: str) -> TableLookup:
|
|
|
327
328
|
|
|
328
329
|
|
|
329
330
|
def parse_rule(rule_raw: str, rule_type: TransformationRuleType | None) -> RDFPath:
|
|
331
|
+
rule_raw = urllib.parse.unquote(rule_raw)
|
|
330
332
|
match rule_type:
|
|
331
333
|
case TransformationRuleType.rdfpath:
|
|
332
334
|
rule_raw = rule_raw.replace(" ", "")
|
|
@@ -38,7 +38,9 @@ def _custom_error(exc_factory: Callable[[str | None, Exception], Any]) -> Any:
|
|
|
38
38
|
def _validator(value: Any, next_: Any, ctx: ValidationInfo) -> Any:
|
|
39
39
|
try:
|
|
40
40
|
return next_(value, ctx)
|
|
41
|
-
except
|
|
41
|
+
except ValueError as e:
|
|
42
|
+
if value is None:
|
|
43
|
+
raise e
|
|
42
44
|
raise exc_factory(ctx.field_name, value) from None
|
|
43
45
|
|
|
44
46
|
return WrapValidator(_validator)
|
|
@@ -130,7 +132,7 @@ def _external_id_validation_factory(entity_type: EntityTypes, location: str):
|
|
|
130
132
|
|
|
131
133
|
SpaceType = Annotated[
|
|
132
134
|
str,
|
|
133
|
-
AfterValidator(_external_id_validation_factory(EntityTypes.space, "
|
|
135
|
+
AfterValidator(_external_id_validation_factory(EntityTypes.space, "")),
|
|
134
136
|
]
|
|
135
137
|
|
|
136
138
|
InformationPropertyType = Annotated[
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import warnings
|
|
2
1
|
from collections.abc import Hashable
|
|
3
2
|
from typing import TYPE_CHECKING, Any, ClassVar, Literal
|
|
4
3
|
|
|
@@ -8,11 +7,7 @@ from pydantic import Field, field_serializer, field_validator, model_validator
|
|
|
8
7
|
from pydantic_core.core_schema import SerializationInfo, ValidationInfo
|
|
9
8
|
|
|
10
9
|
from cognite.neat._client.data_classes.schema import DMSSchema
|
|
11
|
-
from cognite.neat._constants import COGNITE_SPACES
|
|
12
10
|
from cognite.neat._issues.errors import NeatValueError
|
|
13
|
-
from cognite.neat._issues.warnings import (
|
|
14
|
-
PrincipleMatchingSpaceAndVersionWarning,
|
|
15
|
-
)
|
|
16
11
|
from cognite.neat._rules.models._base_rules import (
|
|
17
12
|
BaseMetadata,
|
|
18
13
|
BaseRules,
|
|
@@ -407,37 +402,6 @@ class DMSRules(BaseRules):
|
|
|
407
402
|
None, alias="Nodes", description="Contains the definition of the node types."
|
|
408
403
|
)
|
|
409
404
|
|
|
410
|
-
@field_validator("views")
|
|
411
|
-
def matching_version_and_space(cls, value: SheetList[DMSView], info: ValidationInfo) -> SheetList[DMSView]:
|
|
412
|
-
if not (metadata := info.data.get("metadata")):
|
|
413
|
-
return value
|
|
414
|
-
model_version = metadata.version
|
|
415
|
-
if different_version := [
|
|
416
|
-
view.view.as_id()
|
|
417
|
-
for view in value
|
|
418
|
-
if view.view.version != model_version and view.view.space not in COGNITE_SPACES
|
|
419
|
-
]:
|
|
420
|
-
for view_id in different_version:
|
|
421
|
-
warnings.warn(
|
|
422
|
-
PrincipleMatchingSpaceAndVersionWarning(
|
|
423
|
-
f"The view {view_id!r} has a different version than the data model version, {model_version}",
|
|
424
|
-
),
|
|
425
|
-
stacklevel=2,
|
|
426
|
-
)
|
|
427
|
-
if different_space := [
|
|
428
|
-
view.view.as_id()
|
|
429
|
-
for view in value
|
|
430
|
-
if view.view.space != metadata.space and view.view.space not in COGNITE_SPACES
|
|
431
|
-
]:
|
|
432
|
-
for view_id in different_space:
|
|
433
|
-
warnings.warn(
|
|
434
|
-
PrincipleMatchingSpaceAndVersionWarning(
|
|
435
|
-
f"The view {view_id!r} is in a different space than the data model space, {metadata.space}",
|
|
436
|
-
),
|
|
437
|
-
stacklevel=2,
|
|
438
|
-
)
|
|
439
|
-
return value
|
|
440
|
-
|
|
441
405
|
@model_validator(mode="after")
|
|
442
406
|
def set_neat_id(self) -> "DMSRules":
|
|
443
407
|
namespace = self.metadata.namespace
|
{cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/models/entities/_single_value.py
RENAMED
|
@@ -134,7 +134,12 @@ class Entity(BaseModel, extra="ignore"):
|
|
|
134
134
|
content = result.group("content")
|
|
135
135
|
if content is None:
|
|
136
136
|
return dict(prefix=prefix, suffix=suffix)
|
|
137
|
-
|
|
137
|
+
try:
|
|
138
|
+
extra_args = dict(
|
|
139
|
+
SPLIT_ON_EQUAL_PATTERN.split(pair.strip()) for pair in SPLIT_ON_COMMA_PATTERN.split(content)
|
|
140
|
+
)
|
|
141
|
+
except ValueError:
|
|
142
|
+
raise NeatValueError(f"Invalid {cls.type_.value} entity: {raw!r}") from None
|
|
138
143
|
expected_args = {
|
|
139
144
|
field_.alias or field_name: field_.annotation for field_name, field_ in cls.model_fields.items()
|
|
140
145
|
}
|
|
@@ -13,10 +13,12 @@ from ._converters import (
|
|
|
13
13
|
MergeInformationRules,
|
|
14
14
|
PrefixEntities,
|
|
15
15
|
SetIDDMSModel,
|
|
16
|
+
StandardizeNaming,
|
|
16
17
|
ToCompliantEntities,
|
|
17
18
|
ToDataProductModel,
|
|
18
19
|
ToEnterpriseModel,
|
|
19
20
|
ToExtensionModel,
|
|
21
|
+
ToInformationCompliantEntities,
|
|
20
22
|
ToSolutionModel,
|
|
21
23
|
)
|
|
22
24
|
from ._mapping import AsParentPropertyId, MapOneToOne, RuleMapper
|
|
@@ -40,10 +42,12 @@ __all__ = [
|
|
|
40
42
|
"RuleMapper",
|
|
41
43
|
"RulesTransformer",
|
|
42
44
|
"SetIDDMSModel",
|
|
45
|
+
"StandardizeNaming",
|
|
43
46
|
"ToCompliantEntities",
|
|
44
47
|
"ToDataProductModel",
|
|
45
48
|
"ToEnterpriseModel",
|
|
46
49
|
"ToExtensionModel",
|
|
50
|
+
"ToInformationCompliantEntities",
|
|
47
51
|
"ToSolutionModel",
|
|
48
52
|
"VerifiedRulesTransformer",
|
|
49
53
|
"VerifyAnyRules",
|
{cognite_neat-0.109.2 → cognite_neat-0.109.3}/cognite/neat/_rules/transformers/_converters.py
RENAMED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import re
|
|
2
|
+
import urllib.parse
|
|
2
3
|
import warnings
|
|
3
4
|
from abc import ABC
|
|
4
5
|
from collections import Counter, defaultdict
|
|
5
6
|
from collections.abc import Collection, Mapping
|
|
6
7
|
from datetime import date, datetime
|
|
8
|
+
from functools import cached_property
|
|
7
9
|
from typing import ClassVar, Literal, TypeVar, cast, overload
|
|
8
10
|
|
|
9
11
|
from cognite.client.data_classes import data_modeling as dms
|
|
@@ -23,11 +25,12 @@ from cognite.neat._constants import (
|
|
|
23
25
|
from cognite.neat._issues.errors import NeatValueError
|
|
24
26
|
from cognite.neat._issues.warnings import NeatValueWarning
|
|
25
27
|
from cognite.neat._issues.warnings._models import (
|
|
26
|
-
EnterpriseModelNotBuildOnTopOfCDMWarning,
|
|
27
28
|
SolutionModelBuildOnTopOfCDMWarning,
|
|
28
29
|
)
|
|
30
|
+
from cognite.neat._rules._constants import PATTERNS, get_reserved_words
|
|
29
31
|
from cognite.neat._rules._shared import (
|
|
30
32
|
ReadInputRules,
|
|
33
|
+
ReadRules,
|
|
31
34
|
VerifiedRules,
|
|
32
35
|
)
|
|
33
36
|
from cognite.neat._rules.analysis import DMSAnalysis
|
|
@@ -35,6 +38,7 @@ from cognite.neat._rules.importers import DMSImporter
|
|
|
35
38
|
from cognite.neat._rules.models import (
|
|
36
39
|
DMSInputRules,
|
|
37
40
|
DMSRules,
|
|
41
|
+
InformationInputRules,
|
|
38
42
|
InformationRules,
|
|
39
43
|
SheetList,
|
|
40
44
|
data_types,
|
|
@@ -56,9 +60,9 @@ from cognite.neat._rules.models.entities import (
|
|
|
56
60
|
ViewEntity,
|
|
57
61
|
)
|
|
58
62
|
from cognite.neat._rules.models.information import InformationClass, InformationMetadata, InformationProperty
|
|
59
|
-
from cognite.neat._utils.text import to_camel
|
|
63
|
+
from cognite.neat._utils.text import NamingStandardization, to_camel
|
|
60
64
|
|
|
61
|
-
from ._base import T_VerifiedIn, T_VerifiedOut, VerifiedRulesTransformer
|
|
65
|
+
from ._base import RulesTransformer, T_VerifiedIn, T_VerifiedOut, VerifiedRulesTransformer
|
|
62
66
|
from ._verification import VerifyDMSRules
|
|
63
67
|
|
|
64
68
|
T_InputInRules = TypeVar("T_InputInRules", bound=ReadInputRules)
|
|
@@ -71,6 +75,105 @@ class ConversionTransformer(VerifiedRulesTransformer[T_VerifiedIn, T_VerifiedOut
|
|
|
71
75
|
...
|
|
72
76
|
|
|
73
77
|
|
|
78
|
+
class ToInformationCompliantEntities(
|
|
79
|
+
RulesTransformer[ReadRules[InformationInputRules], ReadRules[InformationInputRules]]
|
|
80
|
+
):
|
|
81
|
+
"""Converts input rules to rules that is compliant with the Information Model.
|
|
82
|
+
|
|
83
|
+
This is typically used with importers from arbitrary sources to ensure that classes and properties have valid
|
|
84
|
+
names.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
renaming: How to handle renaming of entities that are not compliant with the Information Model.
|
|
88
|
+
- "warning": Raises a warning and renames the entity.
|
|
89
|
+
- "skip": Renames the entity without raising a warning.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
def __init__(self, renaming: Literal["warning", "skip"] = "skip") -> None:
|
|
93
|
+
self._renaming = renaming
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def description(self) -> str:
|
|
97
|
+
return "Ensures that all entities are compliant with the Information Model."
|
|
98
|
+
|
|
99
|
+
def transform(self, rules: ReadRules[InformationInputRules]) -> ReadRules[InformationInputRules]:
|
|
100
|
+
if rules.rules is None:
|
|
101
|
+
return rules
|
|
102
|
+
# Doing dump to obtain a copy, and ensure that all entities are created. Input allows
|
|
103
|
+
# string for entities, the dump call will convert these to entities.
|
|
104
|
+
dumped = rules.rules.dump()
|
|
105
|
+
copy = InformationInputRules.load(dumped)
|
|
106
|
+
|
|
107
|
+
new_by_old_class_suffix: dict[str, str] = {}
|
|
108
|
+
for cls in copy.classes:
|
|
109
|
+
cls_entity = cast(ClassEntity, cls.class_) # Safe due to the dump above
|
|
110
|
+
if not PATTERNS.class_id_compliance.match(cls_entity.suffix):
|
|
111
|
+
new_suffix = self._fix_cls_suffix(cls_entity.suffix)
|
|
112
|
+
if self._renaming == "warning":
|
|
113
|
+
warnings.warn(
|
|
114
|
+
NeatValueWarning(f"Invalid class name {cls_entity.suffix!r}.Renaming to {new_suffix}"),
|
|
115
|
+
stacklevel=2,
|
|
116
|
+
)
|
|
117
|
+
cls.class_.suffix = new_suffix # type: ignore[union-attr]
|
|
118
|
+
|
|
119
|
+
for cls_ in copy.classes:
|
|
120
|
+
if cls_.implements:
|
|
121
|
+
for i, parent in enumerate(cls_.implements):
|
|
122
|
+
if isinstance(parent, ClassEntity) and parent.suffix in new_by_old_class_suffix:
|
|
123
|
+
cls_.implements[i].suffix = new_by_old_class_suffix[parent.suffix] # type: ignore[union-attr]
|
|
124
|
+
|
|
125
|
+
for prop in copy.properties:
|
|
126
|
+
if not PATTERNS.information_property_id_compliance.match(prop.property_):
|
|
127
|
+
new_property = self._fix_property(prop.property_)
|
|
128
|
+
if self._renaming == "warning":
|
|
129
|
+
warnings.warn(
|
|
130
|
+
NeatValueWarning(
|
|
131
|
+
f"Invalid property name {prop.class_.suffix}.{prop.property_!r}. Renaming to {new_property}" # type: ignore[union-attr]
|
|
132
|
+
),
|
|
133
|
+
stacklevel=2,
|
|
134
|
+
)
|
|
135
|
+
prop.property_ = new_property
|
|
136
|
+
|
|
137
|
+
if isinstance(prop.class_, ClassEntity) and prop.class_.suffix in new_by_old_class_suffix:
|
|
138
|
+
prop.class_.suffix = new_by_old_class_suffix[prop.class_.suffix]
|
|
139
|
+
|
|
140
|
+
if isinstance(prop.value_type, ClassEntity) and prop.value_type.suffix in new_by_old_class_suffix:
|
|
141
|
+
prop.value_type.suffix = new_by_old_class_suffix[prop.value_type.suffix]
|
|
142
|
+
|
|
143
|
+
if isinstance(prop.value_type, MultiValueTypeInfo):
|
|
144
|
+
for i, value_type in enumerate(prop.value_type.types):
|
|
145
|
+
if isinstance(value_type, ClassEntity) and value_type.suffix in new_by_old_class_suffix:
|
|
146
|
+
prop.value_type.types[i].suffix = new_by_old_class_suffix[value_type.suffix] # type: ignore[union-attr]
|
|
147
|
+
|
|
148
|
+
return ReadRules(rules=copy, read_context=rules.read_context)
|
|
149
|
+
|
|
150
|
+
@cached_property
|
|
151
|
+
def _reserved_class_words(self) -> set[str]:
|
|
152
|
+
return set(get_reserved_words("class"))
|
|
153
|
+
|
|
154
|
+
@cached_property
|
|
155
|
+
def _reserved_property_words(self) -> set[str]:
|
|
156
|
+
return set(get_reserved_words("property"))
|
|
157
|
+
|
|
158
|
+
def _fix_cls_suffix(self, suffix: str) -> str:
|
|
159
|
+
if suffix in self._reserved_class_words:
|
|
160
|
+
return f"My{suffix}"
|
|
161
|
+
suffix = urllib.parse.unquote(suffix)
|
|
162
|
+
suffix = NamingStandardization.standardize_class_str(suffix)
|
|
163
|
+
if len(suffix) > 252:
|
|
164
|
+
suffix = suffix[:252]
|
|
165
|
+
return suffix
|
|
166
|
+
|
|
167
|
+
def _fix_property(self, property_: str) -> str:
|
|
168
|
+
if property_ in self._reserved_property_words:
|
|
169
|
+
return f"my{property_}"
|
|
170
|
+
property_ = urllib.parse.unquote(property_)
|
|
171
|
+
property_ = NamingStandardization.standardize_property_str(property_)
|
|
172
|
+
if len(property_) > 252:
|
|
173
|
+
property_ = property_[:252]
|
|
174
|
+
return property_
|
|
175
|
+
|
|
176
|
+
|
|
74
177
|
class ToCompliantEntities(VerifiedRulesTransformer[InformationRules, InformationRules]): # type: ignore[misc]
|
|
75
178
|
"""Converts input rules to rules with compliant entity IDs that match regex patters used
|
|
76
179
|
by DMS schema components."""
|
|
@@ -246,6 +349,116 @@ class PrefixEntities(ConversionTransformer): # type: ignore[type-var]
|
|
|
246
349
|
return entity
|
|
247
350
|
|
|
248
351
|
|
|
352
|
+
class StandardizeNaming(ConversionTransformer):
|
|
353
|
+
"""Sets views/classes/container names to PascalCase and properties to camelCase."""
|
|
354
|
+
|
|
355
|
+
@property
|
|
356
|
+
def description(self) -> str:
|
|
357
|
+
return "Sets views/classes/containers names to PascalCase and properties to camelCase."
|
|
358
|
+
|
|
359
|
+
@overload
|
|
360
|
+
def transform(self, rules: DMSRules) -> DMSRules: ...
|
|
361
|
+
|
|
362
|
+
@overload
|
|
363
|
+
def transform(self, rules: InformationRules) -> InformationRules: ...
|
|
364
|
+
|
|
365
|
+
def transform(self, rules: InformationRules | DMSRules) -> InformationRules | DMSRules:
|
|
366
|
+
output = rules.model_copy(deep=True)
|
|
367
|
+
if isinstance(output, InformationRules):
|
|
368
|
+
return self._standardize_information_rules(output)
|
|
369
|
+
elif isinstance(output, DMSRules):
|
|
370
|
+
return self._standardize_dms_rules(output)
|
|
371
|
+
raise NeatValueError(f"Unsupported rules type: {type(output)}")
|
|
372
|
+
|
|
373
|
+
def _standardize_information_rules(self, rules: InformationRules) -> InformationRules:
|
|
374
|
+
new_by_old_class_suffix: dict[str, str] = {}
|
|
375
|
+
for cls in rules.classes:
|
|
376
|
+
new_suffix = NamingStandardization.standardize_class_str(cls.class_.suffix)
|
|
377
|
+
new_by_old_class_suffix[cls.class_.suffix] = new_suffix
|
|
378
|
+
cls.class_.suffix = new_suffix
|
|
379
|
+
|
|
380
|
+
for cls in rules.classes:
|
|
381
|
+
if cls.implements:
|
|
382
|
+
for i, parent in enumerate(cls.implements):
|
|
383
|
+
if parent.suffix in new_by_old_class_suffix:
|
|
384
|
+
cls.implements[i].suffix = new_by_old_class_suffix[parent.suffix]
|
|
385
|
+
|
|
386
|
+
for prop in rules.properties:
|
|
387
|
+
prop.property_ = NamingStandardization.standardize_property_str(prop.property_)
|
|
388
|
+
if prop.class_.suffix in new_by_old_class_suffix:
|
|
389
|
+
prop.class_.suffix = new_by_old_class_suffix[prop.class_.suffix]
|
|
390
|
+
|
|
391
|
+
if isinstance(prop.value_type, ClassEntity) and prop.value_type.suffix in new_by_old_class_suffix:
|
|
392
|
+
prop.value_type.suffix = new_by_old_class_suffix[prop.value_type.suffix]
|
|
393
|
+
|
|
394
|
+
if isinstance(prop.value_type, MultiValueTypeInfo):
|
|
395
|
+
for i, value_type in enumerate(prop.value_type.types):
|
|
396
|
+
if isinstance(value_type, ClassEntity) and value_type.suffix in new_by_old_class_suffix:
|
|
397
|
+
prop.value_type.types[i].suffix = new_by_old_class_suffix[value_type.suffix] # type: ignore[union-attr]
|
|
398
|
+
|
|
399
|
+
return rules
|
|
400
|
+
|
|
401
|
+
def _standardize_dms_rules(self, rules: DMSRules) -> DMSRules:
|
|
402
|
+
new_by_old_view: dict[str, str] = {}
|
|
403
|
+
for view in rules.views:
|
|
404
|
+
new_suffix = NamingStandardization.standardize_class_str(view.view.suffix)
|
|
405
|
+
new_by_old_view[view.view.suffix] = new_suffix
|
|
406
|
+
view.view.suffix = new_suffix
|
|
407
|
+
new_by_old_container: dict[str, str] = {}
|
|
408
|
+
if rules.containers:
|
|
409
|
+
for container in rules.containers:
|
|
410
|
+
new_suffix = NamingStandardization.standardize_class_str(container.container.suffix)
|
|
411
|
+
new_by_old_container[container.container.suffix] = new_suffix
|
|
412
|
+
container.container.suffix = new_suffix
|
|
413
|
+
|
|
414
|
+
for view in rules.views:
|
|
415
|
+
if view.implements:
|
|
416
|
+
for i, parent in enumerate(view.implements):
|
|
417
|
+
if parent.suffix in new_by_old_view:
|
|
418
|
+
view.implements[i].suffix = new_by_old_view[parent.suffix]
|
|
419
|
+
if view.filter_ and isinstance(view.filter_, HasDataFilter) and view.filter_.inner:
|
|
420
|
+
for i, item in enumerate(view.filter_.inner):
|
|
421
|
+
if isinstance(item, ContainerEntity) and item.suffix in new_by_old_container:
|
|
422
|
+
view.filter_.inner[i].suffix = new_by_old_container[item.suffix]
|
|
423
|
+
if isinstance(item, ViewEntity) and item.suffix in new_by_old_view:
|
|
424
|
+
view.filter_.inner[i].suffix = new_by_old_view[item.suffix]
|
|
425
|
+
if rules.containers:
|
|
426
|
+
for container in rules.containers:
|
|
427
|
+
if container.constraint:
|
|
428
|
+
for i, constraint in enumerate(container.constraint):
|
|
429
|
+
if constraint.suffix in new_by_old_container:
|
|
430
|
+
container.constraint[i].suffix = new_by_old_container[constraint.suffix]
|
|
431
|
+
new_property_by_view_by_old_property: dict[ViewEntity, dict[str, str]] = defaultdict(dict)
|
|
432
|
+
for prop in rules.properties:
|
|
433
|
+
if prop.view.suffix in new_by_old_view:
|
|
434
|
+
prop.view.suffix = new_by_old_view[prop.view.suffix]
|
|
435
|
+
new_view_property = NamingStandardization.standardize_property_str(prop.view_property)
|
|
436
|
+
new_property_by_view_by_old_property[prop.view][prop.view_property] = new_view_property
|
|
437
|
+
prop.view_property = new_view_property
|
|
438
|
+
if isinstance(prop.value_type, ViewEntity) and prop.value_type.suffix in new_by_old_view:
|
|
439
|
+
prop.value_type.suffix = new_by_old_view[prop.value_type.suffix]
|
|
440
|
+
if (
|
|
441
|
+
isinstance(prop.connection, EdgeEntity)
|
|
442
|
+
and prop.connection.properties
|
|
443
|
+
and prop.connection.properties.suffix in new_by_old_view
|
|
444
|
+
):
|
|
445
|
+
prop.connection.properties.suffix = new_by_old_view[prop.connection.properties.suffix]
|
|
446
|
+
if isinstance(prop.container, ContainerEntity) and prop.container.suffix in new_by_old_container:
|
|
447
|
+
prop.container.suffix = new_by_old_container[prop.container.suffix]
|
|
448
|
+
if prop.container_property:
|
|
449
|
+
prop.container_property = NamingStandardization.standardize_property_str(prop.container_property)
|
|
450
|
+
for prop in rules.properties:
|
|
451
|
+
if (
|
|
452
|
+
isinstance(prop.connection, ReverseConnectionEntity)
|
|
453
|
+
and isinstance(prop.value_type, ViewEntity)
|
|
454
|
+
and prop.value_type in new_property_by_view_by_old_property
|
|
455
|
+
):
|
|
456
|
+
new_by_old_property = new_property_by_view_by_old_property[prop.value_type]
|
|
457
|
+
if prop.connection.property_ in new_by_old_property:
|
|
458
|
+
prop.connection.property_ = new_by_old_property[prop.connection.property_]
|
|
459
|
+
return rules
|
|
460
|
+
|
|
461
|
+
|
|
249
462
|
class InformationToDMS(ConversionTransformer[InformationRules, DMSRules]):
|
|
250
463
|
"""Converts InformationRules to DMSRules."""
|
|
251
464
|
|
|
@@ -339,13 +552,6 @@ class ToEnterpriseModel(ToExtensionModel):
|
|
|
339
552
|
self.move_connections = move_connections
|
|
340
553
|
|
|
341
554
|
def transform(self, rules: DMSRules) -> DMSRules:
|
|
342
|
-
reference_model_id = rules.metadata.as_data_model_id()
|
|
343
|
-
if reference_model_id not in COGNITE_MODELS:
|
|
344
|
-
warnings.warn(
|
|
345
|
-
EnterpriseModelNotBuildOnTopOfCDMWarning(reference_model_id=reference_model_id).as_message(),
|
|
346
|
-
stacklevel=2,
|
|
347
|
-
)
|
|
348
|
-
|
|
349
555
|
return self._to_enterprise(rules)
|
|
350
556
|
|
|
351
557
|
def _to_enterprise(self, reference_model: DMSRules) -> DMSRules:
|
|
@@ -565,12 +771,10 @@ class ToSolutionModel(ToExtensionModel):
|
|
|
565
771
|
renaming: dict[ViewEntity, ViewEntity] = {}
|
|
566
772
|
new_views = SheetList[DMSView]()
|
|
567
773
|
read_view_by_new_view: dict[ViewEntity, ViewEntity] = {}
|
|
568
|
-
skipped_views: set[ViewEntity] = set()
|
|
569
774
|
for ref_view in reference.views:
|
|
570
775
|
if (self.skip_cognite_views and ref_view.view.space in COGNITE_SPACES) or (
|
|
571
776
|
self.exclude_views_in_other_spaces and ref_view.view.space != reference.metadata.space
|
|
572
777
|
):
|
|
573
|
-
skipped_views.add(ref_view.view)
|
|
574
778
|
continue
|
|
575
779
|
new_entity = ViewEntity(
|
|
576
780
|
# MyPy we validate that version is string in the constructor
|
|
@@ -603,15 +807,17 @@ class ToSolutionModel(ToExtensionModel):
|
|
|
603
807
|
new_views.append(ref_view.model_copy(deep=True, update={"implements": None, "view": new_entity}))
|
|
604
808
|
|
|
605
809
|
new_properties = SheetList[DMSProperty]()
|
|
810
|
+
new_view_entities = {view.view for view in new_views}
|
|
606
811
|
for prop in reference.properties:
|
|
607
|
-
if prop.view in skipped_views:
|
|
608
|
-
continue
|
|
609
812
|
new_property = prop.model_copy(deep=True)
|
|
610
813
|
if new_property.value_type in renaming and isinstance(new_property.value_type, ViewEntity):
|
|
611
814
|
new_property.value_type = renaming[new_property.value_type]
|
|
612
815
|
if new_property.view in renaming:
|
|
613
816
|
new_property.view = renaming[new_property.view]
|
|
614
|
-
|
|
817
|
+
if new_property.view in new_view_entities and (
|
|
818
|
+
not isinstance(new_property.value_type, ViewEntity) or new_property.value_type in new_view_entities
|
|
819
|
+
):
|
|
820
|
+
new_properties.append(new_property)
|
|
615
821
|
return new_views, new_properties, read_view_by_new_view
|
|
616
822
|
|
|
617
823
|
def _create_containers_update_view_filter(
|
|
@@ -16,6 +16,7 @@ from cognite.neat._rules.transformers import (
|
|
|
16
16
|
InformationToDMS,
|
|
17
17
|
MergeDMSRules,
|
|
18
18
|
MergeInformationRules,
|
|
19
|
+
ToInformationCompliantEntities,
|
|
19
20
|
VerifyInformationRules,
|
|
20
21
|
)
|
|
21
22
|
from cognite.neat._store._rules_store import RulesEntity
|
|
@@ -235,13 +236,19 @@ class NeatSession:
|
|
|
235
236
|
|
|
236
237
|
def action() -> tuple[InformationRules, DMSRules | None]:
|
|
237
238
|
unverified_information = importer.to_rules()
|
|
239
|
+
unverified_information = ToInformationCompliantEntities(renaming="warning").transform(
|
|
240
|
+
unverified_information
|
|
241
|
+
)
|
|
242
|
+
|
|
238
243
|
extra_info = VerifyInformationRules().transform(unverified_information)
|
|
239
244
|
if not last_entity:
|
|
240
245
|
return extra_info, None
|
|
241
246
|
merged_info = MergeInformationRules(extra_info).transform(last_entity.information)
|
|
242
247
|
if not last_entity.dms:
|
|
243
248
|
return merged_info, None
|
|
249
|
+
|
|
244
250
|
extra_dms = InformationToDMS(reserved_properties="warning").transform(extra_info)
|
|
251
|
+
|
|
245
252
|
merged_dms = MergeDMSRules(extra_dms).transform(last_entity.dms)
|
|
246
253
|
return merged_info, merged_dms
|
|
247
254
|
|