cognite-neat 0.77.1__tar.gz → 0.77.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/PKG-INFO +1 -1
- cognite_neat-0.77.3/cognite/neat/_version.py +1 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exporters/_rules2excel.py +75 -86
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_dms2rules.py +9 -5
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/issues/dms.py +39 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/issues/importing.py +16 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/dms/_converter.py +23 -19
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/dms/_rules_input.py +1 -1
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/dms/_schema.py +36 -1
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/dms/_validation.py +11 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/information/_converter.py +27 -19
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/pyproject.toml +2 -2
- cognite_neat-0.77.1/cognite/neat/_version.py +0 -1
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/LICENSE +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/README.md +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/configuration.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/explorer.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/routers/configuration.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/routers/core.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/routers/crud.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/routers/data_exploration.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/routers/metrics.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/routers/rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/routers/workflows.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/utils/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/utils/logging.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/main.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/monitoring/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/monitoring/metrics.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/index.html +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/config.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/constants.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/exceptions.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/examples/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/exceptions.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/extractors/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/models.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/stores/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/stores/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/stores/_graphdb_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/stores/_memory_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/stores/_oxigraph_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/graph/stores/_rdf_to_graph.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/exceptions.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/models.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/stores/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/stores/_memory_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/graph/transformations/transformer.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/analysis.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-TNT.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exceptions.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_graph2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/models/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/models/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/models/raw_rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/models/rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/models/tables.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/rules/models/value_types.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/py.typed +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/_shared.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/analysis/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/analysis/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/analysis/_information_rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/examples/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exceptions.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exporters/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exporters/_models.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/issues/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/issues/base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/issues/fileread.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/issues/formatters.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/issues/spreadsheet.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/_types/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/_types/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/_types/_field.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/data_types.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/dms/_serializer.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/domain.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/entities.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/information/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/information/_rules.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/wrapped_entities.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/auxiliary.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/cdf.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/cdf_classes.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/cdf_loaders/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/cdf_loaders/_base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/cdf_loaders/_ingestion.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/cdf_loaders/data_classes.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/exceptions.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/spreadsheet.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/text.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/utils.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/utils/xml.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/_exceptions.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/base.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/cdf_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/manager.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/migration/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/migration/steps.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/model.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps/step_model.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/steps_registry.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/tasks.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/triggers.py +0 -0
- {cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/workflows/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.77.3"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import itertools
|
|
4
|
-
|
|
4
|
+
import json
|
|
5
|
+
from datetime import datetime, timezone
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from types import GenericAlias
|
|
7
8
|
from typing import Any, ClassVar, Literal, cast, get_args
|
|
@@ -14,14 +15,14 @@ from openpyxl.worksheet.worksheet import Worksheet
|
|
|
14
15
|
from cognite.neat.rules._shared import Rules
|
|
15
16
|
from cognite.neat.rules.models import (
|
|
16
17
|
DataModelType,
|
|
17
|
-
DMSRules,
|
|
18
|
-
DomainRules,
|
|
19
18
|
ExtensionCategory,
|
|
20
|
-
InformationRules,
|
|
21
19
|
RoleTypes,
|
|
22
20
|
SchemaCompleteness,
|
|
23
21
|
SheetEntity,
|
|
24
22
|
)
|
|
23
|
+
from cognite.neat.rules.models.dms import DMSMetadata
|
|
24
|
+
from cognite.neat.rules.models.domain import DomainMetadata
|
|
25
|
+
from cognite.neat.rules.models.information import InformationMetadata
|
|
25
26
|
|
|
26
27
|
from ._base import BaseExporter
|
|
27
28
|
|
|
@@ -34,9 +35,6 @@ class ExcelExporter(BaseExporter[Workbook]):
|
|
|
34
35
|
on the different styles.
|
|
35
36
|
output_role: The role to use for the exported spreadsheet. If provided, the rules will be converted to
|
|
36
37
|
this role formate before being written to excel. If not provided, the role from the rules will be used.
|
|
37
|
-
new_model_id: The new model ID to use for the exported spreadsheet. This is only applicable if the input
|
|
38
|
-
rules have 'is_reference' set. If provided, the model ID will be used to automatically create the
|
|
39
|
-
new metadata sheet in the Excel file.
|
|
40
38
|
dump_as: This determines how the rules are written to the Excel file. An Excel file has up to three sets of
|
|
41
39
|
sheets: user, last, and reference. The user sheets are used for inputting rules from a user. The last sheets
|
|
42
40
|
are used for the last version of the same model as the user, while the reference sheets are used for
|
|
@@ -49,6 +47,10 @@ class ExcelExporter(BaseExporter[Workbook]):
|
|
|
49
47
|
change a model that has already been published to CDF and that model is in production.
|
|
50
48
|
* "reference": The rules are written to the reference sheets. This is typically used when you want to build
|
|
51
49
|
a new solution on top of an enterprise model.
|
|
50
|
+
new_model_id: The new model ID to use for the exported spreadsheet. This is only applicable if the input
|
|
51
|
+
rules have 'is_reference' set. If provided, the model ID will be used to automatically create the
|
|
52
|
+
new metadata sheet in the Excel file. The model id is expected to be a tuple of (prefix, title)
|
|
53
|
+
(space, external_id) for InformationRules and DMSRules respectively.
|
|
52
54
|
|
|
53
55
|
The following styles are available:
|
|
54
56
|
|
|
@@ -74,8 +76,8 @@ class ExcelExporter(BaseExporter[Workbook]):
|
|
|
74
76
|
self,
|
|
75
77
|
styling: Style = "default",
|
|
76
78
|
output_role: RoleTypes | None = None,
|
|
77
|
-
new_model_id: tuple[str, str, str] | None = None,
|
|
78
79
|
dump_as: DumpOptions = "user",
|
|
80
|
+
new_model_id: tuple[str, str] | None = None,
|
|
79
81
|
):
|
|
80
82
|
if styling not in self.style_options:
|
|
81
83
|
raise ValueError(f"Invalid styling: {styling}. Valid options are {self.style_options}")
|
|
@@ -106,9 +108,11 @@ class ExcelExporter(BaseExporter[Workbook]):
|
|
|
106
108
|
dumped_last_rules: dict[str, Any] | None = None
|
|
107
109
|
dumped_reference_rules: dict[str, Any] | None = None
|
|
108
110
|
if self.dump_as != "user":
|
|
109
|
-
|
|
111
|
+
action = {"last": "update", "reference": "create"}[self.dump_as]
|
|
112
|
+
metadata_creator = _MetadataCreator(action, self.new_model_id) # type: ignore[arg-type]
|
|
113
|
+
|
|
110
114
|
dumped_user_rules = {
|
|
111
|
-
"Metadata":
|
|
115
|
+
"Metadata": metadata_creator.create(rules.metadata),
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
if self.dump_as == "last":
|
|
@@ -234,82 +238,67 @@ class ExcelExporter(BaseExporter[Workbook]):
|
|
|
234
238
|
sheet.column_dimensions[selected_column.column_letter].width = max(current, max_length + 0.5)
|
|
235
239
|
return None
|
|
236
240
|
|
|
237
|
-
def _create_metadata_sheet_user_rules(self, rules: Rules) -> dict[str, Any]:
|
|
238
|
-
metadata: dict[str, Any] = {
|
|
239
|
-
field_alias: None for field_alias in rules.metadata.model_dump(by_alias=True).keys()
|
|
240
|
-
}
|
|
241
|
-
if "creator" in metadata:
|
|
242
|
-
metadata["creator"] = "YOUR NAME"
|
|
243
|
-
|
|
244
|
-
if isinstance(rules, DomainRules):
|
|
245
|
-
return metadata
|
|
246
|
-
elif isinstance(rules, DMSRules):
|
|
247
|
-
existing_model_id = (rules.metadata.space, rules.metadata.external_id, rules.metadata.version)
|
|
248
|
-
elif isinstance(rules, InformationRules):
|
|
249
|
-
existing_model_id = (rules.metadata.prefix, rules.metadata.name, rules.metadata.version)
|
|
250
|
-
else:
|
|
251
|
-
raise ValueError(f"Unsupported rules type: {type(rules)}")
|
|
252
|
-
existing_metadata = rules.metadata.model_dump(by_alias=True)
|
|
253
|
-
if isinstance(existing_metadata["created"], datetime):
|
|
254
|
-
metadata["created"] = existing_metadata["created"].replace(tzinfo=None)
|
|
255
|
-
if isinstance(existing_metadata["updated"], datetime):
|
|
256
|
-
metadata["updated"] = existing_metadata["updated"].replace(tzinfo=None)
|
|
257
|
-
# Excel does not support timezone in datetime strings
|
|
258
|
-
now_iso = datetime.now().replace(tzinfo=None).isoformat()
|
|
259
|
-
is_info = isinstance(rules, InformationRules)
|
|
260
|
-
is_dms = isinstance(rules, DMSRules)
|
|
261
|
-
is_extension = self.new_model_id is not None or rules.reference is not None
|
|
262
|
-
is_solution = rules.metadata.data_model_type == DataModelType.solution
|
|
263
|
-
|
|
264
|
-
if is_solution and self.new_model_id:
|
|
265
|
-
metadata["prefix" if is_info else "space"] = self.new_model_id[0] # type: ignore[index]
|
|
266
|
-
metadata["title" if is_info else "externalId"] = self.new_model_id[1] # type: ignore[index]
|
|
267
|
-
metadata["version"] = self.new_model_id[2] # type: ignore[index]
|
|
268
|
-
elif is_solution and self.dump_as == "reference" and rules.reference:
|
|
269
|
-
metadata["prefix" if is_info else "space"] = "YOUR_PREFIX"
|
|
270
|
-
metadata["title" if is_info else "externalId"] = "YOUR_TITLE"
|
|
271
|
-
metadata["version"] = "1"
|
|
272
|
-
else:
|
|
273
|
-
metadata["prefix" if is_info else "space"] = existing_model_id[0]
|
|
274
|
-
metadata["title" if is_info else "externalId"] = existing_model_id[1]
|
|
275
|
-
metadata["version"] = existing_model_id[2]
|
|
276
|
-
|
|
277
|
-
if is_solution and is_info and self.new_model_id:
|
|
278
|
-
metadata["namespace"] = f"http://purl.org/{self.new_model_id[0]}/" # type: ignore[index]
|
|
279
|
-
elif is_info:
|
|
280
|
-
metadata["namespace"] = existing_metadata["namespace"]
|
|
281
|
-
|
|
282
|
-
if is_solution and is_dms and self.new_model_id:
|
|
283
|
-
metadata["name"] = self.new_model_id[1] # type: ignore[index]
|
|
284
|
-
|
|
285
|
-
if is_solution:
|
|
286
|
-
metadata["created"] = now_iso
|
|
287
|
-
else:
|
|
288
|
-
metadata["created"] = existing_metadata["created"]
|
|
289
|
-
|
|
290
|
-
if is_solution or is_extension:
|
|
291
|
-
metadata["updated"] = now_iso
|
|
292
|
-
else:
|
|
293
|
-
metadata["updated"] = existing_metadata["updated"]
|
|
294
241
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
else:
|
|
298
|
-
metadata["creator"] = existing_metadata["creator"]
|
|
299
|
-
|
|
300
|
-
if not is_solution:
|
|
301
|
-
metadata["description"] = existing_metadata["description"]
|
|
242
|
+
class _MetadataCreator:
|
|
243
|
+
creator_name = "<YOUR NAME>"
|
|
302
244
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
245
|
+
def __init__(
|
|
246
|
+
self,
|
|
247
|
+
action: Literal["create", "update"],
|
|
248
|
+
new_model_id: tuple[str, str] | None = None,
|
|
249
|
+
):
|
|
250
|
+
self.action = action
|
|
251
|
+
self.new_model_id = new_model_id or ("YOUR_PREFIX", "YOUR_TITLE")
|
|
252
|
+
|
|
253
|
+
def create(self, metadata: DomainMetadata | InformationMetadata | DMSMetadata) -> dict[str, Any]:
|
|
254
|
+
now = datetime.now(timezone.utc).replace(microsecond=0, tzinfo=None)
|
|
255
|
+
if self.action == "update":
|
|
256
|
+
output = json.loads(metadata.model_dump_json(by_alias=True))
|
|
257
|
+
# This is the same for Information and DMS
|
|
258
|
+
output["updated"] = now.isoformat()
|
|
259
|
+
output["schema"] = SchemaCompleteness.extended.value
|
|
260
|
+
output["extension"] = ExtensionCategory.addition.value
|
|
261
|
+
if value := output.get("creator"):
|
|
262
|
+
output["creator"] = f"{value}, {self.creator_name}"
|
|
263
|
+
else:
|
|
264
|
+
output["creator"] = self.creator_name
|
|
265
|
+
return output
|
|
266
|
+
|
|
267
|
+
# Action "create"
|
|
268
|
+
if isinstance(metadata, DomainMetadata):
|
|
269
|
+
output = {field_alias: None for field_alias in metadata.model_dump(by_alias=True).keys()}
|
|
270
|
+
output["role"] = metadata.role.value
|
|
271
|
+
output["creator"] = self.creator_name
|
|
272
|
+
return output
|
|
273
|
+
|
|
274
|
+
new_metadata = self._create_new_info(now)
|
|
275
|
+
if isinstance(metadata, DMSMetadata):
|
|
276
|
+
from cognite.neat.rules.models.information._converter import _InformationRulesConverter
|
|
277
|
+
|
|
278
|
+
output_metadata: DMSMetadata | InformationMetadata = _InformationRulesConverter._convert_metadata_to_dms(
|
|
279
|
+
new_metadata
|
|
280
|
+
)
|
|
281
|
+
elif isinstance(metadata, InformationMetadata):
|
|
282
|
+
output_metadata = new_metadata
|
|
310
283
|
else:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
return
|
|
284
|
+
raise ValueError(f"Bug in Neat: Unknown metadata type: {type(metadata)}")
|
|
285
|
+
|
|
286
|
+
created = json.loads(output_metadata.model_dump_json(by_alias=True))
|
|
287
|
+
created.pop("extension", None)
|
|
288
|
+
return created
|
|
289
|
+
|
|
290
|
+
def _create_new_info(self, now: datetime) -> InformationMetadata:
|
|
291
|
+
prefix = self.new_model_id[0]
|
|
292
|
+
return InformationMetadata(
|
|
293
|
+
data_model_type=DataModelType.solution,
|
|
294
|
+
schema_=SchemaCompleteness.extended,
|
|
295
|
+
extension=ExtensionCategory.addition,
|
|
296
|
+
prefix=prefix,
|
|
297
|
+
namespace=f"http://purl.org/neat/{prefix}/", # type: ignore[arg-type]
|
|
298
|
+
description=None,
|
|
299
|
+
version="1",
|
|
300
|
+
created=now,
|
|
301
|
+
updated=now,
|
|
302
|
+
creator=[self.creator_name],
|
|
303
|
+
name=self.new_model_id[1],
|
|
304
|
+
)
|
|
@@ -61,8 +61,10 @@ class DMSImporter(BaseImporter):
|
|
|
61
61
|
self.ref_metadata = ref_metadata
|
|
62
62
|
self.issue_list = IssueList(read_issues)
|
|
63
63
|
self._all_containers_by_id = schema.containers.copy()
|
|
64
|
+
self._all_view_ids = set(self.root_schema.views.keys())
|
|
64
65
|
if self.root_schema.reference:
|
|
65
66
|
self._all_containers_by_id.update(self.root_schema.reference.containers)
|
|
67
|
+
self._all_view_ids.update(self.root_schema.reference.views.keys())
|
|
66
68
|
|
|
67
69
|
@classmethod
|
|
68
70
|
def from_data_model_id(
|
|
@@ -100,15 +102,17 @@ class DMSImporter(BaseImporter):
|
|
|
100
102
|
else:
|
|
101
103
|
ref_model = None
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
issue_list = IssueList()
|
|
106
|
+
with _handle_issues(issue_list) as result:
|
|
104
107
|
schema = DMSSchema.from_data_model(client, user_model, ref_model)
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
|
|
109
|
+
if result.result == "failure" or issue_list.has_errors:
|
|
110
|
+
return cls(DMSSchema(), issue_list)
|
|
107
111
|
|
|
108
112
|
metadata = cls._create_metadata_from_model(user_model)
|
|
109
113
|
ref_metadata = cls._create_metadata_from_model(ref_model) if ref_model else None
|
|
110
114
|
|
|
111
|
-
return cls(schema,
|
|
115
|
+
return cls(schema, issue_list, metadata, ref_metadata)
|
|
112
116
|
|
|
113
117
|
@classmethod
|
|
114
118
|
def _find_model_in_list(
|
|
@@ -361,7 +365,7 @@ class DMSImporter(BaseImporter):
|
|
|
361
365
|
elif isinstance(prop, dm.MappedPropertyApply):
|
|
362
366
|
container_prop = self._container_prop_unsafe(cast(dm.MappedPropertyApply, prop))
|
|
363
367
|
if isinstance(container_prop.type, dm.DirectRelation):
|
|
364
|
-
if prop.source is None:
|
|
368
|
+
if prop.source is None or prop.source not in self._all_view_ids:
|
|
365
369
|
# The warning is issued when the DMS Rules are created.
|
|
366
370
|
return DMSUnknownEntity()
|
|
367
371
|
else:
|
|
@@ -30,6 +30,7 @@ __all__ = [
|
|
|
30
30
|
"HasDataFilterAppliedToTooManyContainersWarning",
|
|
31
31
|
"ReverseRelationMissingOtherSideWarning",
|
|
32
32
|
"NodeTypeFilterOnParentViewWarning",
|
|
33
|
+
"MissingViewInModelWarning",
|
|
33
34
|
"ChangingContainerError",
|
|
34
35
|
"ChangingViewError",
|
|
35
36
|
]
|
|
@@ -293,6 +294,24 @@ class ViewMapsToTooManyContainersWarning(DMSSchemaWarning):
|
|
|
293
294
|
return output
|
|
294
295
|
|
|
295
296
|
|
|
297
|
+
@dataclass(frozen=True)
|
|
298
|
+
class MissingViewInModelWarning(DMSSchemaWarning):
|
|
299
|
+
description = "The data model contains view pointing to views not present in the data model"
|
|
300
|
+
fix = "Add the view(s) to the data model"
|
|
301
|
+
error_name: ClassVar[str] = "MissingViewInModel"
|
|
302
|
+
data_model_id: dm.DataModelId
|
|
303
|
+
view_ids: set[dm.ViewId]
|
|
304
|
+
|
|
305
|
+
def message(self) -> str:
|
|
306
|
+
return f"The view(s) {self.view_ids} are missing in the data model {self.data_model_id}"
|
|
307
|
+
|
|
308
|
+
def dump(self) -> dict[str, Any]:
|
|
309
|
+
output = super().dump()
|
|
310
|
+
output["data_model_id"] = self.data_model_id.dump()
|
|
311
|
+
output["view_id"] = [view_id.dump() for view_id in self.view_ids]
|
|
312
|
+
return output
|
|
313
|
+
|
|
314
|
+
|
|
296
315
|
@dataclass(frozen=True)
|
|
297
316
|
class ContainerPropertyUsedMultipleTimesError(DMSSchemaError):
|
|
298
317
|
description = "The container property is used multiple times by the same view property"
|
|
@@ -507,6 +526,26 @@ class HasDataFilterAppliedToTooManyContainersWarning(DMSSchemaWarning):
|
|
|
507
526
|
return output
|
|
508
527
|
|
|
509
528
|
|
|
529
|
+
@dataclass(frozen=True)
|
|
530
|
+
class RawFilterAppliedToViewWarning(DMSSchemaWarning):
|
|
531
|
+
description = "Raw filter is applied to a view, which is against the neat data modeling lifecycle."
|
|
532
|
+
fix = "Do not use raw filter, instead use HasData filter or nodeType filter or change the data model design."
|
|
533
|
+
error_name: ClassVar[str] = "RawFilterAppliedToView"
|
|
534
|
+
view_id: dm.ViewId
|
|
535
|
+
|
|
536
|
+
def message(self) -> str:
|
|
537
|
+
return (
|
|
538
|
+
f"RawFilter applied to the view {self.view_id}."
|
|
539
|
+
" The usage of RawFilter is against the neat team recommendations and the neat data modeling lifecycle."
|
|
540
|
+
" When opting for raw filter, the user is responsible for any errors that arise in neat."
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
def dump(self) -> dict[str, Any]:
|
|
544
|
+
output = super().dump()
|
|
545
|
+
output["view_id"] = self.view_id.dump()
|
|
546
|
+
return output
|
|
547
|
+
|
|
548
|
+
|
|
510
549
|
@dataclass(frozen=True)
|
|
511
550
|
class NodeTypeFilterOnParentViewWarning(DMSSchemaWarning):
|
|
512
551
|
description = (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from abc import ABC
|
|
2
2
|
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
3
4
|
|
|
4
5
|
from .base import NeatValidationError, ValidationWarning
|
|
5
6
|
|
|
@@ -23,6 +24,7 @@ __all__ = [
|
|
|
23
24
|
"MissingIdentifierError",
|
|
24
25
|
"UnsupportedPropertyTypeError",
|
|
25
26
|
"APIError",
|
|
27
|
+
"FailedImportWarning",
|
|
26
28
|
]
|
|
27
29
|
|
|
28
30
|
|
|
@@ -259,6 +261,20 @@ class APIWarning(ModelImportWarning):
|
|
|
259
261
|
return {"error_message": self.error_message}
|
|
260
262
|
|
|
261
263
|
|
|
264
|
+
@dataclass(frozen=True)
|
|
265
|
+
class FailedImportWarning(ModelImportWarning):
|
|
266
|
+
description = "Failed to import part of the model."
|
|
267
|
+
fix = "No fix is available."
|
|
268
|
+
|
|
269
|
+
identifier: set[str]
|
|
270
|
+
|
|
271
|
+
def message(self) -> str:
|
|
272
|
+
return f"Failed to import: {self.identifier}. This will be skipped."
|
|
273
|
+
|
|
274
|
+
def dump(self) -> dict[str, Any]:
|
|
275
|
+
return {"identifier": list(self.identifier)}
|
|
276
|
+
|
|
277
|
+
|
|
262
278
|
@dataclass(frozen=True)
|
|
263
279
|
class ModelImportError(NeatValidationError, ABC):
|
|
264
280
|
description = "An error was raised during importing."
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import warnings
|
|
2
|
-
from
|
|
3
|
-
from typing import cast
|
|
2
|
+
from typing import TYPE_CHECKING, cast
|
|
4
3
|
|
|
5
4
|
from rdflib import Namespace
|
|
6
5
|
|
|
@@ -20,7 +19,10 @@ from cognite.neat.rules.models.entities import (
|
|
|
20
19
|
)
|
|
21
20
|
from cognite.neat.rules.models.information._rules import InformationRules
|
|
22
21
|
|
|
23
|
-
from ._rules import DMSProperty, DMSRules, DMSView
|
|
22
|
+
from ._rules import DMSMetadata, DMSProperty, DMSRules, DMSView
|
|
23
|
+
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from cognite.neat.rules.models.information._rules import InformationMetadata
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
class _DMSRulesConverter:
|
|
@@ -32,31 +34,16 @@ class _DMSRulesConverter:
|
|
|
32
34
|
|
|
33
35
|
def as_information_architect_rules(
|
|
34
36
|
self,
|
|
35
|
-
created: datetime | None = None,
|
|
36
|
-
updated: datetime | None = None,
|
|
37
|
-
name: str | None = None,
|
|
38
|
-
namespace: Namespace | None = None,
|
|
39
37
|
) -> "InformationRules":
|
|
40
38
|
from cognite.neat.rules.models.information._rules import (
|
|
41
39
|
InformationClass,
|
|
42
|
-
InformationMetadata,
|
|
43
40
|
InformationProperty,
|
|
44
41
|
InformationRules,
|
|
45
42
|
)
|
|
46
43
|
|
|
47
44
|
dms = self.dms.metadata
|
|
48
|
-
prefix = dms.space
|
|
49
45
|
|
|
50
|
-
metadata =
|
|
51
|
-
schema_=dms.schema_,
|
|
52
|
-
prefix=prefix,
|
|
53
|
-
namespace=namespace or Namespace(f"https://purl.orgl/neat/{prefix}/"),
|
|
54
|
-
version=dms.version,
|
|
55
|
-
name=name or dms.name or "Missing name",
|
|
56
|
-
creator=dms.creator,
|
|
57
|
-
created=dms.created or created or datetime.now(),
|
|
58
|
-
updated=dms.updated or updated or datetime.now(),
|
|
59
|
-
)
|
|
46
|
+
metadata = self._convert_metadata_to_info(dms)
|
|
60
47
|
|
|
61
48
|
classes = [
|
|
62
49
|
InformationClass(
|
|
@@ -111,6 +98,23 @@ class _DMSRulesConverter:
|
|
|
111
98
|
reference=self.dms.reference.as_information_architect_rules() if self.dms.reference else None,
|
|
112
99
|
)
|
|
113
100
|
|
|
101
|
+
@classmethod
|
|
102
|
+
def _convert_metadata_to_info(cls, metadata: DMSMetadata) -> "InformationMetadata":
|
|
103
|
+
from cognite.neat.rules.models.information._rules import InformationMetadata
|
|
104
|
+
|
|
105
|
+
prefix = metadata.space
|
|
106
|
+
return InformationMetadata(
|
|
107
|
+
schema_=metadata.schema_,
|
|
108
|
+
prefix=prefix,
|
|
109
|
+
namespace=Namespace(f"https://purl.orgl/neat/{prefix}/"),
|
|
110
|
+
version=metadata.version,
|
|
111
|
+
description=metadata.description,
|
|
112
|
+
name=metadata.name or metadata.external_id,
|
|
113
|
+
creator=metadata.creator,
|
|
114
|
+
created=metadata.created,
|
|
115
|
+
updated=metadata.updated,
|
|
116
|
+
)
|
|
117
|
+
|
|
114
118
|
@classmethod
|
|
115
119
|
def _get_class_reference(cls, view: DMSView) -> ReferenceEntity | None:
|
|
116
120
|
parents_other_namespace = [parent for parent in view.implements or [] if parent.prefix != view.class_.prefix]
|
|
@@ -237,7 +237,7 @@ class DMSViewInput:
|
|
|
237
237
|
description: str | None = None
|
|
238
238
|
implements: str | None = None
|
|
239
239
|
reference: str | None = None
|
|
240
|
-
filter_: Literal["hasData", "nodeType"] | None = None
|
|
240
|
+
filter_: Literal["hasData", "nodeType", "rawFilter"] | None = None
|
|
241
241
|
in_model: bool = True
|
|
242
242
|
|
|
243
243
|
@classmethod
|
|
@@ -12,6 +12,7 @@ from cognite.client import CogniteClient
|
|
|
12
12
|
from cognite.client import data_modeling as dm
|
|
13
13
|
from cognite.client.data_classes import DatabaseWrite, DatabaseWriteList, TransformationWrite, TransformationWriteList
|
|
14
14
|
from cognite.client.data_classes.data_modeling import ViewApply
|
|
15
|
+
from cognite.client.data_classes.data_modeling.views import ReverseDirectRelation
|
|
15
16
|
from cognite.client.data_classes.transformations.common import Edges, EdgeType, Nodes, ViewInfo
|
|
16
17
|
|
|
17
18
|
from cognite.neat.rules import issues
|
|
@@ -28,6 +29,7 @@ from cognite.neat.rules.issues.dms import (
|
|
|
28
29
|
MissingSourceViewError,
|
|
29
30
|
MissingSpaceError,
|
|
30
31
|
MissingViewError,
|
|
32
|
+
MissingViewInModelWarning,
|
|
31
33
|
)
|
|
32
34
|
from cognite.neat.rules.models.data_types import _DATA_TYPE_BY_DMS_TYPE
|
|
33
35
|
from cognite.neat.utils.cdf_classes import (
|
|
@@ -146,8 +148,26 @@ class DMSSchema:
|
|
|
146
148
|
space_write = space_read.as_write()
|
|
147
149
|
|
|
148
150
|
view_loader = ViewLoader(client)
|
|
149
|
-
|
|
151
|
+
|
|
150
152
|
existing_view_ids = set(views.as_ids())
|
|
153
|
+
|
|
154
|
+
# We need to include all views the edges/direct relations are pointing to have a complete schema.
|
|
155
|
+
connection_referenced_view_ids: set[dm.ViewId] = set()
|
|
156
|
+
for view in views:
|
|
157
|
+
connection_referenced_view_ids |= cls._connection_references(view)
|
|
158
|
+
connection_referenced_view_ids = connection_referenced_view_ids - existing_view_ids
|
|
159
|
+
if connection_referenced_view_ids:
|
|
160
|
+
warnings.warn(
|
|
161
|
+
MissingViewInModelWarning(data_model.as_id(), connection_referenced_view_ids), UserWarning, stacklevel=2
|
|
162
|
+
)
|
|
163
|
+
connection_referenced_views = view_loader.retrieve(list(connection_referenced_view_ids))
|
|
164
|
+
if failed := connection_referenced_view_ids - set(connection_referenced_views.as_ids()):
|
|
165
|
+
warnings.warn(
|
|
166
|
+
issues.importing.FailedImportWarning({repr(v) for v in failed}), UserWarning, stacklevel=2
|
|
167
|
+
)
|
|
168
|
+
views.extend(connection_referenced_views)
|
|
169
|
+
|
|
170
|
+
# We need to include parent views in the schema to make sure that the schema is valid.
|
|
151
171
|
parent_view_ids = {parent for view in views for parent in view.implements or []}
|
|
152
172
|
parents = view_loader.retrieve_all_parents(list(parent_view_ids - existing_view_ids))
|
|
153
173
|
views.extend([parent for parent in parents if parent.as_id() not in existing_view_ids])
|
|
@@ -203,6 +223,21 @@ class DMSSchema:
|
|
|
203
223
|
reference=ref_schema,
|
|
204
224
|
)
|
|
205
225
|
|
|
226
|
+
@classmethod
|
|
227
|
+
def _connection_references(cls, view: dm.View) -> set[dm.ViewId]:
|
|
228
|
+
view_ids: set[dm.ViewId] = set()
|
|
229
|
+
for prop in (view.properties or {}).values():
|
|
230
|
+
if isinstance(prop, dm.MappedProperty) and isinstance(prop.type, dm.DirectRelation):
|
|
231
|
+
if prop.source:
|
|
232
|
+
view_ids.add(prop.source)
|
|
233
|
+
elif isinstance(prop, dm.EdgeConnection):
|
|
234
|
+
view_ids.add(prop.source)
|
|
235
|
+
if prop.edge_source:
|
|
236
|
+
view_ids.add(prop.edge_source)
|
|
237
|
+
elif isinstance(prop, ReverseDirectRelation):
|
|
238
|
+
view_ids.add(prop.source)
|
|
239
|
+
return view_ids
|
|
240
|
+
|
|
206
241
|
@classmethod
|
|
207
242
|
def from_directory(cls, directory: str | Path) -> Self:
|
|
208
243
|
"""Load a schema from a directory containing YAML files.
|
|
@@ -8,6 +8,7 @@ from cognite.neat.rules.issues import IssueList
|
|
|
8
8
|
from cognite.neat.rules.models._base import ExtensionCategory, SchemaCompleteness
|
|
9
9
|
from cognite.neat.rules.models.data_types import DataType
|
|
10
10
|
from cognite.neat.rules.models.entities import ContainerEntity
|
|
11
|
+
from cognite.neat.rules.models.wrapped_entities import RawFilter
|
|
11
12
|
|
|
12
13
|
from ._rules import DMSProperty, DMSRules
|
|
13
14
|
|
|
@@ -25,6 +26,7 @@ class DMSPostValidation:
|
|
|
25
26
|
self.issue_list = IssueList()
|
|
26
27
|
|
|
27
28
|
def validate(self) -> IssueList:
|
|
29
|
+
self._validate_best_practices()
|
|
28
30
|
self._consistent_container_properties()
|
|
29
31
|
self._referenced_views_and_containers_are_existing()
|
|
30
32
|
self._validate_extension()
|
|
@@ -241,6 +243,15 @@ class DMSPostValidation:
|
|
|
241
243
|
)
|
|
242
244
|
)
|
|
243
245
|
|
|
246
|
+
def _validate_best_practices(self) -> None:
|
|
247
|
+
for view in self.views:
|
|
248
|
+
if view.filter_ and isinstance(view.filter_, RawFilter):
|
|
249
|
+
self.issue_list.append(
|
|
250
|
+
issues.dms.RawFilterAppliedToViewWarning(
|
|
251
|
+
view_id=view.view.as_id(),
|
|
252
|
+
)
|
|
253
|
+
)
|
|
254
|
+
|
|
244
255
|
@staticmethod
|
|
245
256
|
def _changed_attributes_and_properties(
|
|
246
257
|
new_dumped: dict[str, Any], existing_dumped: dict[str, Any]
|
{cognite_neat-0.77.1 → cognite_neat-0.77.3}/cognite/neat/rules/models/information/_converter.py
RENAMED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from collections import defaultdict
|
|
3
|
-
from
|
|
4
|
-
from typing import Literal
|
|
3
|
+
from typing import TYPE_CHECKING, Literal
|
|
5
4
|
|
|
6
5
|
from cognite.neat.rules.models._base import (
|
|
7
|
-
DataModelType,
|
|
8
6
|
SheetList,
|
|
9
7
|
)
|
|
10
8
|
from cognite.neat.rules.models.data_types import DataType
|
|
11
|
-
from cognite.neat.rules.models.dms._rules import DMSProperty, DMSRules, DMSView
|
|
12
9
|
from cognite.neat.rules.models.domain import DomainRules
|
|
13
10
|
from cognite.neat.rules.models.entities import (
|
|
14
11
|
ClassEntity,
|
|
@@ -22,6 +19,9 @@ from cognite.neat.rules.models.entities import (
|
|
|
22
19
|
|
|
23
20
|
from ._rules import InformationClass, InformationMetadata, InformationProperty, InformationRules
|
|
24
21
|
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from cognite.neat.rules.models.dms._rules import DMSMetadata, DMSProperty, DMSRules
|
|
24
|
+
|
|
25
25
|
|
|
26
26
|
class _InformationRulesConverter:
|
|
27
27
|
def __init__(self, information: InformationRules):
|
|
@@ -30,30 +30,18 @@ class _InformationRulesConverter:
|
|
|
30
30
|
def as_domain_rules(self) -> DomainRules:
|
|
31
31
|
raise NotImplementedError("DomainRules not implemented yet")
|
|
32
32
|
|
|
33
|
-
def as_dms_architect_rules(self
|
|
33
|
+
def as_dms_architect_rules(self) -> "DMSRules":
|
|
34
34
|
from cognite.neat.rules.models.dms._rules import (
|
|
35
35
|
DMSContainer,
|
|
36
|
-
DMSMetadata,
|
|
37
36
|
DMSProperty,
|
|
38
37
|
DMSRules,
|
|
38
|
+
DMSView,
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
info_metadata = self.information.metadata
|
|
42
42
|
default_version = info_metadata.version
|
|
43
43
|
default_space = self._to_space(info_metadata.prefix)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
metadata = DMSMetadata(
|
|
47
|
-
schema_=info_metadata.schema_,
|
|
48
|
-
space=space,
|
|
49
|
-
data_model_type=DataModelType.solution if self.information.reference else DataModelType.enterprise,
|
|
50
|
-
version=info_metadata.version,
|
|
51
|
-
external_id=info_metadata.name.replace(" ", "_").lower(),
|
|
52
|
-
creator=info_metadata.creator,
|
|
53
|
-
name=info_metadata.name,
|
|
54
|
-
created=created or datetime.now(),
|
|
55
|
-
updated=updated or datetime.now(),
|
|
56
|
-
)
|
|
44
|
+
metadata = self._convert_metadata_to_dms(info_metadata)
|
|
57
45
|
|
|
58
46
|
properties_by_class: dict[str, list[DMSProperty]] = defaultdict(list)
|
|
59
47
|
for prop in self.information.properties:
|
|
@@ -111,6 +99,26 @@ class _InformationRulesConverter:
|
|
|
111
99
|
reference=self.information.reference.as_dms_architect_rules() if self.information.reference else None,
|
|
112
100
|
)
|
|
113
101
|
|
|
102
|
+
@classmethod
|
|
103
|
+
def _convert_metadata_to_dms(cls, metadata: InformationMetadata) -> "DMSMetadata":
|
|
104
|
+
from cognite.neat.rules.models.dms._rules import (
|
|
105
|
+
DMSMetadata,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
space = cls._to_space(metadata.prefix)
|
|
109
|
+
|
|
110
|
+
return DMSMetadata(
|
|
111
|
+
schema_=metadata.schema_,
|
|
112
|
+
space=space,
|
|
113
|
+
data_model_type=metadata.data_model_type,
|
|
114
|
+
version=metadata.version,
|
|
115
|
+
external_id=metadata.name.replace(" ", "_").lower(),
|
|
116
|
+
creator=metadata.creator,
|
|
117
|
+
name=metadata.name,
|
|
118
|
+
created=metadata.created,
|
|
119
|
+
updated=metadata.updated,
|
|
120
|
+
)
|
|
121
|
+
|
|
114
122
|
@classmethod
|
|
115
123
|
def _as_dms_property(cls, prop: InformationProperty, default_space: str, default_version: str) -> "DMSProperty":
|
|
116
124
|
"""This creates the first"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cognite-neat"
|
|
3
|
-
version = "0.77.
|
|
3
|
+
version = "0.77.3"
|
|
4
4
|
readme = "README.md"
|
|
5
5
|
description = "Knowledge graph transformation"
|
|
6
6
|
authors = [
|
|
@@ -129,7 +129,7 @@ twine = "*"
|
|
|
129
129
|
pytest = { version = ">=8.0, <8.1" }
|
|
130
130
|
pytest-cov = "*"
|
|
131
131
|
pytest-notebook = "*"
|
|
132
|
-
|
|
132
|
+
freezegun = "^1.5.1"
|
|
133
133
|
pytest-xdist = "^3.6.1"
|
|
134
134
|
pre-commit = "*"
|
|
135
135
|
safety = "*"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.77.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|