cognite-neat 0.88.2__py3-none-any.whl → 0.88.3__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.
- cognite/neat/_version.py +1 -1
- cognite/neat/graph/__init__.py +0 -3
- cognite/neat/graph/loaders/_base.py +3 -3
- cognite/neat/graph/loaders/_rdf2asset.py +24 -25
- cognite/neat/graph/loaders/_rdf2dms.py +20 -15
- cognite/neat/issues/__init__.py +1 -3
- cognite/neat/issues/_base.py +259 -70
- cognite/neat/issues/errors/__init__.py +72 -0
- cognite/neat/issues/errors/_external.py +67 -0
- cognite/neat/issues/errors/_general.py +28 -0
- cognite/neat/issues/errors/_properties.py +62 -0
- cognite/neat/issues/errors/_resources.py +111 -0
- cognite/neat/issues/errors/_workflow.py +36 -0
- cognite/neat/issues/formatters.py +1 -1
- cognite/neat/issues/warnings/__init__.py +66 -0
- cognite/neat/issues/warnings/_external.py +40 -0
- cognite/neat/issues/warnings/_general.py +29 -0
- cognite/neat/issues/warnings/_models.py +92 -0
- cognite/neat/issues/warnings/_properties.py +44 -0
- cognite/neat/issues/warnings/_resources.py +55 -0
- cognite/neat/issues/warnings/user_modeling.py +113 -0
- cognite/neat/rules/_shared.py +10 -2
- cognite/neat/rules/exporters/_base.py +6 -6
- cognite/neat/rules/exporters/_rules2dms.py +18 -11
- cognite/neat/rules/exporters/_rules2excel.py +4 -4
- cognite/neat/rules/exporters/_rules2ontology.py +74 -51
- cognite/neat/rules/exporters/_rules2yaml.py +3 -3
- cognite/neat/rules/exporters/_validation.py +11 -96
- cognite/neat/rules/importers/_base.py +8 -12
- cognite/neat/rules/importers/_dms2rules.py +21 -24
- cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +22 -17
- cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +26 -19
- cognite/neat/rules/importers/_dtdl2rules/spec.py +7 -0
- cognite/neat/rules/importers/_rdf/_imf2rules/_imf2classes.py +1 -1
- cognite/neat/rules/importers/_rdf/_imf2rules/_imf2rules.py +9 -7
- cognite/neat/rules/importers/_rdf/_inference2rules.py +8 -8
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2classes.py +1 -0
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2properties.py +1 -0
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +4 -4
- cognite/neat/rules/importers/_rdf/_shared.py +3 -3
- cognite/neat/rules/importers/_spreadsheet2rules.py +35 -22
- cognite/neat/rules/importers/_yaml2rules.py +23 -22
- cognite/neat/rules/models/_constants.py +2 -1
- cognite/neat/rules/models/_rdfpath.py +4 -4
- cognite/neat/rules/models/_types/_field.py +5 -10
- cognite/neat/rules/models/asset/_rules.py +1 -3
- cognite/neat/rules/models/asset/_validation.py +13 -9
- cognite/neat/rules/models/dms/_converter.py +2 -4
- cognite/neat/rules/models/dms/_exporter.py +30 -8
- cognite/neat/rules/models/dms/_rules.py +23 -7
- cognite/neat/rules/models/dms/_schema.py +87 -78
- cognite/neat/rules/models/dms/_validation.py +104 -65
- cognite/neat/rules/models/information/_converter.py +2 -2
- cognite/neat/rules/models/information/_rules.py +7 -8
- cognite/neat/rules/models/information/_validation.py +47 -24
- cognite/neat/rules/transformers/_base.py +15 -0
- cognite/neat/utils/auxiliary.py +2 -35
- cognite/neat/utils/text.py +17 -0
- cognite/neat/workflows/base.py +4 -4
- cognite/neat/workflows/cdf_store.py +3 -3
- cognite/neat/workflows/steps/data_contracts.py +1 -1
- cognite/neat/workflows/steps/lib/current/graph_extractor.py +3 -3
- cognite/neat/workflows/steps/lib/current/graph_loader.py +2 -2
- cognite/neat/workflows/steps/lib/current/graph_store.py +1 -1
- cognite/neat/workflows/steps/lib/current/rules_exporter.py +10 -10
- cognite/neat/workflows/steps/lib/current/rules_importer.py +6 -6
- cognite/neat/workflows/steps/lib/current/rules_validator.py +5 -6
- cognite/neat/workflows/steps/lib/io/io_steps.py +5 -5
- cognite/neat/workflows/steps_registry.py +4 -5
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.88.3.dist-info}/METADATA +1 -1
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.88.3.dist-info}/RECORD +78 -84
- cognite/neat/exceptions.py +0 -145
- cognite/neat/graph/exceptions.py +0 -90
- cognite/neat/issues/errors/external.py +0 -21
- cognite/neat/issues/errors/properties.py +0 -75
- cognite/neat/issues/errors/resources.py +0 -123
- cognite/neat/issues/neat_warnings/__init__.py +0 -2
- cognite/neat/issues/neat_warnings/identifier.py +0 -27
- cognite/neat/issues/neat_warnings/models.py +0 -22
- cognite/neat/issues/neat_warnings/properties.py +0 -77
- cognite/neat/issues/neat_warnings/resources.py +0 -125
- cognite/neat/rules/issues/__init__.py +0 -22
- cognite/neat/rules/issues/base.py +0 -63
- cognite/neat/rules/issues/dms.py +0 -549
- cognite/neat/rules/issues/fileread.py +0 -197
- cognite/neat/rules/issues/ontology.py +0 -298
- cognite/neat/rules/issues/spreadsheet.py +0 -563
- cognite/neat/rules/issues/spreadsheet_file.py +0 -151
- cognite/neat/rules/issues/tables.py +0 -72
- cognite/neat/workflows/_exceptions.py +0 -41
- /cognite/neat/{issues/errors/schema.py → rules/transformers/__init__.py} +0 -0
- /cognite/neat/{graph/stores → store}/__init__.py +0 -0
- /cognite/neat/{graph/stores → store}/_base.py +0 -0
- /cognite/neat/{graph/stores → store}/_provenance.py +0 -0
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.88.3.dist-info}/LICENSE +0 -0
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.88.3.dist-info}/WHEEL +0 -0
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.88.3.dist-info}/entry_points.txt +0 -0
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
from abc import ABC
|
|
2
|
-
from dataclasses import dataclass
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Any, ClassVar
|
|
5
|
-
|
|
6
|
-
from .base import NeatValidationError
|
|
7
|
-
|
|
8
|
-
__all__ = [
|
|
9
|
-
"SpreadsheetFileError",
|
|
10
|
-
"SpreadsheetNotFoundError",
|
|
11
|
-
"MetadataSheetMissingOrFailedError",
|
|
12
|
-
"SheetMissingError",
|
|
13
|
-
"ReadSpreadsheetsError",
|
|
14
|
-
"InvalidRoleError",
|
|
15
|
-
]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@dataclass(frozen=True)
|
|
19
|
-
class SpreadsheetFileError(NeatValidationError, ABC):
|
|
20
|
-
description = "Error when reading spreadsheet"
|
|
21
|
-
filepath: Path
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@dataclass(frozen=True)
|
|
25
|
-
class SpreadsheetNotFoundError(SpreadsheetFileError):
|
|
26
|
-
description: ClassVar[str] = "Spreadsheet not found"
|
|
27
|
-
fix: ClassVar[str] = "Make sure to provide a valid spreadsheet"
|
|
28
|
-
|
|
29
|
-
def message(self) -> str:
|
|
30
|
-
return f"Spreadsheet {self.filepath.name} not found"
|
|
31
|
-
|
|
32
|
-
def dump(self) -> dict[str, Any]:
|
|
33
|
-
output = super().dump()
|
|
34
|
-
output["spreadsheet_name"] = str(self.filepath)
|
|
35
|
-
return output
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@dataclass(frozen=True)
|
|
39
|
-
class MetadataSheetMissingOrFailedError(SpreadsheetFileError):
|
|
40
|
-
description: ClassVar[str] = "Metadata sheet is missing or it failed validation for one or more fields"
|
|
41
|
-
fix: ClassVar[str] = "Make sure to define compliant Metadata sheet before proceeding"
|
|
42
|
-
hint: str | None = None
|
|
43
|
-
sheet_name: str = "Metadata"
|
|
44
|
-
|
|
45
|
-
def message(self) -> str:
|
|
46
|
-
output = (
|
|
47
|
-
f" {self.sheet_name} sheet is missing or it failed"
|
|
48
|
-
+ f" validation for one or more fields in {self.filepath.name}. "
|
|
49
|
-
+ self.fix
|
|
50
|
-
)
|
|
51
|
-
if self.hint:
|
|
52
|
-
output += f" Hint: {self.hint}"
|
|
53
|
-
return output
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@dataclass(frozen=True)
|
|
57
|
-
class RoleMissingOrUnsupportedError(SpreadsheetFileError):
|
|
58
|
-
description: ClassVar[str] = "Role field in Metadata sheet is missing or its value is unsupported"
|
|
59
|
-
fix: ClassVar[str] = "Make sure to define compliant role in Metadata sheet before proceeding"
|
|
60
|
-
|
|
61
|
-
hint: str | None = None
|
|
62
|
-
|
|
63
|
-
def message(self) -> str:
|
|
64
|
-
output = (
|
|
65
|
-
f"Role field in Metadata sheet is missing or its value is unsupported {self.filepath.name}. " + self.fix
|
|
66
|
-
)
|
|
67
|
-
if self.hint:
|
|
68
|
-
output += f" Hint: {self.hint}"
|
|
69
|
-
return output
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
@dataclass(frozen=True)
|
|
73
|
-
class RoleMismatchError(SpreadsheetFileError):
|
|
74
|
-
description: ClassVar[str] = "Roles between user and reference Metadata sheets do not match"
|
|
75
|
-
fix: ClassVar[str] = "Make sure that both user and reference Metadata sheets have the same role defined"
|
|
76
|
-
|
|
77
|
-
hint: str | None = None
|
|
78
|
-
|
|
79
|
-
def message(self) -> str:
|
|
80
|
-
output = f"Roles between user and reference Metadata sheets do not match {self.filepath.name}. " + self.fix
|
|
81
|
-
if self.hint:
|
|
82
|
-
output += f" Hint: {self.hint}"
|
|
83
|
-
return output
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
@dataclass(frozen=True)
|
|
87
|
-
class SchemaMissingOrUnsupportedError(SpreadsheetFileError):
|
|
88
|
-
description: ClassVar[str] = "Schema field in Metadata sheet is missing or its value unsupported"
|
|
89
|
-
fix: ClassVar[str] = "Make sure to define compliant schema in Metadata sheet before proceeding"
|
|
90
|
-
|
|
91
|
-
hint: str | None = None
|
|
92
|
-
|
|
93
|
-
def message(self) -> str:
|
|
94
|
-
output = (
|
|
95
|
-
f"Schema field in Metadata sheet is missing or its value unsupported in file {self.filepath.name}. "
|
|
96
|
-
+ self.fix
|
|
97
|
-
)
|
|
98
|
-
if self.hint:
|
|
99
|
-
output += f" Hint: {self.hint}"
|
|
100
|
-
return output
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
@dataclass(frozen=True)
|
|
104
|
-
class SheetMissingError(SpreadsheetFileError):
|
|
105
|
-
description: ClassVar[str] = "Spreadsheet(s) is missing"
|
|
106
|
-
fix: ClassVar[str] = "Make sure to provide compliant spreadsheet(s) before proceeding"
|
|
107
|
-
|
|
108
|
-
missing_spreadsheets: list[str]
|
|
109
|
-
|
|
110
|
-
def message(self) -> str:
|
|
111
|
-
if len(self.missing_spreadsheets) == 1:
|
|
112
|
-
return f"Spreadsheet {self.missing_spreadsheets[0]} is missing"
|
|
113
|
-
else:
|
|
114
|
-
return f"Spreadsheets {', '.join(self.missing_spreadsheets)} are missing"
|
|
115
|
-
|
|
116
|
-
def dump(self) -> dict[str, Any]:
|
|
117
|
-
output = super().dump()
|
|
118
|
-
output["missing_spreadsheets"] = self.missing_spreadsheets
|
|
119
|
-
return output
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
@dataclass(frozen=True)
|
|
123
|
-
class ReadSpreadsheetsError(SpreadsheetFileError):
|
|
124
|
-
description: ClassVar[str] = "Error reading spreadsheet(s)"
|
|
125
|
-
fix: ClassVar[str] = "Is the excel document open in another program? Is the file corrupted?"
|
|
126
|
-
|
|
127
|
-
error_message: str
|
|
128
|
-
|
|
129
|
-
def message(self) -> str:
|
|
130
|
-
return f"Error reading spreadsheet {self.filepath.name}: {self.error_message}"
|
|
131
|
-
|
|
132
|
-
def dump(self) -> dict[str, Any]:
|
|
133
|
-
output = super().dump()
|
|
134
|
-
output["error_message"] = self.error_message
|
|
135
|
-
return output
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
@dataclass(frozen=True)
|
|
139
|
-
class InvalidRoleError(NeatValidationError):
|
|
140
|
-
description: ClassVar[str] = "Invalid role"
|
|
141
|
-
fix: ClassVar[str] = "Make sure to provide a valid role"
|
|
142
|
-
|
|
143
|
-
provided_role: str
|
|
144
|
-
|
|
145
|
-
def message(self) -> str:
|
|
146
|
-
return f"Invalid role: {self.provided_role}"
|
|
147
|
-
|
|
148
|
-
def dump(self) -> dict[str, Any]:
|
|
149
|
-
output = super().dump()
|
|
150
|
-
output["provided_role"] = self.provided_role
|
|
151
|
-
return output
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
|
|
3
|
-
from .base import NeatValidationError
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@dataclass(frozen=True)
|
|
7
|
-
class NotValidRDFPathError(NeatValidationError):
|
|
8
|
-
"""Provided `rdfpath` is not valid, i.e. it cannot be converted to SPARQL query.
|
|
9
|
-
|
|
10
|
-
Args:
|
|
11
|
-
rdf_path: `rdfpath` that raised exception
|
|
12
|
-
|
|
13
|
-
Notes:
|
|
14
|
-
Get familiar with `rdfpath` to avoid this exception.
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
description = "Provided `rdfpath` is not valid, i.e. it cannot be converted to SPARQL query"
|
|
18
|
-
fix = "Get familiar with `rdfpath` and check if provided path is valid!"
|
|
19
|
-
rdf_path: str
|
|
20
|
-
|
|
21
|
-
def message(self) -> str:
|
|
22
|
-
message = f"{self.rdf_path} is not a valid rdfpath!"
|
|
23
|
-
|
|
24
|
-
message += f"\nDescription: {self.description}"
|
|
25
|
-
message += f"\nFix: {self.fix}"
|
|
26
|
-
return message
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@dataclass(frozen=True)
|
|
30
|
-
class NotValidTableLookUpError(NeatValidationError):
|
|
31
|
-
"""Provided `table lookup` is not valid, i.e. it cannot be converted to CDF lookup.
|
|
32
|
-
|
|
33
|
-
Args:
|
|
34
|
-
table_look_up: `table_look_up`, a part of `rawlookup`, that raised exception
|
|
35
|
-
|
|
36
|
-
Notes:
|
|
37
|
-
Get familiar with `rawlookup` and `rdfpath` to avoid this exception.
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
description = "Provided table lookup is not valid, i.e. it cannot be converted to CDF lookup"
|
|
41
|
-
fix = "Get familiar with RAW look up and RDF paths and check if provided rawlookup is valid"
|
|
42
|
-
table_look_up: str
|
|
43
|
-
|
|
44
|
-
def message(self) -> str:
|
|
45
|
-
message = f"{self.table_look_up} is not a valid table lookup"
|
|
46
|
-
|
|
47
|
-
message += f"\nDescription: {self.description}"
|
|
48
|
-
message += f"\nFix: {self.fix}"
|
|
49
|
-
return message
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
@dataclass(frozen=True)
|
|
53
|
-
class NotValidRAWLookUpError(NeatValidationError):
|
|
54
|
-
"""Provided `rawlookup` is not valid, i.e. it cannot be converted to SPARQL query and CDF lookup
|
|
55
|
-
|
|
56
|
-
Args:
|
|
57
|
-
raw_look_up: `rawlookup` rule that raised exception
|
|
58
|
-
|
|
59
|
-
Notes:
|
|
60
|
-
Get familiar with `rawlookup` and `rdfpath` to avoid this exception.
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
description = "Provided rawlookup is not valid, i.e. it cannot be converted to SPARQL query and CDF lookup"
|
|
64
|
-
fix = "Get familiar with `rawlookup` and `rdfpath` to avoid this exception"
|
|
65
|
-
raw_look_up: str
|
|
66
|
-
|
|
67
|
-
def message(self):
|
|
68
|
-
message = f"Invalid rawlookup expected traversal | table lookup, got {self.raw_look_up}"
|
|
69
|
-
|
|
70
|
-
message += f"\nDescription: {self.description}"
|
|
71
|
-
message += f"\nFix: {self.fix}"
|
|
72
|
-
return message
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
from cognite.neat.exceptions import NeatException
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class InvalidStepOutputException(NeatException):
|
|
5
|
-
type_ = "invalid_step_output"
|
|
6
|
-
code = 400
|
|
7
|
-
description = "The step output is invalid."
|
|
8
|
-
example = "The step output must be a dictionary."
|
|
9
|
-
|
|
10
|
-
def __init__(self, step_type: str):
|
|
11
|
-
self.message = f"Object type {step_type} is not supported as step output"
|
|
12
|
-
super().__init__(self.message)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class ConfigurationNotSet(NeatException):
|
|
16
|
-
type_ = "configuration_not_set"
|
|
17
|
-
code = 400
|
|
18
|
-
description = "The configuration is not set."
|
|
19
|
-
example = "The configuration must be set before running the workflow."
|
|
20
|
-
|
|
21
|
-
def __init__(self, config_variable: str):
|
|
22
|
-
self.message = (
|
|
23
|
-
f"The configuration variable '{config_variable}' is not set. "
|
|
24
|
-
f"Please set the configuration before running the workflow."
|
|
25
|
-
)
|
|
26
|
-
super().__init__(self.message)
|
|
27
|
-
|
|
28
|
-
def __str__(self):
|
|
29
|
-
return self.message
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class StepNotInitialized(NeatException):
|
|
33
|
-
def __init__(self, step_name: str):
|
|
34
|
-
self.message = f"Step {step_name} has not been initialized."
|
|
35
|
-
super().__init__(self.message)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class StepFlowContextNotInitialized(NeatException):
|
|
39
|
-
def __init__(self, step_name: str):
|
|
40
|
-
self.message = f"Step {step_name} requires flow context which is missing."
|
|
41
|
-
super().__init__(self.message)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|