cognite-neat 0.115.0__tar.gz → 0.116.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.115.0 → cognite_neat-0.116.0}/PKG-INFO +1 -1
- cognite_neat-0.116.0/cognite/neat/_alpha.py +24 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_constants.py +73 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/transformers/_converters.py +72 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_base.py +3 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_create.py +4 -11
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_prepare.py +3 -3
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_read.py +109 -14
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_state.py +14 -2
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_subset.py +2 -2
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_to.py +3 -3
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/exceptions.py +2 -2
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_store/_rules_store.py +21 -0
- cognite_neat-0.116.0/cognite/neat/_version.py +2 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/pyproject.toml +1 -1
- cognite_neat-0.115.0/cognite/neat/_alpha.py +0 -23
- cognite_neat-0.115.0/cognite/neat/_version.py +0 -2
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/LICENSE +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/README.md +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/_api/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/_api/data_modeling_loaders.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/_api/schema.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/_api_client.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/data_classes/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/data_classes/data_modeling.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/data_classes/neat_sequence.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/data_classes/schema.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_client/testing.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_config.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/_shared.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/_tracking/base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/_tracking/log.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/examples/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_dict.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_dms.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_dms_graph.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_iodd.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_raw.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/loaders/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/loaders/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/loaders/_rdf2dms.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/queries/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/queries/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/transformers/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/transformers/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/transformers/_iodd.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/transformers/_prune_graph.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_graph/transformers/_value_type.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/_contextmanagers.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/_factory.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/errors/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/errors/_external.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/errors/_general.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/errors/_properties.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/errors/_resources.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/errors/_wrapper.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/formatters.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/warnings/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/warnings/_external.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/warnings/_general.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/warnings/_models.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/warnings/_properties.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/warnings/_resources.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/_constants.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/_shared.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/analysis/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/analysis/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/catalog/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/catalog/classic_model.xlsx +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/catalog/hello_world_pump.xlsx +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/exporters/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/exporters/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/exporters/_rules2instance_template.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/exporters/_validation.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_rdf/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_rdf/_imf2rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_rdf/_owl2rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/_base_input.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/_base_rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/_types.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/data_types.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/entities/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/entities/_constants.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/entities/_single_value.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/entities/_types.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/entities/_wrapped.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/information/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/information/_rules.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/information/_validation.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/models/mapping/_classic2core.yaml +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/transformers/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/transformers/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/transformers/_mapping.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/transformers/_verification.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_collector.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_drop.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_explore.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_fix.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_inspect.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_mapping.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_set.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_show.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/_wizard.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/engine/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/engine/_import.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/engine/_interface.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_session/engine/_load.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_store/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_store/_graph_store.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_store/_provenance.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_store/exceptions.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/auth.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/auxiliary.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/collection_.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/graph_transformations_report.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/io_.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/rdf_.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/reader/__init__.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/reader/_base.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/spreadsheet.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/text.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/time_.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/upload.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_utils/xml_.py +0 -0
- {cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/py.typed +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ExperimentalFeatureWarning(UserWarning):
|
|
5
|
+
def __init__(self, feature_name: str):
|
|
6
|
+
super().__init__(f"Experimental feature '{feature_name}' is subject to change without notice")
|
|
7
|
+
|
|
8
|
+
def warn(self) -> None:
|
|
9
|
+
warnings.warn(self, stacklevel=2)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ExperimentalFlags:
|
|
13
|
+
manual_rules_edit = ExperimentalFeatureWarning("enable_manual_edit")
|
|
14
|
+
same_space_properties_only_export = ExperimentalFeatureWarning("same-space-properties-only")
|
|
15
|
+
standardize_naming = ExperimentalFeatureWarning("standardize_naming")
|
|
16
|
+
standardize_space_and_version = ExperimentalFeatureWarning("standardize_space_and_version")
|
|
17
|
+
data_model_subsetting = ExperimentalFeatureWarning("data_model_subsetting")
|
|
18
|
+
core_data_model_subsetting = ExperimentalFeatureWarning("core_data_model_subsetting")
|
|
19
|
+
ontology_read = ExperimentalFeatureWarning("ontology_read")
|
|
20
|
+
imf_read = ExperimentalFeatureWarning("imf_read")
|
|
21
|
+
dexpi_read = ExperimentalFeatureWarning("dexpi_read")
|
|
22
|
+
aml_read = ExperimentalFeatureWarning("aml_read")
|
|
23
|
+
csv_read = ExperimentalFeatureWarning("csv_read")
|
|
24
|
+
to_ontology = ExperimentalFeatureWarning("to_ontology")
|
|
@@ -64,6 +64,79 @@ COGNITE_SPACES = frozenset(
|
|
|
64
64
|
"cdf_units",
|
|
65
65
|
}
|
|
66
66
|
)
|
|
67
|
+
|
|
68
|
+
COGNITE_CORE_CONCEPTS = frozenset(
|
|
69
|
+
{
|
|
70
|
+
"CogniteFile",
|
|
71
|
+
"CogniteCubeMap",
|
|
72
|
+
"CogniteCADRevision",
|
|
73
|
+
"CognitePointCloudVolume",
|
|
74
|
+
"Cognite360ImageAnnotation",
|
|
75
|
+
"CogniteAnnotation",
|
|
76
|
+
"CogniteUnit",
|
|
77
|
+
"CogniteAsset",
|
|
78
|
+
"Cognite3DObject",
|
|
79
|
+
"Cognite3DRevision",
|
|
80
|
+
"Cognite360Image",
|
|
81
|
+
"CogniteDiagramAnnotation",
|
|
82
|
+
"Cognite360ImageCollection",
|
|
83
|
+
"Cognite360ImageStation",
|
|
84
|
+
"CognitePointCloudModel",
|
|
85
|
+
"CogniteTimeSeries",
|
|
86
|
+
"Cognite3DTransformation",
|
|
87
|
+
"CogniteEquipment",
|
|
88
|
+
"Cognite360ImageModel",
|
|
89
|
+
"CogniteAssetClass",
|
|
90
|
+
"CogniteAssetType",
|
|
91
|
+
"CogniteEquipmentType",
|
|
92
|
+
"Cognite3DModel",
|
|
93
|
+
"CogniteCADModel",
|
|
94
|
+
"CognitePointCloudRevision",
|
|
95
|
+
"CogniteCADNode",
|
|
96
|
+
"CogniteFileCategory",
|
|
97
|
+
"CogniteActivity",
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
COGNITE_CORE_FEATURES = frozenset(
|
|
103
|
+
{
|
|
104
|
+
"CogniteDescribable",
|
|
105
|
+
"CogniteSourceable",
|
|
106
|
+
"CogniteSourceSystem",
|
|
107
|
+
"CogniteSchedulable",
|
|
108
|
+
"CogniteVisualizable",
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
COGNITE_3D_CONCEPTS = frozenset(
|
|
113
|
+
{
|
|
114
|
+
"Cognite3DModel",
|
|
115
|
+
"Cognite3DObject",
|
|
116
|
+
"Cognite3DRevision",
|
|
117
|
+
"Cognite3DTransformation",
|
|
118
|
+
"Cognite360Image",
|
|
119
|
+
"Cognite360ImageAnnotation",
|
|
120
|
+
"Cognite360ImageCollection",
|
|
121
|
+
"Cognite360ImageModel",
|
|
122
|
+
"Cognite360ImageStation",
|
|
123
|
+
"CogniteCADModel",
|
|
124
|
+
"CogniteCADNode",
|
|
125
|
+
"CogniteCADRevision",
|
|
126
|
+
"CogniteCubeMap",
|
|
127
|
+
"CognitePointCloudModel",
|
|
128
|
+
"CognitePointCloudRevision",
|
|
129
|
+
"CognitePointCloudVolume",
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
COGNITE_ANNOTATION = frozenset(
|
|
134
|
+
{
|
|
135
|
+
"CogniteAnnotation",
|
|
136
|
+
"CogniteDiagramAnnotation",
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
|
|
67
140
|
DMS_LISTABLE_PROPERTY_LIMIT = 1000
|
|
68
141
|
|
|
69
142
|
EXAMPLE_RULES = PACKAGE_DIRECTORY / "_rules" / "examples"
|
{cognite_neat-0.115.0 → cognite_neat-0.116.0}/cognite/neat/_rules/transformers/_converters.py
RENAMED
|
@@ -17,6 +17,8 @@ from rdflib import Namespace
|
|
|
17
17
|
from cognite.neat._client import NeatClient
|
|
18
18
|
from cognite.neat._client.data_classes.data_modeling import ContainerApplyDict, ViewApplyDict
|
|
19
19
|
from cognite.neat._constants import (
|
|
20
|
+
COGNITE_CORE_CONCEPTS,
|
|
21
|
+
COGNITE_CORE_FEATURES,
|
|
20
22
|
COGNITE_MODELS,
|
|
21
23
|
COGNITE_SPACES,
|
|
22
24
|
DMS_CONTAINER_PROPERTY_SIZE_LIMIT,
|
|
@@ -1802,6 +1804,76 @@ class _DMSRulesConverter:
|
|
|
1802
1804
|
)
|
|
1803
1805
|
|
|
1804
1806
|
|
|
1807
|
+
class _SubsetEditableCDMRules(VerifiedRulesTransformer[DMSRules, DMSRules]):
|
|
1808
|
+
"""Subsets editable CDM rules to only include desired set of CDM concepts.
|
|
1809
|
+
|
|
1810
|
+
!!! note "Platypus UI limitations"
|
|
1811
|
+
This is temporal solution to enable cleaner extension of core data model,
|
|
1812
|
+
assuring that Platypus UI will work correctly, including Data Model Editor,
|
|
1813
|
+
Query Explorer and Search.
|
|
1814
|
+
"""
|
|
1815
|
+
|
|
1816
|
+
def __init__(self, views: set[ViewEntity]):
|
|
1817
|
+
if not_in_cognite_core := {view.external_id for view in views} - COGNITE_CORE_CONCEPTS.union(
|
|
1818
|
+
COGNITE_CORE_FEATURES
|
|
1819
|
+
):
|
|
1820
|
+
raise NeatValueError(
|
|
1821
|
+
f"Concept(s) {', '.join(not_in_cognite_core)} is/are not part of the Cognite Core Data Model. Aborting."
|
|
1822
|
+
)
|
|
1823
|
+
|
|
1824
|
+
self._views = views
|
|
1825
|
+
|
|
1826
|
+
def transform(self, rules: DMSRules) -> DMSRules:
|
|
1827
|
+
# should check to make sure data model is based on the editable CDM
|
|
1828
|
+
# if not raise an error
|
|
1829
|
+
|
|
1830
|
+
subsetted_rules: dict[str, Any] = {
|
|
1831
|
+
"metadata": rules.metadata.model_copy(),
|
|
1832
|
+
"views": SheetList[DMSView](),
|
|
1833
|
+
"properties": SheetList[DMSProperty](),
|
|
1834
|
+
"containers": SheetList[DMSContainer](),
|
|
1835
|
+
"enum": rules.enum,
|
|
1836
|
+
"nodes": rules.nodes,
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
containers_to_keep = set()
|
|
1840
|
+
|
|
1841
|
+
if editable_views_to_keep := self._editable_views_to_keep(rules):
|
|
1842
|
+
for view in rules.views:
|
|
1843
|
+
if view.view in editable_views_to_keep or view.view.space in COGNITE_SPACES:
|
|
1844
|
+
subsetted_rules["views"].append(view)
|
|
1845
|
+
|
|
1846
|
+
for property_ in rules.properties:
|
|
1847
|
+
if property_.view in editable_views_to_keep and (
|
|
1848
|
+
isinstance(property_.value_type, DataType)
|
|
1849
|
+
or isinstance(property_.value_type, DMSUnknownEntity)
|
|
1850
|
+
or (isinstance(property_.value_type, ViewEntity) and property_.value_type in editable_views_to_keep)
|
|
1851
|
+
):
|
|
1852
|
+
subsetted_rules["properties"].append(property_)
|
|
1853
|
+
if property_.container:
|
|
1854
|
+
containers_to_keep.add(property_.container)
|
|
1855
|
+
|
|
1856
|
+
if rules.containers:
|
|
1857
|
+
for container in rules.containers:
|
|
1858
|
+
if container.container in containers_to_keep:
|
|
1859
|
+
subsetted_rules["containers"].append(container)
|
|
1860
|
+
try:
|
|
1861
|
+
return DMSRules.model_validate(subsetted_rules)
|
|
1862
|
+
except ValidationError as e:
|
|
1863
|
+
raise NeatValueError(f"Cannot subset rules: {e}") from e
|
|
1864
|
+
else:
|
|
1865
|
+
raise NeatValueError("Cannot subset rules: provided data model is not based on Core Data Model")
|
|
1866
|
+
|
|
1867
|
+
def _editable_views_to_keep(self, rules: DMSRules) -> set[ViewEntity]:
|
|
1868
|
+
return {
|
|
1869
|
+
view.view
|
|
1870
|
+
for view in rules.views
|
|
1871
|
+
if view.view.space not in COGNITE_SPACES
|
|
1872
|
+
and view.implements
|
|
1873
|
+
and any(implemented in self._views for implemented in view.implements)
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
|
|
1805
1877
|
class SubsetDMSRules(VerifiedRulesTransformer[DMSRules, DMSRules]):
|
|
1806
1878
|
"""Subsets DMSRules to only include the specified views."""
|
|
1807
1879
|
|
|
@@ -165,6 +165,9 @@ class NeatSession:
|
|
|
165
165
|
neat.convert()
|
|
166
166
|
```
|
|
167
167
|
"""
|
|
168
|
+
self._state._raise_exception_if_condition_not_met(
|
|
169
|
+
"Convert to physical", has_dms_rules=False, has_information_rules=True
|
|
170
|
+
)
|
|
168
171
|
converter = InformationToDMS(reserved_properties=reserved_properties)
|
|
169
172
|
|
|
170
173
|
issues = self._state.rule_transform(converter)
|
|
@@ -3,7 +3,6 @@ from typing import Literal
|
|
|
3
3
|
from cognite.client.data_classes.data_modeling import DataModelIdentifier
|
|
4
4
|
|
|
5
5
|
from cognite.neat._issues import IssueList
|
|
6
|
-
from cognite.neat._rules.models import DMSRules, InformationRules
|
|
7
6
|
from cognite.neat._rules.models.dms import DMSValidation
|
|
8
7
|
from cognite.neat._rules.transformers import (
|
|
9
8
|
IncludeReferenced,
|
|
@@ -29,7 +28,7 @@ class CreateAPI:
|
|
|
29
28
|
def enterprise_model(
|
|
30
29
|
self,
|
|
31
30
|
data_model_id: DataModelIdentifier,
|
|
32
|
-
org_name: str = "
|
|
31
|
+
org_name: str = "CopyOf",
|
|
33
32
|
dummy_property: str = "GUID",
|
|
34
33
|
) -> IssueList:
|
|
35
34
|
"""Uses the current data model as a basis to create enterprise data model
|
|
@@ -58,7 +57,7 @@ class CreateAPI:
|
|
|
58
57
|
- Charts
|
|
59
58
|
|
|
60
59
|
"""
|
|
61
|
-
last_rules = self.
|
|
60
|
+
last_rules = self._state.rule_store.last_verified_rules
|
|
62
61
|
issues = self._state.rule_transform(
|
|
63
62
|
ToEnterpriseModel(
|
|
64
63
|
new_model_id=data_model_id,
|
|
@@ -71,12 +70,6 @@ class CreateAPI:
|
|
|
71
70
|
self._state.last_reference = last_rules
|
|
72
71
|
return issues
|
|
73
72
|
|
|
74
|
-
def _get_last_rules(self) -> InformationRules | DMSRules | None:
|
|
75
|
-
if not self._state.rule_store.provenance:
|
|
76
|
-
return None
|
|
77
|
-
last_entity = self._state.rule_store.provenance[-1].target_entity
|
|
78
|
-
return last_entity.dms or last_entity.information
|
|
79
|
-
|
|
80
73
|
def solution_model(
|
|
81
74
|
self,
|
|
82
75
|
data_model_id: DataModelIdentifier,
|
|
@@ -110,7 +103,7 @@ class CreateAPI:
|
|
|
110
103
|
the containers in the solution data model space.
|
|
111
104
|
|
|
112
105
|
"""
|
|
113
|
-
last_rules = self.
|
|
106
|
+
last_rules = self._state.rule_store.last_verified_rules
|
|
114
107
|
issues = self._state.rule_transform(
|
|
115
108
|
ToSolutionModel(
|
|
116
109
|
new_model_id=data_model_id,
|
|
@@ -144,7 +137,7 @@ class CreateAPI:
|
|
|
144
137
|
If you set same-space, only the properties of the views in the same space as the data model
|
|
145
138
|
will be included.
|
|
146
139
|
"""
|
|
147
|
-
last_rules = self.
|
|
140
|
+
last_rules = self._state.rule_store.last_verified_rules
|
|
148
141
|
view_ids, container_ids = DMSValidation(
|
|
149
142
|
self._state.rule_store.last_verified_dms_rules
|
|
150
143
|
).imported_views_and_containers_ids()
|
|
@@ -4,7 +4,7 @@ from typing import Any
|
|
|
4
4
|
|
|
5
5
|
from rdflib import URIRef
|
|
6
6
|
|
|
7
|
-
from cognite.neat._alpha import
|
|
7
|
+
from cognite.neat._alpha import ExperimentalFlags
|
|
8
8
|
from cognite.neat._graph.transformers import (
|
|
9
9
|
ConnectionToLiteral,
|
|
10
10
|
ConvertLiteral,
|
|
@@ -273,7 +273,7 @@ class DataModelPrepareAPI:
|
|
|
273
273
|
For properties, the naming will be standardized to camelCase.
|
|
274
274
|
"""
|
|
275
275
|
warnings.filterwarnings("default")
|
|
276
|
-
|
|
276
|
+
ExperimentalFlags.standardize_naming.warn()
|
|
277
277
|
return self._state.rule_transform(StandardizeNaming())
|
|
278
278
|
|
|
279
279
|
def standardize_space_and_version(self) -> IssueList:
|
|
@@ -282,5 +282,5 @@ class DataModelPrepareAPI:
|
|
|
282
282
|
This method will standardize the space and version in the data model to the Cognite standard.
|
|
283
283
|
"""
|
|
284
284
|
warnings.filterwarnings("default")
|
|
285
|
-
|
|
285
|
+
ExperimentalFlags.standardize_space_and_version.warn()
|
|
286
286
|
return self._state.rule_transform(StandardizeSpaceAndVersion())
|
|
@@ -4,7 +4,7 @@ from typing import Any, Literal, cast
|
|
|
4
4
|
from cognite.client.data_classes.data_modeling import DataModelId, DataModelIdentifier
|
|
5
5
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
6
6
|
|
|
7
|
-
from cognite.neat._alpha import
|
|
7
|
+
from cognite.neat._alpha import ExperimentalFlags
|
|
8
8
|
from cognite.neat._client import NeatClient
|
|
9
9
|
from cognite.neat._constants import (
|
|
10
10
|
CLASSIC_CDF_NAMESPACE,
|
|
@@ -28,7 +28,12 @@ from cognite.neat._issues.errors import NeatValueError
|
|
|
28
28
|
from cognite.neat._issues.warnings import MissingCogniteClientWarning
|
|
29
29
|
from cognite.neat._rules import catalog, importers
|
|
30
30
|
from cognite.neat._rules.importers import BaseImporter
|
|
31
|
+
from cognite.neat._rules.models.entities._single_value import ViewEntity
|
|
31
32
|
from cognite.neat._rules.transformers import ClassicPrepareCore
|
|
33
|
+
from cognite.neat._rules.transformers._converters import (
|
|
34
|
+
ToEnterpriseModel,
|
|
35
|
+
_SubsetEditableCDMRules,
|
|
36
|
+
)
|
|
32
37
|
from cognite.neat._utils.reader import NeatReader
|
|
33
38
|
|
|
34
39
|
from ._state import SessionState
|
|
@@ -114,6 +119,86 @@ class CDFReadAPI(BaseReadAPI):
|
|
|
114
119
|
importer = importers.DMSImporter.from_data_model_id(cast(NeatClient, self._state.client), data_model_id)
|
|
115
120
|
return self._state.rule_import(importer)
|
|
116
121
|
|
|
122
|
+
def core_data_model(self, concepts: str | list[str]) -> IssueList:
|
|
123
|
+
"""Subset the data model to the desired concepts.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
concepts: The concepts to subset the data model to
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
IssueList: A list of issues that occurred during the transformation.
|
|
130
|
+
|
|
131
|
+
Example:
|
|
132
|
+
Read the CogniteCore data model and reduce the data model to only the 'CogniteAsset' concept.
|
|
133
|
+
```python
|
|
134
|
+
neat = NeatSession(CogniteClient())
|
|
135
|
+
|
|
136
|
+
neat.subset.data_model.core_data_model(concepts=["CogniteAsset", "CogniteEquipment"])
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
!!! note "Bundle of actions"
|
|
140
|
+
This method is a helper method that bundles the following actions:
|
|
141
|
+
- Imports the latest version of Cognite's Core Data Model (CDM)
|
|
142
|
+
- Makes editable copy of the CDM concepts
|
|
143
|
+
- Subsets the copy to the desired concepts to desired set of concepts
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
concepts = concepts if isinstance(concepts, list | set) else [concepts]
|
|
147
|
+
|
|
148
|
+
self._state._raise_exception_if_condition_not_met(
|
|
149
|
+
"Subset Core Data Model",
|
|
150
|
+
empty_rules_store_required=True,
|
|
151
|
+
client_required=True,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
warnings.filterwarnings("default")
|
|
155
|
+
ExperimentalFlags.core_data_model_subsetting.warn()
|
|
156
|
+
|
|
157
|
+
cdm_v1 = DataModelId.load(("cdf_cdm", "CogniteCore", "v1"))
|
|
158
|
+
importer: importers.DMSImporter = importers.DMSImporter.from_data_model_id(
|
|
159
|
+
cast(NeatClient, self._state.client), cdm_v1
|
|
160
|
+
)
|
|
161
|
+
issues = self._state.rule_import(importer)
|
|
162
|
+
|
|
163
|
+
if issues.has_errors:
|
|
164
|
+
return issues
|
|
165
|
+
|
|
166
|
+
cdm_rules = self._state.rule_store.last_verified_rules
|
|
167
|
+
|
|
168
|
+
issues.extend(
|
|
169
|
+
self._state.rule_transform(
|
|
170
|
+
ToEnterpriseModel(
|
|
171
|
+
new_model_id=("my_space", "MyCDMSubset", "v1"),
|
|
172
|
+
org_name="CopyOf",
|
|
173
|
+
dummy_property="GUID",
|
|
174
|
+
move_connections=True,
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
if issues.has_errors:
|
|
180
|
+
return issues
|
|
181
|
+
|
|
182
|
+
issues.extend(
|
|
183
|
+
self._state.rule_transform(
|
|
184
|
+
_SubsetEditableCDMRules(
|
|
185
|
+
views={
|
|
186
|
+
ViewEntity(
|
|
187
|
+
space=cdm_v1.space,
|
|
188
|
+
externalId=concept,
|
|
189
|
+
version=cast(str, cdm_v1.version),
|
|
190
|
+
)
|
|
191
|
+
for concept in concepts
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
if cdm_rules and not issues.has_errors:
|
|
198
|
+
self._state.last_reference = cdm_rules
|
|
199
|
+
|
|
200
|
+
return issues
|
|
201
|
+
|
|
117
202
|
def graph(
|
|
118
203
|
self,
|
|
119
204
|
data_model_id: DataModelIdentifier,
|
|
@@ -361,7 +446,12 @@ class ExcelReadAPI(BaseReadAPI):
|
|
|
361
446
|
|
|
362
447
|
if enable_manual_edit:
|
|
363
448
|
warnings.filterwarnings("default")
|
|
364
|
-
|
|
449
|
+
ExperimentalFlags.manual_rules_edit.warn()
|
|
450
|
+
else:
|
|
451
|
+
self._state._raise_exception_if_condition_not_met(
|
|
452
|
+
"Read Excel Rules",
|
|
453
|
+
empty_rules_store_required=True,
|
|
454
|
+
)
|
|
365
455
|
|
|
366
456
|
return self._state.rule_import(importers.ExcelImporter(path), enable_manual_edit)
|
|
367
457
|
|
|
@@ -381,6 +471,10 @@ class YamlReadAPI(BaseReadAPI):
|
|
|
381
471
|
neat.read.yaml("path_to_toolkit_yamls")
|
|
382
472
|
```
|
|
383
473
|
"""
|
|
474
|
+
self._state._raise_exception_if_condition_not_met(
|
|
475
|
+
"Read YAML data model",
|
|
476
|
+
empty_rules_store_required=True,
|
|
477
|
+
)
|
|
384
478
|
reader = NeatReader.create(io)
|
|
385
479
|
path = reader.materialize_path()
|
|
386
480
|
importer: BaseImporter
|
|
@@ -421,7 +515,7 @@ class CSVReadAPI(BaseReadAPI):
|
|
|
421
515
|
|
|
422
516
|
def __call__(self, io: Any, type: str, primary_key: str) -> None:
|
|
423
517
|
warnings.filterwarnings("default")
|
|
424
|
-
|
|
518
|
+
ExperimentalFlags.csv_read.warn()
|
|
425
519
|
|
|
426
520
|
engine = import_engine()
|
|
427
521
|
engine.set.format = "csv"
|
|
@@ -479,7 +573,7 @@ class XMLReadAPI(BaseReadAPI):
|
|
|
479
573
|
- remove edges to nodes that do not exist in the extracted graph
|
|
480
574
|
"""
|
|
481
575
|
warnings.filterwarnings("default")
|
|
482
|
-
|
|
576
|
+
ExperimentalFlags.dexpi_read.warn()
|
|
483
577
|
|
|
484
578
|
self._state._raise_exception_if_condition_not_met(
|
|
485
579
|
"Read DEXPI file",
|
|
@@ -539,7 +633,7 @@ class XMLReadAPI(BaseReadAPI):
|
|
|
539
633
|
- remove edges to nodes that do not exist in the extracted graph
|
|
540
634
|
"""
|
|
541
635
|
warnings.filterwarnings("default")
|
|
542
|
-
|
|
636
|
+
ExperimentalFlags.aml_read.warn()
|
|
543
637
|
|
|
544
638
|
self._state._raise_exception_if_condition_not_met(
|
|
545
639
|
"Read AML file",
|
|
@@ -599,7 +693,7 @@ class RDFReadAPI(BaseReadAPI):
|
|
|
599
693
|
```
|
|
600
694
|
"""
|
|
601
695
|
warnings.filterwarnings("default")
|
|
602
|
-
|
|
696
|
+
ExperimentalFlags.ontology_read.warn()
|
|
603
697
|
|
|
604
698
|
self._state._raise_exception_if_condition_not_met(
|
|
605
699
|
"Read Ontology file",
|
|
@@ -622,7 +716,7 @@ class RDFReadAPI(BaseReadAPI):
|
|
|
622
716
|
```
|
|
623
717
|
"""
|
|
624
718
|
warnings.filterwarnings("default")
|
|
625
|
-
|
|
719
|
+
ExperimentalFlags.imf_read.warn()
|
|
626
720
|
|
|
627
721
|
self._state._raise_exception_if_condition_not_met(
|
|
628
722
|
"Read IMF file",
|
|
@@ -634,6 +728,10 @@ class RDFReadAPI(BaseReadAPI):
|
|
|
634
728
|
return self._state.rule_import(importer)
|
|
635
729
|
|
|
636
730
|
def instances(self, io: Any) -> IssueList:
|
|
731
|
+
self._state._raise_exception_if_condition_not_met(
|
|
732
|
+
"Read RDF Instances",
|
|
733
|
+
empty_rules_store_required=True,
|
|
734
|
+
)
|
|
637
735
|
reader = NeatReader.create(io)
|
|
638
736
|
self._state.instances.store.write(extractors.RdfFileExtractor(reader.materialize_path()))
|
|
639
737
|
return IssueList()
|
|
@@ -674,12 +772,6 @@ class Examples:
|
|
|
674
772
|
def __init__(self, state: SessionState) -> None:
|
|
675
773
|
self._state = state
|
|
676
774
|
|
|
677
|
-
@property
|
|
678
|
-
def _get_client(self) -> NeatClient:
|
|
679
|
-
if self._state.client is None:
|
|
680
|
-
raise NeatValueError("No client provided. Please provide a client to read a data model.")
|
|
681
|
-
return self._state.client
|
|
682
|
-
|
|
683
775
|
def nordic44(self) -> IssueList:
|
|
684
776
|
"""Reads the Nordic 44 knowledge graph into the NeatSession graph store."""
|
|
685
777
|
|
|
@@ -709,8 +801,11 @@ class Examples:
|
|
|
709
801
|
self._state._raise_exception_if_condition_not_met(
|
|
710
802
|
"Read Core Data Model example",
|
|
711
803
|
empty_rules_store_required=True,
|
|
804
|
+
client_required=True,
|
|
712
805
|
)
|
|
713
806
|
|
|
714
807
|
cdm_v1 = DataModelId.load(("cdf_cdm", "CogniteCore", "v1"))
|
|
715
|
-
importer: importers.DMSImporter = importers.DMSImporter.from_data_model_id(
|
|
808
|
+
importer: importers.DMSImporter = importers.DMSImporter.from_data_model_id(
|
|
809
|
+
cast(NeatClient, self._state.client), cdm_v1
|
|
810
|
+
)
|
|
716
811
|
return self._state.rule_import(importer)
|
|
@@ -71,14 +71,23 @@ class SessionState:
|
|
|
71
71
|
empty_instances_store_required: bool = False,
|
|
72
72
|
instances_required: bool = False,
|
|
73
73
|
client_required: bool = False,
|
|
74
|
+
has_information_rules: bool | None = None,
|
|
75
|
+
has_dms_rules: bool | None = None,
|
|
74
76
|
) -> None:
|
|
75
77
|
"""Set conditions for raising an error in the session that are used by various methods in the session."""
|
|
76
78
|
condition = set()
|
|
77
79
|
suggestion = set()
|
|
78
|
-
|
|
80
|
+
try_again = True
|
|
79
81
|
if client_required and not self.client:
|
|
80
82
|
condition.add(f"{activity} expects a client in NEAT session")
|
|
81
83
|
suggestion.add("Please provide a client")
|
|
84
|
+
if has_information_rules is True and self.rule_store.try_get_last_information_rules is None:
|
|
85
|
+
condition.add(f"{activity} expects information rules in NEAT session")
|
|
86
|
+
suggestion.add("Read in information rules to neat session")
|
|
87
|
+
if has_dms_rules is False and self.rule_store.try_get_last_dms_rules is not None:
|
|
88
|
+
condition.add(f"{activity} expects no DMS data model in NEAT session")
|
|
89
|
+
suggestion.add("You already have a DMS data model in the session")
|
|
90
|
+
try_again = False
|
|
82
91
|
if empty_rules_store_required and not self.rule_store.empty:
|
|
83
92
|
condition.add(f"{activity} expects no data model in NEAT session")
|
|
84
93
|
suggestion.add("Start new session")
|
|
@@ -90,7 +99,10 @@ class SessionState:
|
|
|
90
99
|
suggestion.add("Read in instances to neat session")
|
|
91
100
|
|
|
92
101
|
if condition:
|
|
93
|
-
|
|
102
|
+
message = ". ".join(condition) + ". " + ". ".join(suggestion) + "."
|
|
103
|
+
if try_again:
|
|
104
|
+
message += " And try again."
|
|
105
|
+
raise NeatSessionError(message)
|
|
94
106
|
|
|
95
107
|
|
|
96
108
|
class InstancesState:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import warnings
|
|
2
2
|
|
|
3
|
-
from cognite.neat._alpha import
|
|
3
|
+
from cognite.neat._alpha import ExperimentalFlags
|
|
4
4
|
from cognite.neat._issues._base import IssueList
|
|
5
5
|
from cognite.neat._rules.models.entities._single_value import ClassEntity, ViewEntity
|
|
6
6
|
from cognite.neat._rules.transformers import SubsetDMSRules, SubsetInformationRules
|
|
@@ -47,7 +47,7 @@ class SubsetAPI:
|
|
|
47
47
|
raise NeatSessionError("No rules to set the data model ID.")
|
|
48
48
|
|
|
49
49
|
warnings.filterwarnings("default")
|
|
50
|
-
|
|
50
|
+
ExperimentalFlags.data_model_subsetting.warn()
|
|
51
51
|
|
|
52
52
|
dms = self._state.rule_store.provenance[-1].target_entity.dms
|
|
53
53
|
information = self._state.rule_store.provenance[-1].target_entity.information
|
|
@@ -7,7 +7,7 @@ from typing import Any, Literal, cast, overload
|
|
|
7
7
|
from cognite.client import data_modeling as dm
|
|
8
8
|
from cognite.client.data_classes.data_modeling import DataModelIdentifier
|
|
9
9
|
|
|
10
|
-
from cognite.neat._alpha import
|
|
10
|
+
from cognite.neat._alpha import ExperimentalFlags
|
|
11
11
|
from cognite.neat._client._api_client import NeatClient
|
|
12
12
|
from cognite.neat._constants import COGNITE_MODELS
|
|
13
13
|
from cognite.neat._graph import loaders
|
|
@@ -52,7 +52,7 @@ class ToAPI:
|
|
|
52
52
|
```
|
|
53
53
|
"""
|
|
54
54
|
warnings.filterwarnings("default")
|
|
55
|
-
|
|
55
|
+
ExperimentalFlags.to_ontology.warn()
|
|
56
56
|
|
|
57
57
|
filepath = Path(io)
|
|
58
58
|
if filepath.suffix != ".ttl":
|
|
@@ -145,7 +145,7 @@ class ToAPI:
|
|
|
145
145
|
|
|
146
146
|
if include_properties == "same-space":
|
|
147
147
|
warnings.filterwarnings("default")
|
|
148
|
-
|
|
148
|
+
ExperimentalFlags.same_space_properties_only_export.warn()
|
|
149
149
|
|
|
150
150
|
exporter = exporters.ExcelExporter(
|
|
151
151
|
styling="maximal",
|
|
@@ -3,7 +3,7 @@ import warnings
|
|
|
3
3
|
from collections.abc import Callable
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
|
-
from cognite.neat._alpha import
|
|
6
|
+
from cognite.neat._alpha import ExperimentalFeatureWarning
|
|
7
7
|
from cognite.neat._issues.errors import CDFMissingClientError, NeatImportError
|
|
8
8
|
from cognite.neat._issues.errors._external import OxigraphStorageLockedError
|
|
9
9
|
from cognite.neat._issues.errors._general import NeatValueError
|
|
@@ -38,7 +38,7 @@ def _session_method_wrapper(func: Callable, cls_name: str):
|
|
|
38
38
|
with warnings.catch_warnings(record=True) as w:
|
|
39
39
|
result = func(*args, **kwargs)
|
|
40
40
|
for warning in w:
|
|
41
|
-
if isinstance(warning.message,
|
|
41
|
+
if isinstance(warning.message, ExperimentalFeatureWarning):
|
|
42
42
|
print(f"{_WARNING_PREFIX} {warning.message}")
|
|
43
43
|
|
|
44
44
|
return result
|
|
@@ -421,6 +421,20 @@ class NeatRulesStore:
|
|
|
421
421
|
self._iteration_by_id[identifier] += 1
|
|
422
422
|
return identifier + f"/Iteration_{self._iteration_by_id[identifier]}"
|
|
423
423
|
|
|
424
|
+
@property
|
|
425
|
+
def try_get_last_dms_rules(self) -> DMSRules | None:
|
|
426
|
+
if not self.provenance:
|
|
427
|
+
return None
|
|
428
|
+
if self.provenance[-1].target_entity.dms is None:
|
|
429
|
+
return None
|
|
430
|
+
return self.provenance[-1].target_entity.dms
|
|
431
|
+
|
|
432
|
+
@property
|
|
433
|
+
def try_get_last_information_rules(self) -> InformationRules | None:
|
|
434
|
+
if not self.provenance:
|
|
435
|
+
return None
|
|
436
|
+
return self.provenance[-1].target_entity.information
|
|
437
|
+
|
|
424
438
|
@property
|
|
425
439
|
def last_verified_dms_rules(self) -> DMSRules:
|
|
426
440
|
if not self.provenance:
|
|
@@ -435,6 +449,13 @@ class NeatRulesStore:
|
|
|
435
449
|
raise EmptyStore()
|
|
436
450
|
return self.provenance[-1].target_entity.information
|
|
437
451
|
|
|
452
|
+
@property
|
|
453
|
+
def last_verified_rules(self) -> InformationRules | DMSRules | None:
|
|
454
|
+
if not self.provenance:
|
|
455
|
+
return None
|
|
456
|
+
last_entity = self.provenance[-1].target_entity
|
|
457
|
+
return last_entity.dms or last_entity.information
|
|
458
|
+
|
|
438
459
|
@property
|
|
439
460
|
def last_issues(self) -> IssueList | None:
|
|
440
461
|
return self._last_issues
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import warnings
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class AlphaWarning(UserWarning):
|
|
5
|
-
def __init__(self, feature_name: str):
|
|
6
|
-
super().__init__(f"Alpha feature '{feature_name}' is subject to change without notice")
|
|
7
|
-
|
|
8
|
-
def warn(self) -> None:
|
|
9
|
-
warnings.warn(self, stacklevel=2)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class AlphaFlags:
|
|
13
|
-
manual_rules_edit = AlphaWarning("enable_manual_edit")
|
|
14
|
-
same_space_properties_only_export = AlphaWarning("same-space-properties-only")
|
|
15
|
-
standardize_naming = AlphaWarning("standardize_naming")
|
|
16
|
-
standardize_space_and_version = AlphaWarning("standardize_space_and_version")
|
|
17
|
-
data_model_subsetting = AlphaWarning("data_model_subsetting")
|
|
18
|
-
ontology_read = AlphaWarning("ontology_read")
|
|
19
|
-
imf_read = AlphaWarning("imf_read")
|
|
20
|
-
dexpi_read = AlphaWarning("dexpi_read")
|
|
21
|
-
aml_read = AlphaWarning("aml_read")
|
|
22
|
-
csv_read = AlphaWarning("csv_read")
|
|
23
|
-
to_ontology = AlphaWarning("to_ontology")
|