cognite-neat 0.75.8__py3-none-any.whl → 0.76.0__py3-none-any.whl

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.

Files changed (99) hide show
  1. cognite/neat/_version.py +1 -1
  2. cognite/neat/app/api/configuration.py +4 -9
  3. cognite/neat/app/api/routers/configuration.py +2 -1
  4. cognite/neat/app/api/routers/crud.py +5 -5
  5. cognite/neat/app/api/routers/data_exploration.py +3 -1
  6. cognite/neat/app/api/routers/rules.py +3 -3
  7. cognite/neat/app/api/routers/workflows.py +3 -3
  8. cognite/neat/app/ui/neat-app/build/asset-manifest.json +3 -3
  9. cognite/neat/app/ui/neat-app/build/index.html +1 -1
  10. cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js → main.ec7f72e2.js} +3 -3
  11. cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js.map → main.ec7f72e2.js.map} +1 -1
  12. cognite/neat/config.py +147 -12
  13. cognite/neat/constants.py +1 -0
  14. cognite/neat/graph/exceptions.py +1 -2
  15. cognite/neat/legacy/graph/exceptions.py +1 -2
  16. cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +1 -2
  17. cognite/neat/legacy/graph/loaders/_asset_loader.py +8 -13
  18. cognite/neat/legacy/graph/loaders/_base.py +2 -4
  19. cognite/neat/legacy/graph/loaders/_exceptions.py +1 -3
  20. cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +4 -8
  21. cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +2 -4
  22. cognite/neat/legacy/graph/loaders/rdf_to_dms.py +2 -4
  23. cognite/neat/legacy/graph/loaders/validator.py +1 -1
  24. cognite/neat/legacy/graph/transformations/transformer.py +1 -2
  25. cognite/neat/legacy/rules/exporters/_rules2dms.py +1 -2
  26. cognite/neat/legacy/rules/exporters/_validation.py +4 -8
  27. cognite/neat/legacy/rules/importers/_base.py +0 -4
  28. cognite/neat/legacy/rules/importers/_dms2rules.py +0 -2
  29. cognite/neat/legacy/rules/models/rdfpath.py +1 -2
  30. cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +89 -0
  31. cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +152 -0
  32. cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +139 -0
  33. cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +270 -0
  34. cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +65 -0
  35. cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +116 -0
  36. cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +67 -0
  37. cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +64 -0
  38. cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +95 -0
  39. cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +111 -0
  40. cognite/neat/rules/exporters/_models.py +3 -0
  41. cognite/neat/rules/exporters/_rules2dms.py +46 -4
  42. cognite/neat/rules/exporters/_rules2excel.py +2 -11
  43. cognite/neat/rules/exporters/_validation.py +6 -8
  44. cognite/neat/rules/importers/_base.py +8 -4
  45. cognite/neat/rules/importers/_dms2rules.py +321 -129
  46. cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +2 -4
  47. cognite/neat/rules/importers/_dtdl2rules/spec.py +2 -4
  48. cognite/neat/rules/importers/_owl2rules/_owl2rules.py +2 -4
  49. cognite/neat/rules/importers/_spreadsheet2rules.py +18 -16
  50. cognite/neat/rules/importers/_yaml2rules.py +2 -4
  51. cognite/neat/rules/issues/base.py +3 -0
  52. cognite/neat/rules/issues/dms.py +144 -58
  53. cognite/neat/rules/issues/fileread.py +41 -0
  54. cognite/neat/rules/issues/formatters.py +3 -1
  55. cognite/neat/rules/issues/importing.py +155 -0
  56. cognite/neat/rules/issues/spreadsheet.py +12 -9
  57. cognite/neat/rules/models/entities.py +30 -8
  58. cognite/neat/rules/models/rdfpath.py +1 -2
  59. cognite/neat/rules/models/rules/_base.py +5 -6
  60. cognite/neat/rules/models/rules/_dms_architect_rules.py +494 -333
  61. cognite/neat/rules/models/rules/_dms_rules_write.py +43 -52
  62. cognite/neat/rules/models/rules/_dms_schema.py +112 -22
  63. cognite/neat/rules/models/rules/_domain_rules.py +5 -0
  64. cognite/neat/rules/models/rules/_information_rules.py +13 -6
  65. cognite/neat/rules/models/wrapped_entities.py +166 -0
  66. cognite/neat/utils/cdf_loaders/_data_modeling.py +3 -1
  67. cognite/neat/utils/cdf_loaders/_ingestion.py +2 -4
  68. cognite/neat/utils/spreadsheet.py +2 -4
  69. cognite/neat/utils/utils.py +2 -4
  70. cognite/neat/workflows/base.py +5 -5
  71. cognite/neat/workflows/manager.py +32 -22
  72. cognite/neat/workflows/model.py +3 -3
  73. cognite/neat/workflows/steps/lib/__init__.py +0 -7
  74. cognite/neat/workflows/steps/lib/current/__init__.py +6 -0
  75. cognite/neat/workflows/steps/lib/{rules_exporter.py → current/rules_exporter.py} +8 -8
  76. cognite/neat/workflows/steps/lib/{rules_importer.py → current/rules_importer.py} +4 -4
  77. cognite/neat/workflows/steps/lib/io/__init__.py +1 -0
  78. cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_contextualization.py +2 -2
  79. cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_extractor.py +9 -9
  80. cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_loader.py +9 -9
  81. cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_store.py +4 -4
  82. cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_transformer.py +2 -2
  83. cognite/neat/workflows/steps/lib/{v1 → legacy}/rules_exporter.py +15 -17
  84. cognite/neat/workflows/steps/lib/{v1 → legacy}/rules_importer.py +7 -7
  85. cognite/neat/workflows/steps/step_model.py +5 -9
  86. cognite/neat/workflows/steps_registry.py +20 -11
  87. {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/METADATA +1 -1
  88. {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/RECORD +98 -86
  89. cognite/neat/app/api/data_classes/configuration.py +0 -121
  90. /cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js.LICENSE.txt → main.ec7f72e2.js.LICENSE.txt} +0 -0
  91. /cognite/neat/workflows/steps/lib/{graph_extractor.py → current/graph_extractor.py} +0 -0
  92. /cognite/neat/workflows/steps/lib/{graph_loader.py → current/graph_loader.py} +0 -0
  93. /cognite/neat/workflows/steps/lib/{graph_store.py → current/graph_store.py} +0 -0
  94. /cognite/neat/workflows/steps/lib/{rules_validator.py → current/rules_validator.py} +0 -0
  95. /cognite/neat/workflows/steps/lib/{io_steps.py → io/io_steps.py} +0 -0
  96. /cognite/neat/workflows/steps/lib/{v1 → legacy}/__init__.py +0 -0
  97. {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/LICENSE +0 -0
  98. {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/WHEEL +0 -0
  99. {cognite_neat-0.75.8.dist-info → cognite_neat-0.76.0.dist-info}/entry_points.txt +0 -0
cognite/neat/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.75.8"
1
+ __version__ = "0.76.0"
@@ -7,8 +7,7 @@ from cognite.client import CogniteClient
7
7
  from fastapi import FastAPI
8
8
 
9
9
  from cognite import neat
10
- from cognite.neat.app.api.data_classes.configuration import Config, configure_logging
11
- from cognite.neat.config import copy_examples_to_directory, create_data_dir_structure
10
+ from cognite.neat.config import Config, configure_logging, copy_examples_to_directory, create_data_dir_structure
12
11
  from cognite.neat.constants import PACKAGE_DIRECTORY
13
12
  from cognite.neat.utils.cdf import ServiceCogniteClient
14
13
  from cognite.neat.utils.utils import get_cognite_client_from_config, get_cognite_client_from_token
@@ -58,11 +57,7 @@ class NeatApp:
58
57
 
59
58
  self.workflow_manager = WorkflowManager(
60
59
  client=self.cdf_client,
61
- registry_storage_type=self.config.workflows_store_type,
62
- workflows_storage_path=self.config.workflows_store_path,
63
- rules_storage_path=self.config.rules_store_path,
64
- data_store_path=self.config.data_store_path,
65
- data_set_id=self.config.cdf_default_dataset_id,
60
+ config=self.config,
66
61
  )
67
62
  self.workflow_manager.load_workflows_from_storage()
68
63
  self.triggers_manager = TriggerManager(workflow_manager=self.workflow_manager)
@@ -95,9 +90,9 @@ def create_neat_app() -> NeatApp:
95
90
  config.to_yaml(config_path)
96
91
 
97
92
  if config.load_examples:
98
- copy_examples_to_directory(config.data_store_path)
93
+ copy_examples_to_directory(config)
99
94
  else:
100
- create_data_dir_structure(config.data_store_path)
95
+ create_data_dir_structure(config)
101
96
 
102
97
  configure_logging(config.log_level, config.log_format)
103
98
  logging.info(f" Starting NEAT version {neat.__version__}")
@@ -4,7 +4,8 @@ from pathlib import Path
4
4
 
5
5
  from fastapi import APIRouter
6
6
 
7
- from cognite.neat.app.api.configuration import NEAT_APP, Config
7
+ from cognite.neat.app.api.configuration import NEAT_APP
8
+ from cognite.neat.config import Config
8
9
 
9
10
  router = APIRouter()
10
11
 
@@ -7,7 +7,7 @@ import shutil
7
7
  from fastapi import APIRouter, UploadFile
8
8
 
9
9
  from cognite.neat.app.api.configuration import NEAT_APP
10
- from cognite.neat.app.api.data_classes.configuration import Config
10
+ from cognite.neat.config import Config
11
11
  from cognite.neat.workflows.model import FlowMessage
12
12
  from cognite.neat.workflows.utils import get_file_hash
13
13
 
@@ -47,13 +47,13 @@ async def file_upload_handler(
47
47
  file_name = ""
48
48
  file_version = ""
49
49
  if file_type == "file_from_editor":
50
- upload_dir = NEAT_APP.workflow_manager.data_store_path / "workflows" / workflow_name
50
+ upload_dir = NEAT_APP.workflow_manager.config.workflows_store_path / workflow_name
51
51
  elif file_type == "workflow":
52
- upload_dir = NEAT_APP.workflow_manager.data_store_path / "workflows"
52
+ upload_dir = NEAT_APP.workflow_manager.config.workflows_store_path
53
53
  elif file_type == "staging":
54
- upload_dir = NEAT_APP.workflow_manager.data_store_path / "staging"
54
+ upload_dir = NEAT_APP.workflow_manager.config.staging_path
55
55
  elif file_type == "source_graph":
56
- upload_dir = NEAT_APP.workflow_manager.data_store_path / "source-graphs"
56
+ upload_dir = NEAT_APP.workflow_manager.config.source_graph_path
57
57
 
58
58
  for file in files:
59
59
  logging.info(
@@ -222,7 +222,9 @@ def execute_rule(request: RuleRequest):
222
222
  start_time = time.perf_counter()
223
223
  rules = cast(RulesData, workflow_context["RulesData"]).rules
224
224
  sparql_query = query_generator.build_sparql_query(
225
- graph, request.rule, prefixes=rules.prefixes # type: ignore[arg-type]
225
+ graph, # type: ignore[arg-type]
226
+ request.rule,
227
+ prefixes=rules.prefixes,
226
228
  )
227
229
  else:
228
230
  logging.error("Unknown rule type")
@@ -14,9 +14,9 @@ from cognite.neat.legacy.rules.models.rules import Class, Classes, Metadata, Pro
14
14
  from cognite.neat.rules import importers
15
15
  from cognite.neat.rules.models.rules import RoleTypes
16
16
  from cognite.neat.workflows.steps.data_contracts import RulesData
17
- from cognite.neat.workflows.steps.lib.rules_exporter import RulesToExcel
18
- from cognite.neat.workflows.steps.lib.rules_importer import ExcelToRules
19
- from cognite.neat.workflows.steps.lib.v1.rules_importer import ImportExcelToRules
17
+ from cognite.neat.workflows.steps.lib.current.rules_exporter import RulesToExcel
18
+ from cognite.neat.workflows.steps.lib.current.rules_importer import ExcelToRules
19
+ from cognite.neat.workflows.steps.lib.legacy.rules_importer import ImportExcelToRules
20
20
  from cognite.neat.workflows.utils import get_file_hash
21
21
 
22
22
  router = APIRouter()
@@ -63,8 +63,8 @@ def package_workflow(workflow_name: str):
63
63
  if NEAT_APP.cdf_store is None:
64
64
  return {"error": "NeatApp is not initialized"}
65
65
  package_file = NEAT_APP.cdf_store.package_workflow(workflow_name)
66
- hash = get_file_hash(NEAT_APP.config.data_store_path / "workflows" / package_file)
67
- return {"package": package_file, "hash": hash}
66
+ hash_ = get_file_hash(NEAT_APP.config.workflows_store_path / package_file)
67
+ return {"package": package_file, "hash": hash_}
68
68
 
69
69
 
70
70
  @router.post("/api/workflow/context-cleanup/{workflow_name}")
@@ -249,7 +249,7 @@ async def upload_file(file: UploadFile, workflow_name: str):
249
249
  if NEAT_APP.workflow_manager is None or NEAT_APP.workflow_manager.data_store_path is None:
250
250
  return JSONResponse(content={"error": "Workflow Manager is not initialized"}, status_code=400)
251
251
  try:
252
- upload_dir = NEAT_APP.workflow_manager.data_store_path / "workflows" / workflow_name
252
+ upload_dir = NEAT_APP.workflow_manager.config.workflows_store_path / workflow_name
253
253
  # Create a directory to store uploaded files if it doesn't exist
254
254
 
255
255
  # Define the file path where the uploaded file will be saved
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.38a62222.css",
4
- "main.js": "./static/js/main.4345d42f.js",
4
+ "main.js": "./static/js/main.ec7f72e2.js",
5
5
  "static/media/logo.svg": "./static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg",
6
6
  "index.html": "./index.html",
7
7
  "main.38a62222.css.map": "./static/css/main.38a62222.css.map",
8
- "main.4345d42f.js.map": "./static/js/main.4345d42f.js.map"
8
+ "main.ec7f72e2.js.map": "./static/js/main.ec7f72e2.js.map"
9
9
  },
10
10
  "entrypoints": [
11
11
  "static/css/main.38a62222.css",
12
- "static/js/main.4345d42f.js"
12
+ "static/js/main.ec7f72e2.js"
13
13
  ]
14
14
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./logo192.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="NEAT controll panel"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>NEAT App</title><script defer="defer" src="./static/js/main.4345d42f.js"></script><link href="./static/css/main.38a62222.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./logo192.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="NEAT controll panel"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>NEAT App</title><script defer="defer" src="./static/js/main.ec7f72e2.js"></script><link href="./static/css/main.38a62222.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>