cognite-neat 0.117.6__tar.gz → 0.117.8__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.117.6 → cognite_neat-0.117.8}/PKG-INFO +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/data_classes/schema.py +3 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +4 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +42 -24
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +4 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_dexpi.py +4 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_iodd.py +4 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_mock_graph_generator.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_rdf_file.py +2 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/loaders/_rdf2dms.py +6 -6
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/_iodd.py +2 -2
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/_prune_graph.py +9 -7
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/_value_type.py +5 -4
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/formatters.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/_shared.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/_rules2dms.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/_rules2excel.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/_rules2instance_template.py +6 -6
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/_rules2ontology.py +6 -6
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_dms2rules.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_rdf/_base.py +5 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +5 -5
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_rdf/_shared.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/_base_input.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/_base_rules.py +5 -15
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/_types.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/dms/_rules_input.py +3 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/entities/_constants.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/entities/_multi_value.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/entities/_single_value.py +9 -7
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/entities/_wrapped.py +5 -6
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/information/_rules.py +6 -5
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/information/_rules_input.py +4 -4
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/transformers/_mapping.py +2 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_collector.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_read.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/exceptions.py +4 -4
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_store/_provenance.py +3 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_store/_rules_store.py +3 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_store/exceptions.py +3 -3
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/auth.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/auxiliary.py +6 -4
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/rdf_.py +4 -4
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/reader/_base.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/spreadsheet.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/text.py +1 -1
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/time_.py +1 -1
- cognite_neat-0.117.8/cognite/neat/_version.py +2 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/pyproject.toml +8 -1
- cognite_neat-0.117.6/cognite/neat/_version.py +0 -2
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/LICENSE +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/README.md +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_alpha.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/_api/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/_api/data_modeling_loaders.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/_api/neat_instances.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/_api/schema.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/_api_client.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/data_classes/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/data_classes/data_modeling.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/data_classes/neat_sequence.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_client/testing.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_config.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_constants.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/_shared.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/_tracking/base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/_tracking/log.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/examples/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_dict.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_dms.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_dms_graph.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_raw.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/loaders/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/loaders/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/queries/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/queries/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/_contextmanagers.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/_factory.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/errors/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/errors/_external.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/errors/_general.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/errors/_properties.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/errors/_resources.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/errors/_wrapper.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/warnings/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/warnings/_external.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/warnings/_general.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/warnings/_models.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/warnings/_properties.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/warnings/_resources.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/_constants.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/analysis/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/analysis/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/catalog/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/catalog/classic_model.xlsx +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/catalog/hello_world_pump.xlsx +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/_validation.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_rdf/_imf2rules.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_rdf/_owl2rules.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/data_types.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/entities/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/entities/_types.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/information/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/information/_validation.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/models/mapping/_classic2core.yaml +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/transformers/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/transformers/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/transformers/_converters.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/transformers/_verification.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_base.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_drop.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_explore.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_fix.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_inspect.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_mapping.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_prepare.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_set.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_show.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_state.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_subset.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_template.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_to.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/_wizard.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/engine/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/engine/_import.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/engine/_interface.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_session/engine/_load.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_store/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_store/_graph_store.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/collection_.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/graph_transformations_report.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/io_.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/reader/__init__.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/upload.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_utils/xml_.py +0 -0
- {cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/py.typed +0 -0
|
@@ -279,7 +279,9 @@ class DMSSchema:
|
|
|
279
279
|
return cls(**loaded)
|
|
280
280
|
|
|
281
281
|
@classmethod
|
|
282
|
-
def _load_individual_resources(
|
|
282
|
+
def _load_individual_resources(
|
|
283
|
+
cls: Any, items: list, attr: Field, trigger_error: str, resource_context: list[Path]
|
|
284
|
+
) -> list[Any]:
|
|
283
285
|
type_ = cast(type, attr.type)
|
|
284
286
|
resources = type_([])
|
|
285
287
|
if not hasattr(type_, "_RESOURCE"):
|
{cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/extractors/_classic_cdf/_base.py
RENAMED
|
@@ -15,6 +15,7 @@ from cognite.client.data_classes._base import WriteableCogniteResource
|
|
|
15
15
|
from cognite.client.exceptions import CogniteAPIError
|
|
16
16
|
from pydantic import AnyHttpUrl, ValidationError
|
|
17
17
|
from rdflib import RDF, XSD, Literal, Namespace, URIRef
|
|
18
|
+
from typing_extensions import Self
|
|
18
19
|
|
|
19
20
|
from cognite.neat._constants import DEFAULT_NAMESPACE
|
|
20
21
|
from cognite.neat._graph.extractors._base import BaseExtractor
|
|
@@ -321,7 +322,7 @@ class ClassicCDFBaseExtractor(BaseExtractor, ABC, Generic[T_CogniteResource]):
|
|
|
321
322
|
as_write: bool = False,
|
|
322
323
|
prefix: str | None = None,
|
|
323
324
|
identifier: typing.Literal["id", "externalId"] = "id",
|
|
324
|
-
):
|
|
325
|
+
) -> Self:
|
|
325
326
|
total, items = cls._handle_no_access(lambda: cls._from_dataset(client, data_set_external_id))
|
|
326
327
|
return cls(
|
|
327
328
|
items,
|
|
@@ -356,7 +357,7 @@ class ClassicCDFBaseExtractor(BaseExtractor, ABC, Generic[T_CogniteResource]):
|
|
|
356
357
|
as_write: bool = False,
|
|
357
358
|
prefix: str | None = None,
|
|
358
359
|
identifier: typing.Literal["id", "externalId"] = "id",
|
|
359
|
-
):
|
|
360
|
+
) -> BaseExtractor:
|
|
360
361
|
total, items = cls._handle_no_access(lambda: cls._from_hierarchy(client, root_asset_external_id))
|
|
361
362
|
return cls(
|
|
362
363
|
items,
|
|
@@ -390,7 +391,7 @@ class ClassicCDFBaseExtractor(BaseExtractor, ABC, Generic[T_CogniteResource]):
|
|
|
390
391
|
as_write: bool = False,
|
|
391
392
|
prefix: str | None = None,
|
|
392
393
|
identifier: typing.Literal["id", "externalId"] = "id",
|
|
393
|
-
):
|
|
394
|
+
) -> BaseExtractor:
|
|
394
395
|
total, items = cls._from_file(file_path)
|
|
395
396
|
return cls(
|
|
396
397
|
items,
|
|
@@ -2,12 +2,12 @@ import typing
|
|
|
2
2
|
import urllib.parse
|
|
3
3
|
import warnings
|
|
4
4
|
from collections import defaultdict
|
|
5
|
-
from collections.abc import Iterable, Sequence
|
|
6
|
-
from typing import ClassVar, NamedTuple, cast
|
|
5
|
+
from collections.abc import Generator, Iterable, Sequence
|
|
6
|
+
from typing import Any, ClassVar, NamedTuple, cast
|
|
7
7
|
|
|
8
8
|
from cognite.client import CogniteClient
|
|
9
9
|
from cognite.client.exceptions import CogniteAPIError
|
|
10
|
-
from rdflib import
|
|
10
|
+
from rdflib import Namespace, URIRef
|
|
11
11
|
|
|
12
12
|
from cognite.neat._constants import CLASSIC_CDF_NAMESPACE, DEFAULT_NAMESPACE, get_default_prefixes_and_namespaces
|
|
13
13
|
from cognite.neat._graph.extractors._base import KnowledgeGraphExtractor
|
|
@@ -265,16 +265,16 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
265
265
|
else:
|
|
266
266
|
raise ValueError("Exactly one of data_set_external_id or root_asset_external_id must be set.")
|
|
267
267
|
|
|
268
|
-
def _extract_core_start_nodes(self):
|
|
268
|
+
def _extract_core_start_nodes(self) -> Generator[Triple, None, None]:
|
|
269
269
|
for core_node in self._classic_node_types:
|
|
270
270
|
kwargs = self._extractor_args.copy()
|
|
271
271
|
if core_node.extractor_cls == SequencesExtractor and self._skip_sequence_rows:
|
|
272
272
|
kwargs["skip_rows"] = True
|
|
273
273
|
|
|
274
274
|
if self._data_set_external_id:
|
|
275
|
-
extractor = core_node.extractor_cls.from_dataset(self._client, self._data_set_external_id, **kwargs)
|
|
275
|
+
extractor = core_node.extractor_cls.from_dataset(self._client, self._data_set_external_id, **kwargs) # type: ignore
|
|
276
276
|
elif self._root_asset_external_id:
|
|
277
|
-
extractor = core_node.extractor_cls.from_hierarchy(self._client, self._root_asset_external_id, **kwargs)
|
|
277
|
+
extractor = core_node.extractor_cls.from_hierarchy(self._client, self._root_asset_external_id, **kwargs) # type: ignore
|
|
278
278
|
else:
|
|
279
279
|
raise ValueError("Exactly one of data_set_external_id or root_asset_external_id must be set.")
|
|
280
280
|
|
|
@@ -296,14 +296,17 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
296
296
|
self._asset_parent_uri_by_id.update(extractor.asset_parent_uri_by_id)
|
|
297
297
|
self._asset_parent_uri_by_external_id.update(extractor.asset_parent_uri_by_external_id)
|
|
298
298
|
|
|
299
|
-
def _extract_start_node_relationships(self):
|
|
299
|
+
def _extract_start_node_relationships(self) -> Generator[Triple, None, None]:
|
|
300
300
|
for start_resource_type, source_external_ids in self._source_external_ids_by_type.items():
|
|
301
301
|
start_type = start_resource_type.removesuffix("_")
|
|
302
302
|
for chunk in self._chunk(list(source_external_ids), description=f"Extracting {start_type} relationships"):
|
|
303
303
|
relationship_iterator = self._client.relationships(
|
|
304
304
|
source_external_ids=list(chunk), source_types=[start_type]
|
|
305
305
|
)
|
|
306
|
-
|
|
306
|
+
# this needs some further attention. Duplicated code + untyped dict when unpacking the parameters.
|
|
307
|
+
# I am deliberately adding type ignore now, needs to be checked later.
|
|
308
|
+
extractor = RelationshipsExtractor(relationship_iterator, **self._extractor_args) # type: ignore
|
|
309
|
+
|
|
307
310
|
# This is a private attribute, but we need to set it to log the target nodes.
|
|
308
311
|
extractor._log_target_nodes = True
|
|
309
312
|
if self._identifier == "id":
|
|
@@ -337,7 +340,7 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
337
340
|
self._asset_parent_uri_by_id.update(extractor.asset_parent_uri_by_id)
|
|
338
341
|
self._asset_parent_uri_by_external_id.update(extractor.asset_parent_uri_by_external_id)
|
|
339
342
|
|
|
340
|
-
def _extract_core_end_nodes(self):
|
|
343
|
+
def _extract_core_end_nodes(self) -> Generator[Triple, None, None]:
|
|
341
344
|
for core_node in self._classic_node_types:
|
|
342
345
|
target_external_ids = self._target_external_ids_by_type[core_node.resource_type]
|
|
343
346
|
api = getattr(self._client, core_node.api_name)
|
|
@@ -345,8 +348,12 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
345
348
|
list(target_external_ids),
|
|
346
349
|
description=f"Extracting end nodes {core_node.resource_type.removesuffix('_')}",
|
|
347
350
|
):
|
|
351
|
+
# TO DO: this should be typed.
|
|
348
352
|
resource_iterator = api.retrieve_multiple(external_ids=list(chunk), ignore_unknown_ids=True)
|
|
349
|
-
|
|
353
|
+
|
|
354
|
+
# this needs some further attention. Duplicated code + untyped dict when unpacking the parameters.
|
|
355
|
+
# I am deliberately adding type ignore now, needs to be checked later.
|
|
356
|
+
extractor = core_node.extractor_cls(resource_iterator, **self._extractor_args) # type: ignore
|
|
350
357
|
|
|
351
358
|
extractor.asset_external_ids_by_id = self._asset_external_ids_by_id
|
|
352
359
|
extractor.lookup_dataset_external_id = self._lookup_dataset
|
|
@@ -358,7 +365,7 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
358
365
|
if self._identifier == "id":
|
|
359
366
|
self._uris_by_external_id_by_type[core_node.resource_type].update(extractor._uriref_by_external_id)
|
|
360
367
|
|
|
361
|
-
def _extract_relationship_target_triples(self):
|
|
368
|
+
def _extract_relationship_target_triples(self) -> Generator[tuple[URIRef, URIRef, URIRef], None, None]:
|
|
362
369
|
for id_, predicate, type_, external_id in self._relationship_subject_predicate_type_external_id:
|
|
363
370
|
try:
|
|
364
371
|
object_uri = self._uris_by_external_id_by_type[InstanceIdPrefix.from_str(type_)][external_id]
|
|
@@ -367,24 +374,28 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
367
374
|
else:
|
|
368
375
|
yield id_, predicate, object_uri
|
|
369
376
|
|
|
370
|
-
def _extract_labels(self):
|
|
377
|
+
def _extract_labels(self) -> Generator[Triple, None, None]:
|
|
378
|
+
# this needs some further attention. Duplicated code + untyped dict when unpacking the parameters.
|
|
379
|
+
# I am deliberately adding type ignore now, needs to be checked later.
|
|
371
380
|
for chunk in self._chunk(list(self._labels), description="Extracting labels"):
|
|
372
381
|
label_iterator = self._client.labels.retrieve(external_id=list(chunk), ignore_unknown_ids=True)
|
|
373
|
-
extractor = LabelsExtractor(label_iterator, **self._extractor_args)
|
|
382
|
+
extractor = LabelsExtractor(label_iterator, **self._extractor_args) # type: ignore
|
|
374
383
|
extractor.lookup_dataset_external_id = self._lookup_dataset
|
|
375
384
|
yield from extractor.extract()
|
|
376
385
|
|
|
377
|
-
def _extract_data_sets(self):
|
|
386
|
+
def _extract_data_sets(self) -> Generator[Triple, None, None]:
|
|
387
|
+
# this needs some further attention. Duplicated code + untyped dict when unpacking the parameters.
|
|
388
|
+
# I am deliberately adding type ignore now, needs to be checked later.
|
|
378
389
|
for chunk in self._chunk(list(self._data_set_ids), description="Extracting data sets"):
|
|
379
390
|
data_set_iterator = self._client.data_sets.retrieve_multiple(ids=list(chunk), ignore_unknown_ids=True)
|
|
380
|
-
yield from DataSetExtractor(data_set_iterator, **self._extractor_args).extract()
|
|
391
|
+
yield from DataSetExtractor(data_set_iterator, **self._extractor_args).extract() # type: ignore
|
|
381
392
|
for chunk in self._chunk(list(self._data_set_external_ids), description="Extracting data sets"):
|
|
382
393
|
data_set_iterator = self._client.data_sets.retrieve_multiple(
|
|
383
394
|
external_ids=list(chunk), ignore_unknown_ids=True
|
|
384
395
|
)
|
|
385
|
-
yield from DataSetExtractor(data_set_iterator, **self._extractor_args).extract()
|
|
396
|
+
yield from DataSetExtractor(data_set_iterator, **self._extractor_args).extract() # type: ignore
|
|
386
397
|
|
|
387
|
-
def _extract_asset_parent_data_sets(self):
|
|
398
|
+
def _extract_asset_parent_data_sets(self) -> Generator[tuple[URIRef, Any, Any], None, None]:
|
|
388
399
|
if self._asset_parent_uri_by_id:
|
|
389
400
|
for chunk in self._chunk(
|
|
390
401
|
list(self._asset_parent_uri_by_id.keys()), description="Extracting asset parent data sets"
|
|
@@ -393,11 +404,12 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
393
404
|
for asset in assets:
|
|
394
405
|
if asset.data_set_id is None:
|
|
395
406
|
continue
|
|
396
|
-
|
|
397
|
-
|
|
407
|
+
data_set_id = (
|
|
408
|
+
self._lookup_dataset(asset.data_set_id)
|
|
398
409
|
if self._identifier == "externalId"
|
|
399
|
-
else
|
|
410
|
+
else asset.data_set_id
|
|
400
411
|
)
|
|
412
|
+
object_ = self._namespace[f"{InstanceIdPrefix.data_set}{data_set_id}"]
|
|
401
413
|
yield self._asset_parent_uri_by_id[asset.id], self._namespace.dataSetId, object_
|
|
402
414
|
if self._asset_parent_uri_by_external_id:
|
|
403
415
|
for chunk in self._chunk(
|
|
@@ -407,12 +419,18 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
407
419
|
for asset in assets:
|
|
408
420
|
if asset.data_set_id is None:
|
|
409
421
|
continue
|
|
410
|
-
|
|
411
|
-
|
|
422
|
+
data_set_id = (
|
|
423
|
+
self._lookup_dataset(asset.data_set_id)
|
|
412
424
|
if self._identifier == "externalId"
|
|
413
|
-
else
|
|
425
|
+
else asset.data_set_id
|
|
414
426
|
)
|
|
415
|
-
|
|
427
|
+
object_ = self._namespace[f"{InstanceIdPrefix.data_set}{data_set_id}"]
|
|
428
|
+
if asset.external_id:
|
|
429
|
+
yield (
|
|
430
|
+
self._asset_parent_uri_by_external_id[asset.external_id],
|
|
431
|
+
self._namespace.dataSetId,
|
|
432
|
+
object_,
|
|
433
|
+
)
|
|
416
434
|
|
|
417
435
|
def _extract_with_logging_label_dataset(
|
|
418
436
|
self, extractor: ClassicCDFBaseExtractor, resource_type: InstanceIdPrefix | None = None
|
|
@@ -8,6 +8,7 @@ from typing import Any
|
|
|
8
8
|
from cognite.client import CogniteClient
|
|
9
9
|
from cognite.client.data_classes import Sequence, SequenceFilter
|
|
10
10
|
from rdflib import RDF, XSD, Literal, Namespace, URIRef
|
|
11
|
+
from typing_extensions import Self
|
|
11
12
|
|
|
12
13
|
from cognite.neat._client.data_classes.neat_sequence import NeatSequence, NeatSequenceList
|
|
13
14
|
from cognite.neat._shared import Triple
|
|
@@ -83,7 +84,7 @@ class SequencesExtractor(ClassicCDFBaseExtractor[NeatSequence]):
|
|
|
83
84
|
identifier: typing.Literal["id", "externalId"] = "id",
|
|
84
85
|
unpack_columns: bool = False,
|
|
85
86
|
skip_rows: bool = False,
|
|
86
|
-
):
|
|
87
|
+
) -> Self:
|
|
87
88
|
total, items = cls._handle_no_access(lambda: cls._from_dataset(client, data_set_external_id, skip_rows))
|
|
88
89
|
return cls(
|
|
89
90
|
items,
|
|
@@ -114,7 +115,7 @@ class SequencesExtractor(ClassicCDFBaseExtractor[NeatSequence]):
|
|
|
114
115
|
identifier: typing.Literal["id", "externalId"] = "id",
|
|
115
116
|
unpack_columns: bool = False,
|
|
116
117
|
skip_rows: bool = False,
|
|
117
|
-
):
|
|
118
|
+
) -> ClassicCDFBaseExtractor:
|
|
118
119
|
total, items = cls._handle_no_access(lambda: cls._from_hierarchy(client, root_asset_external_id, skip_rows))
|
|
119
120
|
return cls(
|
|
120
121
|
items,
|
|
@@ -143,7 +144,7 @@ class SequencesExtractor(ClassicCDFBaseExtractor[NeatSequence]):
|
|
|
143
144
|
prefix: str | None = None,
|
|
144
145
|
identifier: typing.Literal["id", "externalId"] = "id",
|
|
145
146
|
unpack_columns: bool = False,
|
|
146
|
-
):
|
|
147
|
+
) -> ClassicCDFBaseExtractor:
|
|
147
148
|
total, items = cls._from_file(file_path)
|
|
148
149
|
return cls(
|
|
149
150
|
items,
|
|
@@ -5,6 +5,7 @@ from pathlib import Path
|
|
|
5
5
|
from xml.etree.ElementTree import Element
|
|
6
6
|
|
|
7
7
|
from rdflib import RDF, RDFS, XSD, Literal, Namespace, URIRef
|
|
8
|
+
from typing_extensions import Self
|
|
8
9
|
|
|
9
10
|
from cognite.neat._constants import DEFAULT_NAMESPACE
|
|
10
11
|
from cognite.neat._graph.extractors._base import BaseExtractor
|
|
@@ -35,11 +36,11 @@ class DexpiExtractor(BaseExtractor):
|
|
|
35
36
|
self.namespace = namespace or DEFAULT_NAMESPACE
|
|
36
37
|
|
|
37
38
|
@classmethod
|
|
38
|
-
def from_file(cls, filepath: str | Path, namespace: Namespace | None = None):
|
|
39
|
+
def from_file(cls, filepath: str | Path, namespace: Namespace | None = None) -> Self:
|
|
39
40
|
return cls(ET.parse(filepath).getroot(), namespace)
|
|
40
41
|
|
|
41
42
|
@classmethod
|
|
42
|
-
def from_url(cls, url: str, namespace: Namespace | None = None):
|
|
43
|
+
def from_url(cls, url: str, namespace: Namespace | None = None) -> Self:
|
|
43
44
|
from io import BytesIO
|
|
44
45
|
|
|
45
46
|
import requests
|
|
@@ -119,7 +120,7 @@ class DexpiExtractor(BaseExtractor):
|
|
|
119
120
|
return triples
|
|
120
121
|
|
|
121
122
|
@classmethod
|
|
122
|
-
def _to_uri_friendly_association_type(cls, association: Element):
|
|
123
|
+
def _to_uri_friendly_association_type(cls, association: Element) -> str:
|
|
123
124
|
association_type = "".join(
|
|
124
125
|
[word.capitalize() if i != 0 else word for i, word in enumerate(association.attrib["Type"].split(" "))]
|
|
125
126
|
)
|
|
@@ -8,6 +8,7 @@ from typing import Literal as LiteralType
|
|
|
8
8
|
from xml.etree.ElementTree import Element
|
|
9
9
|
|
|
10
10
|
from rdflib import RDF, XSD, Literal, Namespace, URIRef
|
|
11
|
+
from typing_extensions import Self
|
|
11
12
|
|
|
12
13
|
from cognite.neat._constants import DEFAULT_NAMESPACE
|
|
13
14
|
from cognite.neat._graph.extractors._base import BaseExtractor
|
|
@@ -90,7 +91,7 @@ class IODDExtractor(BaseExtractor):
|
|
|
90
91
|
return mapping
|
|
91
92
|
|
|
92
93
|
@classmethod
|
|
93
|
-
def from_file(cls, filepath: Path, namespace: Namespace | None = None, device_id: str | None = None):
|
|
94
|
+
def from_file(cls, filepath: Path, namespace: Namespace | None = None, device_id: str | None = None) -> Self:
|
|
94
95
|
if filepath.suffix != ".xml":
|
|
95
96
|
raise FileReadError(filepath, "File is not XML.")
|
|
96
97
|
return cls(ET.parse(filepath).getroot(), namespace, device_id)
|
|
@@ -273,7 +274,7 @@ class IODDExtractor(BaseExtractor):
|
|
|
273
274
|
return triples
|
|
274
275
|
|
|
275
276
|
@classmethod
|
|
276
|
-
def _process_data_in_records2triples(cls, pc_in_root: Element, process_data_in_id: URIRef):
|
|
277
|
+
def _process_data_in_records2triples(cls, pc_in_root: Element, process_data_in_id: URIRef) -> list[Triple]:
|
|
277
278
|
"""
|
|
278
279
|
Extract RecordItems related to a ProcessDataIn element. Each record item is indexed. Will use this index
|
|
279
280
|
as the identifier for the time series in CDF.
|
|
@@ -355,7 +356,7 @@ class IODDExtractor(BaseExtractor):
|
|
|
355
356
|
|
|
356
357
|
return record_dict
|
|
357
358
|
|
|
358
|
-
def _extract_enhanced_ts_information(self, json_file_path: Path):
|
|
359
|
+
def _extract_enhanced_ts_information(self, json_file_path: Path) -> None:
|
|
359
360
|
"""
|
|
360
361
|
Extract additional information like name, description and data type for Variables and ProcessDataIn
|
|
361
362
|
record elements in the IODD. The purpose is for the result gile to be used for enhancing time series with more
|
|
@@ -206,7 +206,7 @@ def _traverse(hierarchy: dict, graph: dict, names: list[str]) -> dict:
|
|
|
206
206
|
return hierarchy
|
|
207
207
|
|
|
208
208
|
|
|
209
|
-
def _prettify_generation_order(generation_order: dict, depth: dict | None = None, start
|
|
209
|
+
def _prettify_generation_order(generation_order: dict, depth: dict | None = None, start: int = -1) -> dict:
|
|
210
210
|
"""Prettifies generation order dictionary for easier consumption."""
|
|
211
211
|
depth = depth or {}
|
|
212
212
|
for key, value in generation_order.items():
|
|
@@ -5,6 +5,7 @@ from typing import cast, get_args
|
|
|
5
5
|
|
|
6
6
|
from rdflib import URIRef
|
|
7
7
|
from rdflib.util import guess_format
|
|
8
|
+
from typing_extensions import Self
|
|
8
9
|
|
|
9
10
|
from cognite.neat._constants import DEFAULT_BASE_URI
|
|
10
11
|
from cognite.neat._graph._shared import RDFTypes
|
|
@@ -57,7 +58,7 @@ class RdfFileExtractor(BaseExtractor):
|
|
|
57
58
|
filename: str = "neat-session/instances/instances.trig",
|
|
58
59
|
base_uri: URIRef = DEFAULT_BASE_URI,
|
|
59
60
|
issue_list: IssueList | None = None,
|
|
60
|
-
):
|
|
61
|
+
) -> Self:
|
|
61
62
|
if not filepath.exists():
|
|
62
63
|
raise FileNotFoundNeatError(filepath)
|
|
63
64
|
if filepath.suffix not in {".zip"}:
|
|
@@ -374,7 +374,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
374
374
|
|
|
375
375
|
field_definitions[prop_id] = (python_type, default_value)
|
|
376
376
|
|
|
377
|
-
def parse_list(cls, value: Any, info: ValidationInfo) -> list[str]:
|
|
377
|
+
def parse_list(cls: Any, value: Any, info: ValidationInfo) -> list[str]:
|
|
378
378
|
if isinstance(value, list) and list.__name__ not in _get_field_value_types(cls, info):
|
|
379
379
|
if len(value) > 1:
|
|
380
380
|
warnings.warn(
|
|
@@ -388,7 +388,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
388
388
|
|
|
389
389
|
return value
|
|
390
390
|
|
|
391
|
-
def parse_json_string(cls, value: Any, info: ValidationInfo) -> dict | list:
|
|
391
|
+
def parse_json_string(cls: Any, value: Any, info: ValidationInfo) -> dict | list:
|
|
392
392
|
if isinstance(value, dict):
|
|
393
393
|
return value
|
|
394
394
|
elif isinstance(value, list):
|
|
@@ -411,7 +411,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
411
411
|
|
|
412
412
|
if direct_relation_by_property:
|
|
413
413
|
|
|
414
|
-
def parse_direct_relation(cls, value: list, info: ValidationInfo) -> dict | list[dict]:
|
|
414
|
+
def parse_direct_relation(cls: Any, value: list, info: ValidationInfo) -> dict | list[dict]:
|
|
415
415
|
# We validate above that we only get one value for single direct relations.
|
|
416
416
|
if list.__name__ in _get_field_value_types(cls, info):
|
|
417
417
|
ids = (self._create_instance_id(v, "node", stop_on_exception=True) for v in value)
|
|
@@ -443,7 +443,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
443
443
|
|
|
444
444
|
if unit_properties:
|
|
445
445
|
|
|
446
|
-
def parse_direct_relation_to_unit(cls, value: Any, info: ValidationInfo) -> dict | list[dict]:
|
|
446
|
+
def parse_direct_relation_to_unit(cls: Any, value: Any, info: ValidationInfo) -> dict | list[dict]:
|
|
447
447
|
if value:
|
|
448
448
|
external_id = remove_namespace_from_uri(value[0])
|
|
449
449
|
if self._unquote_external_ids:
|
|
@@ -457,7 +457,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
457
457
|
|
|
458
458
|
if text_fields:
|
|
459
459
|
|
|
460
|
-
def parse_text(cls, value: Any, info: ValidationInfo) -> str | list[str]:
|
|
460
|
+
def parse_text(cls: Any, value: Any, info: ValidationInfo) -> str | list[str]:
|
|
461
461
|
if isinstance(value, list):
|
|
462
462
|
return [remove_namespace_from_uri(v) if isinstance(v, URIRef) else str(v) for v in value]
|
|
463
463
|
return remove_namespace_from_uri(value) if isinstance(value, URIRef) else str(value)
|
|
@@ -701,5 +701,5 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
701
701
|
yield result
|
|
702
702
|
|
|
703
703
|
|
|
704
|
-
def _get_field_value_types(cls, info):
|
|
704
|
+
def _get_field_value_types(cls: Any, info: ValidationInfo) -> Any:
|
|
705
705
|
return [type_.__name__ for type_ in get_args(cls.model_fields[info.field_name].annotation)]
|
|
@@ -14,7 +14,7 @@ class IODDAttachPropertyFromTargetToSource(AttachPropertyFromTargetToSource):
|
|
|
14
14
|
}
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
-
def __init__(self):
|
|
17
|
+
def __init__(self) -> None:
|
|
18
18
|
super().__init__(
|
|
19
19
|
target_node_type=IODD.TextObject,
|
|
20
20
|
target_property=IODD.value,
|
|
@@ -26,5 +26,5 @@ class IODDAttachPropertyFromTargetToSource(AttachPropertyFromTargetToSource):
|
|
|
26
26
|
class IODDPruneDanglingNodes(PruneDanglingNodes):
|
|
27
27
|
_need_changes = frozenset({str(IODDExtractor.__name__), str(IODDAttachPropertyFromTargetToSource.__name__)})
|
|
28
28
|
|
|
29
|
-
def __init__(self):
|
|
29
|
+
def __init__(self) -> None:
|
|
30
30
|
super().__init__(node_prune_types=[IODD.TextObject])
|
{cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/_prune_graph.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import cast
|
|
1
|
+
from typing import Any, cast
|
|
2
2
|
|
|
3
3
|
from rdflib import Graph, Namespace, URIRef
|
|
4
4
|
from rdflib.query import ResultRow
|
|
@@ -101,8 +101,8 @@ class AttachPropertyFromTargetToSource(BaseTransformer):
|
|
|
101
101
|
self.convert_literal_to_uri = convert_literal_to_uri
|
|
102
102
|
self.namespace = namespace or DEFAULT_NAMESPACE
|
|
103
103
|
|
|
104
|
-
def transform(self, graph) -> None:
|
|
105
|
-
nodes_to_delete: list[
|
|
104
|
+
def transform(self, graph: Graph) -> None:
|
|
105
|
+
nodes_to_delete: list[Any] = []
|
|
106
106
|
|
|
107
107
|
if self.target_property_holding_new_property is not None:
|
|
108
108
|
query = self._query_template_use_case_b.format(
|
|
@@ -116,7 +116,7 @@ class AttachPropertyFromTargetToSource(BaseTransformer):
|
|
|
116
116
|
target_property=self.target_property,
|
|
117
117
|
)
|
|
118
118
|
|
|
119
|
-
for (
|
|
119
|
+
for ( # type: ignore
|
|
120
120
|
source_node,
|
|
121
121
|
old_predicate,
|
|
122
122
|
target_node,
|
|
@@ -128,7 +128,8 @@ class AttachPropertyFromTargetToSource(BaseTransformer):
|
|
|
128
128
|
new_predicate_value_string = sentence_or_string_to_camel(str(new_predicate_value))
|
|
129
129
|
predicate = as_neat_compliant_uri(self.namespace[new_predicate_value_string])
|
|
130
130
|
else:
|
|
131
|
-
|
|
131
|
+
# this assign seems dangerous
|
|
132
|
+
predicate = old_predicate # type: ignore
|
|
132
133
|
# Create new connection from source node to value
|
|
133
134
|
graph.add(
|
|
134
135
|
(
|
|
@@ -142,12 +143,13 @@ class AttachPropertyFromTargetToSource(BaseTransformer):
|
|
|
142
143
|
|
|
143
144
|
nodes_to_delete.append(target_node)
|
|
144
145
|
|
|
146
|
+
# this seems a bit funky. Need to check further.
|
|
145
147
|
if self.delete_target_node:
|
|
146
148
|
for target_node in nodes_to_delete:
|
|
147
149
|
# Remove triples with edges to target_node
|
|
148
|
-
graph.remove((None, None, target_node))
|
|
150
|
+
graph.remove((None, None, target_node)) # type: ignore
|
|
149
151
|
# Remove target node triple and its properties
|
|
150
|
-
graph.remove((target_node, None, None))
|
|
152
|
+
graph.remove((target_node, None, None)) # type: ignore
|
|
151
153
|
|
|
152
154
|
|
|
153
155
|
# TODO: Remove or adapt IODD
|
{cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_graph/transformers/_value_type.py
RENAMED
|
@@ -4,7 +4,7 @@ from typing import Any, cast
|
|
|
4
4
|
from urllib.parse import quote
|
|
5
5
|
|
|
6
6
|
import rdflib
|
|
7
|
-
from rdflib import RDF, RDFS, Literal, Namespace, URIRef
|
|
7
|
+
from rdflib import RDF, RDFS, Graph, Literal, Namespace, URIRef
|
|
8
8
|
from rdflib.query import ResultRow
|
|
9
9
|
|
|
10
10
|
from cognite.neat._constants import NEAT
|
|
@@ -68,9 +68,10 @@ class SplitMultiValueProperty(BaseTransformerStandardised):
|
|
|
68
68
|
|
|
69
69
|
return query.format(unknownType=self.unknown_type, subject_uri=type_, property_uri=property_)
|
|
70
70
|
|
|
71
|
-
def _iterator(self, graph) -> Iterator:
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
def _iterator(self, graph: Graph) -> Iterator:
|
|
72
|
+
# this method is doing some funky stuff, we should review this.
|
|
73
|
+
for type_, property_, _ in graph.query(self._iterate_query()): # type: ignore
|
|
74
|
+
yield from graph.query(self._sub_iterate_query(type_, property_)) # type: ignore
|
|
74
75
|
|
|
75
76
|
def operation(self, query_result_row: ResultRow) -> RowTransformationOutput:
|
|
76
77
|
row_output = RowTransformationOutput()
|
|
@@ -142,7 +142,7 @@ class DMSExporter(CDFExporter[DMSRules, DMSSchema]):
|
|
|
142
142
|
exclude = self._create_exclude_set()
|
|
143
143
|
schema.to_zip(filepath, exclude=exclude)
|
|
144
144
|
|
|
145
|
-
def _create_exclude_set(self):
|
|
145
|
+
def _create_exclude_set(self) -> set:
|
|
146
146
|
if self.export_components is None:
|
|
147
147
|
exclude = set()
|
|
148
148
|
else:
|
|
@@ -242,7 +242,7 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
|
|
|
242
242
|
dumped_rules: dict[str, Any],
|
|
243
243
|
rules: VerifiedRules,
|
|
244
244
|
sheet_prefix: str = "",
|
|
245
|
-
):
|
|
245
|
+
) -> None:
|
|
246
246
|
for sheet_name, headers in rules.headers_by_sheet(by_alias=True).items():
|
|
247
247
|
if sheet_name in ("Metadata", "Prefixes", "Reference", "Last"):
|
|
248
248
|
continue
|
|
@@ -49,7 +49,7 @@ class InstanceTemplateExporter(BaseExporter[InformationRules, Workbook]):
|
|
|
49
49
|
def export(
|
|
50
50
|
self,
|
|
51
51
|
rules: InformationRules,
|
|
52
|
-
):
|
|
52
|
+
) -> Workbook:
|
|
53
53
|
workbook = Workbook()
|
|
54
54
|
|
|
55
55
|
# Remove default sheet named "Sheet"
|
|
@@ -93,13 +93,13 @@ class InstanceTemplateExporter(BaseExporter[InformationRules, Workbook]):
|
|
|
93
93
|
return None
|
|
94
94
|
|
|
95
95
|
|
|
96
|
-
def _add_index_identifiers(workbook: Workbook, sheet: str, no_rows: int):
|
|
96
|
+
def _add_index_identifiers(workbook: Workbook, sheet: str, no_rows: int) -> None:
|
|
97
97
|
"""Adds index-based auto identifier to a sheet identifier column"""
|
|
98
98
|
for i in range(no_rows):
|
|
99
99
|
workbook[sheet][f"A{i + 2}"] = f'=IF(ISBLANK(B{i + 2}), "","{sheet}-{i + 1}")'
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
def _add_uuid_identifiers(workbook: Workbook, sheet: str, no_rows: int):
|
|
102
|
+
def _add_uuid_identifiers(workbook: Workbook, sheet: str, no_rows: int) -> None:
|
|
103
103
|
"""Adds UUID-based auto identifier to a sheet identifier column"""
|
|
104
104
|
for i in range(no_rows):
|
|
105
105
|
workbook[sheet][f"A{i + 2}"] = f'=IF(ISBLANK(B{i + 2}), "","{sheet}-{uuid.uuid4()}")'
|
|
@@ -112,7 +112,7 @@ def _add_drop_down_list(
|
|
|
112
112
|
no_rows: int,
|
|
113
113
|
value_sheet: str,
|
|
114
114
|
value_column: str,
|
|
115
|
-
):
|
|
115
|
+
) -> None:
|
|
116
116
|
"""Adds a drop down list to a column"""
|
|
117
117
|
drop_down_list = DataValidation(
|
|
118
118
|
type="list",
|
|
@@ -125,7 +125,7 @@ def _add_drop_down_list(
|
|
|
125
125
|
drop_down_list.add(workbook[sheet][f"{column}{i + 2}"])
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
def _adjust_column_width(workbook: Workbook):
|
|
128
|
+
def _adjust_column_width(workbook: Workbook) -> None:
|
|
129
129
|
"""Adjusts the column width based on the content"""
|
|
130
130
|
for sheet in workbook.sheetnames:
|
|
131
131
|
for cell_tuple in workbook[sheet].columns:
|
|
@@ -136,7 +136,7 @@ def _adjust_column_width(workbook: Workbook):
|
|
|
136
136
|
workbook[sheet].column_dimensions[cell.column_letter].width = adjusted_width
|
|
137
137
|
|
|
138
138
|
|
|
139
|
-
def _set_header_style(workbook: Workbook):
|
|
139
|
+
def _set_header_style(workbook: Workbook) -> None:
|
|
140
140
|
"""Sets the header style for all sheets in the workbook"""
|
|
141
141
|
style = NamedStyle(name="header style")
|
|
142
142
|
style.font = Font(bold=True, size=16)
|
{cognite_neat-0.117.6 → cognite_neat-0.117.8}/cognite/neat/_rules/exporters/_rules2ontology.py
RENAMED
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import warnings
|
|
3
3
|
from abc import ABC
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import ClassVar
|
|
5
|
+
from typing import Any, ClassVar
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel, ConfigDict, ValidationInfo, field_validator
|
|
8
8
|
from rdflib import DCTERMS, OWL, RDF, RDFS, XSD, BNode, Graph, Literal, Namespace, URIRef
|
|
@@ -355,7 +355,7 @@ class OWLProperty(OntologyModel):
|
|
|
355
355
|
return owl_property
|
|
356
356
|
|
|
357
357
|
@field_validator("type_")
|
|
358
|
-
def is_multi_type(cls, v, info: ValidationInfo):
|
|
358
|
+
def is_multi_type(cls, v: Any, info: ValidationInfo) -> Any:
|
|
359
359
|
if len(v) > 1:
|
|
360
360
|
warnings.warn(
|
|
361
361
|
PropertyDefinitionDuplicatedWarning(
|
|
@@ -373,7 +373,7 @@ class OWLProperty(OntologyModel):
|
|
|
373
373
|
return v
|
|
374
374
|
|
|
375
375
|
@field_validator("range_")
|
|
376
|
-
def is_multi_range(cls, v, info: ValidationInfo):
|
|
376
|
+
def is_multi_range(cls, v: Any, info: ValidationInfo) -> Any:
|
|
377
377
|
if len(v) > 1:
|
|
378
378
|
warnings.warn(
|
|
379
379
|
PropertyDefinitionDuplicatedWarning(
|
|
@@ -390,7 +390,7 @@ class OWLProperty(OntologyModel):
|
|
|
390
390
|
return v
|
|
391
391
|
|
|
392
392
|
@field_validator("domain")
|
|
393
|
-
def is_multi_domain(cls, v, info: ValidationInfo):
|
|
393
|
+
def is_multi_domain(cls, v: Any, info: ValidationInfo) -> Any:
|
|
394
394
|
if len(v) > 1:
|
|
395
395
|
warnings.warn(
|
|
396
396
|
PropertyDefinitionDuplicatedWarning(
|
|
@@ -408,7 +408,7 @@ class OWLProperty(OntologyModel):
|
|
|
408
408
|
return v
|
|
409
409
|
|
|
410
410
|
@field_validator("label")
|
|
411
|
-
def has_multi_name(cls, v, info: ValidationInfo):
|
|
411
|
+
def has_multi_name(cls, v: Any, info: ValidationInfo) -> Any:
|
|
412
412
|
if len(v) > 1:
|
|
413
413
|
warnings.warn(
|
|
414
414
|
PropertyDefinitionDuplicatedWarning(
|
|
@@ -423,7 +423,7 @@ class OWLProperty(OntologyModel):
|
|
|
423
423
|
return v
|
|
424
424
|
|
|
425
425
|
@field_validator("comment")
|
|
426
|
-
def has_multi_comment(cls, v, info: ValidationInfo):
|
|
426
|
+
def has_multi_comment(cls, v: Any, info: ValidationInfo) -> Any:
|
|
427
427
|
if len(v) > 1:
|
|
428
428
|
warnings.warn(
|
|
429
429
|
PropertyDefinitionDuplicatedWarning(
|
|
@@ -465,7 +465,7 @@ class DMSImporter(BaseImporter[DMSInputRules]):
|
|
|
465
465
|
return str(default)
|
|
466
466
|
return None
|
|
467
467
|
|
|
468
|
-
def _get_index(self, prop: ViewPropertyApply, prop_id) -> list[str] | None:
|
|
468
|
+
def _get_index(self, prop: ViewPropertyApply, prop_id: str) -> list[str] | None:
|
|
469
469
|
if not isinstance(prop, dm.MappedPropertyApply):
|
|
470
470
|
return None
|
|
471
471
|
container = self._all_containers_by_id[prop.container]
|