cognite-neat 0.103.1__py3-none-any.whl → 0.105.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 (175) hide show
  1. cognite/neat/_client/_api/data_modeling_loaders.py +83 -23
  2. cognite/neat/_client/_api/schema.py +2 -1
  3. cognite/neat/_client/data_classes/neat_sequence.py +261 -0
  4. cognite/neat/_client/data_classes/schema.py +5 -1
  5. cognite/neat/_client/testing.py +33 -0
  6. cognite/neat/_constants.py +56 -0
  7. cognite/neat/_graph/extractors/_classic_cdf/_base.py +6 -5
  8. cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +225 -11
  9. cognite/neat/_graph/extractors/_mock_graph_generator.py +2 -2
  10. cognite/neat/_graph/loaders/_rdf2dms.py +13 -2
  11. cognite/neat/_graph/transformers/__init__.py +3 -1
  12. cognite/neat/_graph/transformers/_base.py +109 -1
  13. cognite/neat/_graph/transformers/_classic_cdf.py +6 -1
  14. cognite/neat/_graph/transformers/_prune_graph.py +103 -47
  15. cognite/neat/_graph/transformers/_rdfpath.py +41 -17
  16. cognite/neat/_graph/transformers/_value_type.py +188 -151
  17. cognite/neat/_issues/__init__.py +0 -2
  18. cognite/neat/_issues/_base.py +54 -43
  19. cognite/neat/_issues/warnings/__init__.py +4 -1
  20. cognite/neat/_issues/warnings/_general.py +7 -0
  21. cognite/neat/_issues/warnings/_resources.py +12 -1
  22. cognite/neat/_rules/_shared.py +18 -34
  23. cognite/neat/_rules/exporters/_base.py +28 -2
  24. cognite/neat/_rules/exporters/_rules2dms.py +39 -1
  25. cognite/neat/_rules/exporters/_rules2excel.py +13 -2
  26. cognite/neat/_rules/exporters/_rules2instance_template.py +4 -0
  27. cognite/neat/_rules/exporters/_rules2ontology.py +13 -1
  28. cognite/neat/_rules/exporters/_rules2yaml.py +4 -0
  29. cognite/neat/_rules/importers/_base.py +9 -0
  30. cognite/neat/_rules/importers/_dms2rules.py +80 -57
  31. cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +5 -2
  32. cognite/neat/_rules/importers/_rdf/_base.py +10 -8
  33. cognite/neat/_rules/importers/_rdf/_imf2rules.py +4 -0
  34. cognite/neat/_rules/importers/_rdf/_inference2rules.py +7 -0
  35. cognite/neat/_rules/importers/_rdf/_owl2rules.py +4 -0
  36. cognite/neat/_rules/importers/_spreadsheet2rules.py +17 -8
  37. cognite/neat/_rules/importers/_yaml2rules.py +21 -7
  38. cognite/neat/_rules/models/_base_input.py +1 -1
  39. cognite/neat/_rules/models/_base_rules.py +9 -1
  40. cognite/neat/_rules/models/dms/_rules.py +4 -0
  41. cognite/neat/_rules/models/dms/_rules_input.py +9 -0
  42. cognite/neat/_rules/models/entities/_wrapped.py +10 -5
  43. cognite/neat/_rules/models/information/_rules.py +4 -0
  44. cognite/neat/_rules/models/information/_rules_input.py +9 -0
  45. cognite/neat/_rules/models/mapping/_classic2core.py +2 -5
  46. cognite/neat/_rules/models/mapping/_classic2core.yaml +239 -38
  47. cognite/neat/_rules/transformers/__init__.py +13 -6
  48. cognite/neat/_rules/transformers/_base.py +41 -65
  49. cognite/neat/_rules/transformers/_converters.py +404 -234
  50. cognite/neat/_rules/transformers/_mapping.py +93 -72
  51. cognite/neat/_rules/transformers/_verification.py +50 -38
  52. cognite/neat/_session/_base.py +32 -121
  53. cognite/neat/_session/_inspect.py +5 -3
  54. cognite/neat/_session/_mapping.py +17 -105
  55. cognite/neat/_session/_prepare.py +138 -268
  56. cognite/neat/_session/_read.py +39 -195
  57. cognite/neat/_session/_set.py +6 -30
  58. cognite/neat/_session/_show.py +40 -21
  59. cognite/neat/_session/_state.py +49 -107
  60. cognite/neat/_session/_to.py +44 -33
  61. cognite/neat/_shared.py +23 -2
  62. cognite/neat/_store/_provenance.py +3 -82
  63. cognite/neat/_store/_rules_store.py +368 -10
  64. cognite/neat/_store/exceptions.py +23 -0
  65. cognite/neat/_utils/graph_transformations_report.py +36 -0
  66. cognite/neat/_utils/rdf_.py +8 -0
  67. cognite/neat/_utils/reader/_base.py +27 -0
  68. cognite/neat/_utils/spreadsheet.py +5 -4
  69. cognite/neat/_version.py +1 -1
  70. {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/METADATA +3 -2
  71. cognite_neat-0.105.0.dist-info/RECORD +179 -0
  72. {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/WHEEL +1 -1
  73. cognite/neat/_app/api/__init__.py +0 -0
  74. cognite/neat/_app/api/asgi/metrics.py +0 -4
  75. cognite/neat/_app/api/configuration.py +0 -98
  76. cognite/neat/_app/api/context_manager/__init__.py +0 -3
  77. cognite/neat/_app/api/context_manager/manager.py +0 -16
  78. cognite/neat/_app/api/data_classes/__init__.py +0 -0
  79. cognite/neat/_app/api/data_classes/rest.py +0 -59
  80. cognite/neat/_app/api/explorer.py +0 -66
  81. cognite/neat/_app/api/routers/configuration.py +0 -25
  82. cognite/neat/_app/api/routers/crud.py +0 -102
  83. cognite/neat/_app/api/routers/metrics.py +0 -10
  84. cognite/neat/_app/api/routers/workflows.py +0 -224
  85. cognite/neat/_app/api/utils/__init__.py +0 -0
  86. cognite/neat/_app/api/utils/data_mapping.py +0 -17
  87. cognite/neat/_app/api/utils/logging.py +0 -26
  88. cognite/neat/_app/api/utils/query_templates.py +0 -92
  89. cognite/neat/_app/main.py +0 -17
  90. cognite/neat/_app/monitoring/__init__.py +0 -0
  91. cognite/neat/_app/monitoring/metrics.py +0 -69
  92. cognite/neat/_app/ui/index.html +0 -1
  93. cognite/neat/_app/ui/neat-app/.gitignore +0 -23
  94. cognite/neat/_app/ui/neat-app/README.md +0 -70
  95. cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -14
  96. cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
  97. cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -116
  98. cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -112
  99. cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -34
  100. cognite/neat/_app/ui/neat-app/build/index.html +0 -1
  101. cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
  102. cognite/neat/_app/ui/neat-app/build/manifest.json +0 -25
  103. cognite/neat/_app/ui/neat-app/build/robots.txt +0 -3
  104. cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -2
  105. cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -1
  106. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -3
  107. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -88
  108. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -1
  109. cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
  110. cognite/neat/_app/ui/neat-app/package-lock.json +0 -18306
  111. cognite/neat/_app/ui/neat-app/package.json +0 -62
  112. cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
  113. cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -116
  114. cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -112
  115. cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -34
  116. cognite/neat/_app/ui/neat-app/public/index.html +0 -43
  117. cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
  118. cognite/neat/_app/ui/neat-app/public/manifest.json +0 -25
  119. cognite/neat/_app/ui/neat-app/public/robots.txt +0 -3
  120. cognite/neat/_app/ui/neat-app/src/App.css +0 -38
  121. cognite/neat/_app/ui/neat-app/src/App.js +0 -17
  122. cognite/neat/_app/ui/neat-app/src/App.test.js +0 -8
  123. cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -70
  124. cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -43
  125. cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -124
  126. cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -63
  127. cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -511
  128. cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -36
  129. cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -56
  130. cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -60
  131. cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -112
  132. cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -67
  133. cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -79
  134. cognite/neat/_app/ui/neat-app/src/index.css +0 -13
  135. cognite/neat/_app/ui/neat-app/src/index.js +0 -13
  136. cognite/neat/_app/ui/neat-app/src/logo.svg +0 -1
  137. cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -13
  138. cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -5
  139. cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -388
  140. cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -61
  141. cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -184
  142. cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -180
  143. cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -570
  144. cognite/neat/_app/ui/neat-app/tsconfig.json +0 -27
  145. cognite/neat/_rules/transformers/_pipelines.py +0 -70
  146. cognite/neat/_workflows/__init__.py +0 -17
  147. cognite/neat/_workflows/base.py +0 -590
  148. cognite/neat/_workflows/cdf_store.py +0 -393
  149. cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -89
  150. cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -66
  151. cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -65
  152. cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -67
  153. cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -64
  154. cognite/neat/_workflows/manager.py +0 -292
  155. cognite/neat/_workflows/model.py +0 -203
  156. cognite/neat/_workflows/steps/__init__.py +0 -0
  157. cognite/neat/_workflows/steps/data_contracts.py +0 -109
  158. cognite/neat/_workflows/steps/lib/__init__.py +0 -0
  159. cognite/neat/_workflows/steps/lib/current/__init__.py +0 -6
  160. cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -100
  161. cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -51
  162. cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -48
  163. cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -537
  164. cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -398
  165. cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -106
  166. cognite/neat/_workflows/steps/lib/io/__init__.py +0 -1
  167. cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -393
  168. cognite/neat/_workflows/steps/step_model.py +0 -79
  169. cognite/neat/_workflows/steps_registry.py +0 -218
  170. cognite/neat/_workflows/tasks.py +0 -18
  171. cognite/neat/_workflows/triggers.py +0 -169
  172. cognite/neat/_workflows/utils.py +0 -19
  173. cognite_neat-0.103.1.dist-info/RECORD +0 -275
  174. {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/LICENSE +0 -0
  175. {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/entry_points.txt +0 -0
@@ -16,6 +16,7 @@ from cognite.neat._rules.models.information import (
16
16
  InformationMetadata,
17
17
  )
18
18
  from cognite.neat._store import NeatGraphStore
19
+ from cognite.neat._store._provenance import INSTANCES_ENTITY
19
20
  from cognite.neat._utils.rdf_ import remove_namespace_from_uri, uri_to_short_form
20
21
 
21
22
  from ._base import DEFAULT_NON_EXISTING_NODE_TYPE, BaseRDFImporter
@@ -94,6 +95,7 @@ class InferenceImporter(BaseRDFImporter):
94
95
  max_number_of_instance: int = -1,
95
96
  non_existing_node_type: UnknownEntity | AnyURI = DEFAULT_NON_EXISTING_NODE_TYPE,
96
97
  language: str = "en",
98
+ source_name: str = "Unknown",
97
99
  ) -> "InferenceImporter":
98
100
  return super().from_file(
99
101
  filepath,
@@ -101,6 +103,7 @@ class InferenceImporter(BaseRDFImporter):
101
103
  max_number_of_instance,
102
104
  non_existing_node_type,
103
105
  language,
106
+ source_name=source_name,
104
107
  )
105
108
 
106
109
  @classmethod
@@ -283,3 +286,7 @@ class InferenceImporter(BaseRDFImporter):
283
286
  updated=now,
284
287
  description="Inferred model from knowledge graph",
285
288
  )
289
+
290
+ @property
291
+ def source_uri(self) -> URIRef:
292
+ return INSTANCES_ENTITY.id_
@@ -78,3 +78,7 @@ class OWLImporter(BaseRDFImporter):
78
78
  }
79
79
 
80
80
  return components
81
+
82
+ @property
83
+ def description(self) -> str:
84
+ return f"Ontology {self.source_name} read as unverified data model"
@@ -11,9 +11,9 @@ from typing import Literal, cast
11
11
  import pandas as pd
12
12
  from cognite.client.utils._importing import local_import
13
13
  from pandas import ExcelFile
14
- from rdflib import Namespace
14
+ from rdflib import Namespace, URIRef
15
15
 
16
- from cognite.neat._issues import IssueList
16
+ from cognite.neat._issues import IssueList, MultiValueError
17
17
  from cognite.neat._issues.errors import (
18
18
  FileMissingRequiredFieldError,
19
19
  FileNotFoundNeatError,
@@ -253,18 +253,19 @@ class ExcelImporter(BaseImporter[T_InputRules]):
253
253
  def to_rules(self) -> ReadRules[T_InputRules]:
254
254
  issue_list = IssueList(title=f"'{self.filepath.name}'")
255
255
  if not self.filepath.exists():
256
- issue_list.append(FileNotFoundNeatError(self.filepath))
257
- return ReadRules(None, issue_list, {})
256
+ raise FileNotFoundNeatError(self.filepath)
258
257
 
259
258
  with pd.ExcelFile(self.filepath) as excel_file:
260
259
  user_reader = SpreadsheetReader(issue_list)
261
260
 
262
261
  user_read = user_reader.read(excel_file, self.filepath)
263
- if user_read is None or issue_list.has_errors:
264
- return ReadRules(None, issue_list, {})
265
262
 
263
+ issue_list.trigger_warnings()
266
264
  if issue_list.has_errors:
267
- return ReadRules(None, issue_list, {})
265
+ raise MultiValueError(issue_list.errors)
266
+
267
+ if user_read is None:
268
+ return ReadRules(None, {})
268
269
 
269
270
  sheets = user_read.sheets
270
271
  original_role = user_read.role
@@ -272,7 +273,15 @@ class ExcelImporter(BaseImporter[T_InputRules]):
272
273
 
273
274
  rules_cls = INPUT_RULES_BY_ROLE[original_role]
274
275
  rules = cast(T_InputRules, rules_cls.load(sheets))
275
- return ReadRules(rules, issue_list, {"read_info_by_sheet": read_info_by_sheet})
276
+ return ReadRules(rules, {"read_info_by_sheet": read_info_by_sheet})
277
+
278
+ @property
279
+ def description(self) -> str:
280
+ return f"Excel file {self.filepath.name} read as unverified data model"
281
+
282
+ @property
283
+ def source_uri(self) -> URIRef:
284
+ return URIRef(f"file://{self.filepath.name}")
276
285
 
277
286
 
278
287
  class GoogleSheetImporter(BaseImporter[T_InputRules]):
@@ -3,7 +3,7 @@ from typing import Any, cast
3
3
 
4
4
  import yaml
5
5
 
6
- from cognite.neat._issues import IssueList, NeatIssue
6
+ from cognite.neat._issues import IssueList, MultiValueError, NeatIssue
7
7
  from cognite.neat._issues.errors import (
8
8
  FileMissingRequiredFieldError,
9
9
  FileNotAFileError,
@@ -36,24 +36,32 @@ class YAMLImporter(BaseImporter[T_InputRules]):
36
36
  raw_data: dict[str, Any],
37
37
  read_issues: list[NeatIssue] | None = None,
38
38
  filepaths: list[Path] | None = None,
39
+ source_name: str = "Unknown",
39
40
  ) -> None:
40
41
  self.raw_data = raw_data
41
42
  self._read_issues = IssueList(read_issues)
42
43
  self._filepaths = filepaths
44
+ self._source_name = source_name
45
+
46
+ @property
47
+ def description(self) -> str:
48
+ return f"YAML file {self._source_name} read as unverified data model"
43
49
 
44
50
  @classmethod
45
- def from_file(cls, filepath: Path):
51
+ def from_file(cls, filepath: Path, source_name: str = "Unknown") -> "YAMLImporter":
46
52
  if not filepath.exists():
47
53
  return cls({}, [FileNotFoundNeatError(filepath)])
48
54
  elif not filepath.is_file():
49
55
  return cls({}, [FileNotAFileError(filepath)])
50
56
  elif filepath.suffix not in [".yaml", ".yml"]:
51
57
  return cls({}, [FileTypeUnexpectedError(filepath, frozenset([".yaml", ".yml"]))])
52
- return cls(yaml.safe_load(filepath.read_text()), filepaths=[filepath])
58
+ return cls(yaml.safe_load(filepath.read_text()), filepaths=[filepath], source_name=source_name)
53
59
 
54
60
  def to_rules(self) -> ReadRules[T_InputRules]:
55
61
  if self._read_issues.has_errors or not self.raw_data:
56
- return ReadRules(None, self._read_issues, {})
62
+ self._read_issues.trigger_warnings()
63
+ raise MultiValueError(self._read_issues.errors)
64
+
57
65
  issue_list = IssueList(title="YAML Importer", issues=self._read_issues)
58
66
 
59
67
  if not self._filepaths:
@@ -69,13 +77,15 @@ class YAMLImporter(BaseImporter[T_InputRules]):
69
77
 
70
78
  if "metadata" not in self.raw_data:
71
79
  self._read_issues.append(FileMissingRequiredFieldError(metadata_file, "section", "metadata"))
72
- return ReadRules(None, self._read_issues, {})
80
+ issue_list.trigger_warnings()
81
+ raise MultiValueError(self._read_issues.errors)
73
82
 
74
83
  metadata = self.raw_data["metadata"]
75
84
 
76
85
  if "role" not in metadata:
77
86
  self._read_issues.append(FileMissingRequiredFieldError(metadata, "metadata", "role"))
78
- return ReadRules(None, self._read_issues, {})
87
+ issue_list.trigger_warnings()
88
+ raise MultiValueError(self._read_issues.errors)
79
89
 
80
90
  role_input = RoleTypes(metadata["role"])
81
91
  role_enum = RoleTypes(role_input)
@@ -83,4 +93,8 @@ class YAMLImporter(BaseImporter[T_InputRules]):
83
93
 
84
94
  rules = cast(T_InputRules, rules_cls.load(self.raw_data))
85
95
 
86
- return ReadRules(rules, issue_list, {})
96
+ issue_list.trigger_warnings()
97
+ if self._read_issues.has_errors:
98
+ raise MultiValueError(self._read_issues.errors)
99
+
100
+ return ReadRules[T_InputRules](rules, {})
@@ -110,7 +110,7 @@ class InputRules(Generic[T_BaseRules], ABC):
110
110
  def _dataclass_fields(self) -> list[Field]:
111
111
  return list(fields(self))
112
112
 
113
- def as_rules(self) -> T_BaseRules:
113
+ def as_verified_rules(self) -> T_BaseRules:
114
114
  cls_ = self._get_verified_cls()
115
115
  return cls_.model_validate(self.dump())
116
116
 
@@ -50,6 +50,7 @@ from cognite.neat._rules.models._types import (
50
50
  )
51
51
  from cognite.neat._rules.models.data_types import DataType
52
52
  from cognite.neat._rules.models.entities import EdgeEntity, ReverseConnectionEntity, ViewEntity
53
+ from cognite.neat._utils.rdf_ import uri_display_name
53
54
 
54
55
  if sys.version_info >= (3, 11):
55
56
  from enum import StrEnum
@@ -285,6 +286,10 @@ class BaseRules(SchemaModel, ABC):
285
286
  ]
286
287
  return headers_by_sheet
287
288
 
289
+ @property
290
+ def display_name(self):
291
+ return uri_display_name(self.metadata.identifier)
292
+
288
293
  def dump(
289
294
  self,
290
295
  entities_exclude_defaults: bool = True,
@@ -393,7 +398,10 @@ class SheetList(list, MutableSequence[T_SheetRow]):
393
398
 
394
399
  def _repr_html_(self) -> str:
395
400
  """Returns HTML representation of ResourceDict."""
396
- return self.to_pandas(drop_na_columns=True)._repr_html_() # type: ignore[operator]
401
+ df = self.to_pandas(drop_na_columns=True)
402
+ if "neatId" in df.columns:
403
+ df = df.drop(columns=["neatId"])
404
+ return df._repr_html_() # type: ignore[operator]
397
405
 
398
406
  # Implemented to get correct type hints
399
407
  def __iter__(self) -> Iterator[T_SheetRow]:
@@ -447,6 +447,10 @@ class DMSRules(BaseRules):
447
447
 
448
448
  return _DMSExporter(self, instance_space, remove_cdf_spaces=remove_cdf_spaces).to_schema()
449
449
 
450
+ @classmethod
451
+ def display_type_name(cls) -> str:
452
+ return "VerifiedDMSModel"
453
+
450
454
  def _repr_html_(self) -> str:
451
455
  summary = {
452
456
  "aspect": self.metadata.aspect,
@@ -21,6 +21,7 @@ from cognite.neat._rules.models.entities import (
21
21
  load_connection,
22
22
  load_dms_value_type,
23
23
  )
24
+ from cognite.neat._utils.rdf_ import uri_display_name
24
25
 
25
26
  from ._rules import _DEFAULT_VERSION, DMSContainer, DMSEnum, DMSMetadata, DMSNode, DMSProperty, DMSRules, DMSView
26
27
 
@@ -289,6 +290,14 @@ class DMSInputRules(InputRules[DMSRules]):
289
290
  "Nodes": [node_type.dump(default_space) for node_type in self.nodes or []] or None,
290
291
  }
291
292
 
293
+ @classmethod
294
+ def display_type_name(cls) -> str:
295
+ return "UnverifiedDMSModel"
296
+
297
+ @property
298
+ def display_name(self):
299
+ return uri_display_name(self.metadata.identifier)
300
+
292
301
  def _repr_html_(self) -> str:
293
302
  summary = {
294
303
  "type": "Physical Data Model",
@@ -9,7 +9,7 @@ from cognite.client import data_modeling as dm
9
9
  from cognite.client.data_classes.data_modeling import ContainerId, NodeId
10
10
  from pydantic import BaseModel, model_serializer, model_validator
11
11
 
12
- from ._single_value import ContainerEntity, DMSNodeEntity, Entity
12
+ from ._single_value import ContainerEntity, DMSNodeEntity, Entity, ViewEntity
13
13
 
14
14
 
15
15
  @total_ordering
@@ -121,6 +121,8 @@ class DMSFilter(WrappedEntity):
121
121
  return HasDataFilter(
122
122
  inner=[
123
123
  ContainerEntity(space=entry["space"], externalId=entry["externalId"])
124
+ if entry["type"] == "container"
125
+ else ViewEntity(space=entry["space"], externalId=entry["externalId"], version=entry["version"])
124
126
  for entry in body
125
127
  if isinstance(entry, dict) and "space" in entry and "externalId" in entry
126
128
  ]
@@ -161,21 +163,24 @@ class NodeTypeFilter(DMSFilter):
161
163
 
162
164
  class HasDataFilter(DMSFilter):
163
165
  name: ClassVar[str] = "hasData"
164
- _inner_cls: ClassVar[type[ContainerEntity]] = ContainerEntity
165
- inner: list[ContainerEntity] | None = None # type: ignore[assignment]
166
+ _inner_cls: ClassVar[type[ContainerEntity | ViewEntity]] = ContainerEntity
167
+ inner: list[ContainerEntity | ViewEntity] | None = None # type: ignore[assignment]
166
168
 
167
169
  def as_dms_filter(self, default: Collection[ContainerId] | None = None) -> dm.Filter:
168
170
  containers: list[ContainerId]
169
171
  if self.inner:
170
- containers = [container.as_id() for container in self.inner]
172
+ containers = [item.as_id() for item in self.inner if isinstance(item, ContainerEntity)]
173
+ views = [item.as_id() for item in self.inner if isinstance(item, ViewEntity)]
171
174
  elif default:
172
175
  containers = list(default)
176
+ views = []
173
177
  else:
174
178
  raise ValueError("Empty hasData filter, please provide a default containers.")
175
179
 
176
180
  return dm.filters.HasData(
177
181
  # Sorting to ensure deterministic order
178
- containers=sorted(containers, key=lambda container: container.as_tuple()) # type: ignore[union-attr]
182
+ containers=sorted(containers, key=lambda container: container.as_tuple()), # type: ignore[union-attr]
183
+ views=sorted(views, key=lambda view: view.as_tuple()), # type: ignore[union-attr]
179
184
  )
180
185
 
181
186
 
@@ -272,6 +272,10 @@ class InformationRules(BaseRules):
272
272
 
273
273
  return _InformationRulesConverter(self).as_dms_rules()
274
274
 
275
+ @classmethod
276
+ def display_type_name(cls) -> str:
277
+ return "VerifiedInformationModel"
278
+
275
279
  def _repr_html_(self) -> str:
276
280
  summary = {
277
281
  "type": "Logical Data Model",
@@ -14,6 +14,7 @@ from cognite.neat._rules.models.entities import (
14
14
  UnknownEntity,
15
15
  load_value_type,
16
16
  )
17
+ from cognite.neat._utils.rdf_ import uri_display_name
17
18
 
18
19
  from ._rules import (
19
20
  InformationClass,
@@ -150,6 +151,14 @@ class InformationInputRules(InputRules[InformationRules]):
150
151
  Prefixes=self.prefixes,
151
152
  )
152
153
 
154
+ @classmethod
155
+ def display_type_name(cls) -> str:
156
+ return "UnverifiedInformationModel"
157
+
158
+ @property
159
+ def display_name(self):
160
+ return uri_display_name(self.metadata.identifier)
161
+
153
162
  def _repr_html_(self) -> str:
154
163
  summary = {
155
164
  "type": "Logical Data Model",
@@ -32,9 +32,6 @@ def load_classic_to_core_mapping(org_name: str, source_space: str, source_versio
32
32
  if not isinstance(read.rules, DMSInputRules):
33
33
  raise NeatValueError(f"Expected DMS rules, but got {type(read.rules).__name__}")
34
34
 
35
- verified = VerifyDMSRules(errors="raise", validate=False).transform(read)
35
+ verified = VerifyDMSRules(validate=False).transform(read)
36
36
 
37
- if verified.rules is None:
38
- raise NeatValueError("Failed to verify the rules.")
39
-
40
- return verified.rules
37
+ return verified