cognite-neat 0.109.4__py3-none-any.whl → 0.111.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 (88) hide show
  1. cognite/neat/_alpha.py +8 -0
  2. cognite/neat/_client/_api/schema.py +43 -1
  3. cognite/neat/_client/data_classes/schema.py +4 -4
  4. cognite/neat/_constants.py +15 -1
  5. cognite/neat/_graph/extractors/__init__.py +4 -0
  6. cognite/neat/_graph/extractors/_classic_cdf/_base.py +8 -16
  7. cognite/neat/_graph/extractors/_classic_cdf/_classic.py +48 -19
  8. cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +23 -17
  9. cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +15 -17
  10. cognite/neat/_graph/extractors/_dict.py +102 -0
  11. cognite/neat/_graph/extractors/_dms.py +27 -40
  12. cognite/neat/_graph/extractors/_dms_graph.py +30 -3
  13. cognite/neat/_graph/extractors/_iodd.py +3 -3
  14. cognite/neat/_graph/extractors/_mock_graph_generator.py +9 -7
  15. cognite/neat/_graph/extractors/_raw.py +67 -0
  16. cognite/neat/_graph/loaders/_base.py +20 -4
  17. cognite/neat/_graph/loaders/_rdf2dms.py +476 -383
  18. cognite/neat/_graph/queries/_base.py +163 -133
  19. cognite/neat/_graph/transformers/__init__.py +1 -3
  20. cognite/neat/_graph/transformers/_classic_cdf.py +6 -22
  21. cognite/neat/_graph/transformers/_rdfpath.py +2 -49
  22. cognite/neat/_issues/__init__.py +1 -6
  23. cognite/neat/_issues/_base.py +21 -252
  24. cognite/neat/_issues/_contextmanagers.py +46 -0
  25. cognite/neat/_issues/_factory.py +69 -0
  26. cognite/neat/_issues/errors/__init__.py +20 -4
  27. cognite/neat/_issues/errors/_external.py +7 -0
  28. cognite/neat/_issues/errors/_wrapper.py +81 -3
  29. cognite/neat/_issues/formatters.py +4 -4
  30. cognite/neat/_issues/warnings/__init__.py +3 -2
  31. cognite/neat/_issues/warnings/_properties.py +8 -0
  32. cognite/neat/_issues/warnings/user_modeling.py +12 -0
  33. cognite/neat/_rules/_constants.py +12 -0
  34. cognite/neat/_rules/_shared.py +3 -2
  35. cognite/neat/_rules/analysis/__init__.py +2 -3
  36. cognite/neat/_rules/analysis/_base.py +430 -259
  37. cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
  38. cognite/neat/_rules/exporters/_rules2excel.py +3 -9
  39. cognite/neat/_rules/exporters/_rules2instance_template.py +2 -2
  40. cognite/neat/_rules/exporters/_rules2ontology.py +5 -4
  41. cognite/neat/_rules/importers/_base.py +2 -47
  42. cognite/neat/_rules/importers/_dms2rules.py +7 -10
  43. cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +2 -2
  44. cognite/neat/_rules/importers/_rdf/_inference2rules.py +66 -26
  45. cognite/neat/_rules/importers/_rdf/_shared.py +1 -1
  46. cognite/neat/_rules/importers/_spreadsheet2rules.py +12 -9
  47. cognite/neat/_rules/models/_base_rules.py +0 -2
  48. cognite/neat/_rules/models/data_types.py +7 -0
  49. cognite/neat/_rules/models/dms/_exporter.py +9 -8
  50. cognite/neat/_rules/models/dms/_rules.py +29 -2
  51. cognite/neat/_rules/models/dms/_rules_input.py +9 -1
  52. cognite/neat/_rules/models/dms/_validation.py +115 -5
  53. cognite/neat/_rules/models/entities/_loaders.py +1 -1
  54. cognite/neat/_rules/models/entities/_multi_value.py +2 -2
  55. cognite/neat/_rules/models/entities/_single_value.py +8 -3
  56. cognite/neat/_rules/models/entities/_wrapped.py +2 -2
  57. cognite/neat/_rules/models/information/_rules.py +18 -17
  58. cognite/neat/_rules/models/information/_rules_input.py +3 -1
  59. cognite/neat/_rules/models/information/_validation.py +66 -17
  60. cognite/neat/_rules/transformers/__init__.py +8 -2
  61. cognite/neat/_rules/transformers/_converters.py +234 -44
  62. cognite/neat/_rules/transformers/_verification.py +5 -10
  63. cognite/neat/_session/_base.py +6 -4
  64. cognite/neat/_session/_explore.py +39 -0
  65. cognite/neat/_session/_inspect.py +25 -6
  66. cognite/neat/_session/_prepare.py +12 -0
  67. cognite/neat/_session/_read.py +88 -20
  68. cognite/neat/_session/_set.py +7 -1
  69. cognite/neat/_session/_show.py +11 -123
  70. cognite/neat/_session/_state.py +6 -2
  71. cognite/neat/_session/_subset.py +64 -0
  72. cognite/neat/_session/_to.py +177 -19
  73. cognite/neat/_store/_graph_store.py +9 -246
  74. cognite/neat/_utils/rdf_.py +36 -5
  75. cognite/neat/_utils/spreadsheet.py +44 -1
  76. cognite/neat/_utils/text.py +124 -37
  77. cognite/neat/_utils/upload.py +2 -0
  78. cognite/neat/_version.py +2 -2
  79. {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/METADATA +1 -1
  80. {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/RECORD +83 -82
  81. {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/WHEEL +1 -1
  82. cognite/neat/_graph/queries/_construct.py +0 -187
  83. cognite/neat/_graph/queries/_shared.py +0 -173
  84. cognite/neat/_rules/analysis/_dms.py +0 -57
  85. cognite/neat/_rules/analysis/_information.py +0 -249
  86. cognite/neat/_rules/models/_rdfpath.py +0 -372
  87. {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/LICENSE +0 -0
  88. {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/entry_points.txt +0 -0
@@ -2,7 +2,7 @@
2
2
  conflicts with the built-in Python warnings module. However, it is expected to always be used in an absolute
3
3
  import, and should thus not cause a naming conflict."""
4
4
 
5
- from cognite.neat._issues._base import DefaultWarning, NeatWarning, _get_subclasses
5
+ from cognite.neat._issues._base import NeatWarning, _get_subclasses
6
6
 
7
7
  from . import user_modeling
8
8
  from ._external import (
@@ -29,6 +29,7 @@ from ._properties import (
29
29
  PropertyDataTypeConversionWarning,
30
30
  PropertyDefinitionDuplicatedWarning,
31
31
  PropertyDirectRelationLimitWarning,
32
+ PropertyMultipleValueWarning,
32
33
  PropertyNotFoundWarning,
33
34
  PropertyOverwritingWarning,
34
35
  PropertyTypeNotSupportedWarning,
@@ -49,7 +50,6 @@ __all__ = [
49
50
  "CDFAuthWarning",
50
51
  "CDFMaxIterationsWarning",
51
52
  "CDFNotSupportedWarning",
52
- "DefaultWarning",
53
53
  "FileItemNotSupportedWarning",
54
54
  "FileMissingRequiredFieldWarning",
55
55
  "FileReadWarning",
@@ -65,6 +65,7 @@ __all__ = [
65
65
  "PropertyDataTypeConversionWarning",
66
66
  "PropertyDefinitionDuplicatedWarning",
67
67
  "PropertyDirectRelationLimitWarning",
68
+ "PropertyMultipleValueWarning",
68
69
  "PropertyNotFoundWarning",
69
70
  "PropertyOverwritingWarning",
70
71
  "PropertyTypeNotSupportedWarning",
@@ -80,3 +80,11 @@ class PropertyDirectRelationLimitWarning(PropertyWarning[T_Identifier]):
80
80
  resource_type = "view"
81
81
 
82
82
  limit: int = DMS_DIRECT_RELATION_LIST_LIMIT
83
+
84
+
85
+ @dataclass(unsafe_hash=True)
86
+ class PropertyMultipleValueWarning(PropertyWarning[T_Identifier]):
87
+ """The {resource_type} with identifier {identifier} has a property {property_name} with multiple values.
88
+ Selecting the first value {value}, the rest will be ignored."""
89
+
90
+ value: str
@@ -20,9 +20,21 @@ __all__ = [
20
20
  "NodeTypeFilterOnParentViewWarning",
21
21
  "NotNeatSupportedFilterWarning",
22
22
  "ParentInDifferentSpaceWarning",
23
+ "ViewsAndDataModelNotInSameSpaceWarning",
23
24
  ]
24
25
 
25
26
 
27
+ @dataclass(unsafe_hash=True)
28
+ class ViewsAndDataModelNotInSameSpaceWarning(UserModelingWarning):
29
+ """The data model is in {data_model_space}, while views are in {views_spaces} space(s).
30
+ This is strongly discouraged as it can lead to confusion and unnecessary complexity.
31
+ """
32
+
33
+ fix = "Ensure that views and data model are in the same space and have same version"
34
+ data_model_space: str
35
+ views_spaces: str
36
+
37
+
26
38
  @dataclass(unsafe_hash=True)
27
39
  class DirectRelationMissingSourceWarning(UserModelingWarning):
28
40
  """The view {view_id}.{prop_name} is a direct relation without a source.
@@ -117,6 +117,9 @@ SPLIT_ON_COMMA_PATTERN = re.compile(r",(?![^(]*\))")
117
117
  # This pattern ignores equal signs inside brackets
118
118
  SPLIT_ON_EQUAL_PATTERN = re.compile(r"=(?![^(]*\))")
119
119
 
120
+ # Very special Edge Entity parsing
121
+ SPLIT_ON_EDGE_ENTITY_ARGS_PATTERN = re.compile(r"(\btype\b|\bproperties\b|\bdirection\b)\s*=\s*([^,]+)")
122
+
120
123
 
121
124
  class _Patterns:
122
125
  @cached_property
@@ -185,3 +188,12 @@ class _Patterns:
185
188
 
186
189
 
187
190
  PATTERNS = _Patterns()
191
+
192
+
193
+ def get_internal_properties() -> set[str]:
194
+ return {
195
+ "physical",
196
+ "logical",
197
+ "conceptual",
198
+ "Neat ID",
199
+ }
@@ -1,5 +1,5 @@
1
1
  from dataclasses import dataclass
2
- from typing import Any, Generic, TypeAlias, TypeVar
2
+ from typing import Generic, TypeAlias, TypeVar
3
3
 
4
4
  from cognite.neat._rules.models import (
5
5
  DMSRules,
@@ -7,6 +7,7 @@ from cognite.neat._rules.models import (
7
7
  )
8
8
  from cognite.neat._rules.models.dms._rules_input import DMSInputRules
9
9
  from cognite.neat._rules.models.information._rules_input import InformationInputRules
10
+ from cognite.neat._utils.spreadsheet import SpreadsheetRead
10
11
 
11
12
  VerifiedRules: TypeAlias = InformationRules | DMSRules
12
13
 
@@ -20,7 +21,7 @@ class ReadRules(Generic[T_InputRules]):
20
21
  """This represents a rules that has been read."""
21
22
 
22
23
  rules: T_InputRules | None
23
- read_context: dict[str, Any]
24
+ read_context: dict[str, SpreadsheetRead]
24
25
 
25
26
  @classmethod
26
27
  def display_type_name(cls) -> str:
@@ -1,4 +1,3 @@
1
- from ._dms import DMSAnalysis
2
- from ._information import InformationAnalysis
1
+ from ._base import RulesAnalysis
3
2
 
4
- __all__ = ["DMSAnalysis", "InformationAnalysis"]
3
+ __all__ = ["RulesAnalysis"]