cognite-neat 0.75.7__py3-none-any.whl → 0.75.8__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.
- cognite/neat/_version.py +1 -1
- cognite/neat/graph/extractors/_mock_graph_generator.py +6 -5
- cognite/neat/rules/analysis/_base.py +1 -1
- cognite/neat/rules/analysis/_information_rules.py +4 -4
- cognite/neat/rules/exporters/_rules2ontology.py +20 -17
- cognite/neat/rules/exporters/_validation.py +2 -2
- cognite/neat/rules/importers/_dms2rules.py +14 -15
- cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +21 -19
- cognite/neat/rules/importers/_dtdl2rules/spec.py +1 -1
- cognite/neat/rules/importers/_owl2rules/_owl2rules.py +2 -2
- cognite/neat/rules/importers/_spreadsheet2rules.py +6 -1
- cognite/neat/rules/importers/_yaml2rules.py +8 -2
- cognite/neat/rules/issues/dms.py +1 -1
- cognite/neat/rules/models/data_types.py +54 -31
- cognite/neat/rules/models/entities.py +184 -41
- cognite/neat/rules/models/rdfpath.py +111 -11
- cognite/neat/rules/models/rules/_base.py +2 -2
- cognite/neat/rules/models/rules/_dms_architect_rules.py +117 -188
- cognite/neat/rules/models/rules/_dms_rules_write.py +355 -0
- cognite/neat/rules/models/rules/_dms_schema.py +3 -3
- cognite/neat/rules/models/rules/_domain_rules.py +6 -3
- cognite/neat/rules/models/rules/_information_rules.py +68 -61
- cognite/neat/rules/models/rules/_types/__init__.py +0 -47
- cognite/neat/rules/models/rules/_types/_base.py +1 -309
- cognite/neat/rules/models/rules/_types/_field.py +0 -225
- cognite/neat/workflows/steps/lib/rules_importer.py +3 -3
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.8.dist-info}/METADATA +1 -1
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.8.dist-info}/RECORD +31 -32
- cognite/neat/rules/models/_entity.py +0 -142
- cognite/neat/rules/models/rules/_types/_value.py +0 -159
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.8.dist-info}/LICENSE +0 -0
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.8.dist-info}/WHEEL +0 -0
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.8.dist-info}/entry_points.txt +0 -0
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from datetime import date, datetime
|
|
4
|
-
from typing import ClassVar, cast
|
|
5
|
-
|
|
6
|
-
from cognite.client.data_classes.data_modeling import (
|
|
7
|
-
Boolean,
|
|
8
|
-
Date,
|
|
9
|
-
FileReference,
|
|
10
|
-
Float32,
|
|
11
|
-
Float64,
|
|
12
|
-
Int32,
|
|
13
|
-
Int64,
|
|
14
|
-
Json,
|
|
15
|
-
SequenceReference,
|
|
16
|
-
Text,
|
|
17
|
-
TimeSeriesReference,
|
|
18
|
-
Timestamp,
|
|
19
|
-
)
|
|
20
|
-
from pydantic import BaseModel
|
|
21
|
-
|
|
22
|
-
from ._base import Entity, EntityTypes
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class ValueTypeMapping(BaseModel):
|
|
26
|
-
"""Mapping between XSD, Python, DMS and Graphql types."""
|
|
27
|
-
|
|
28
|
-
xsd: str
|
|
29
|
-
python: type
|
|
30
|
-
dms: type
|
|
31
|
-
graphql: str
|
|
32
|
-
sql: str
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# mypy: ignore-errors
|
|
36
|
-
class XSDValueType(Entity):
|
|
37
|
-
"""Value type is a data/object type defined as a child of Entity model."""
|
|
38
|
-
|
|
39
|
-
type_: ClassVar[EntityTypes] = EntityTypes.xsd_value_type
|
|
40
|
-
mapping: ValueTypeMapping
|
|
41
|
-
|
|
42
|
-
@property
|
|
43
|
-
def python(self) -> type:
|
|
44
|
-
"""Returns the Python type for a given value type."""
|
|
45
|
-
return cast(ValueTypeMapping, self.mapping).python
|
|
46
|
-
|
|
47
|
-
@property
|
|
48
|
-
def xsd(self) -> str:
|
|
49
|
-
"""Returns the XSD type for a given value type."""
|
|
50
|
-
return cast(ValueTypeMapping, self.mapping).xsd
|
|
51
|
-
|
|
52
|
-
@property
|
|
53
|
-
def dms(self) -> type:
|
|
54
|
-
"""Returns the DMS type for a given value type."""
|
|
55
|
-
return cast(ValueTypeMapping, self.mapping).dms
|
|
56
|
-
|
|
57
|
-
@property
|
|
58
|
-
def graphql(self) -> str:
|
|
59
|
-
"""Returns the Graphql type for a given value type."""
|
|
60
|
-
return cast(ValueTypeMapping, self.mapping).graphql
|
|
61
|
-
|
|
62
|
-
@property
|
|
63
|
-
def sql(self) -> str:
|
|
64
|
-
"""Returns the SQL type for a given value type."""
|
|
65
|
-
return cast(ValueTypeMapping, self.mapping).sql
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
class DMSValueType(XSDValueType):
|
|
69
|
-
type_: ClassVar[EntityTypes] = EntityTypes.dms_value_type
|
|
70
|
-
|
|
71
|
-
def __str__(self) -> str:
|
|
72
|
-
return self.dms._type
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
_DATA_TYPES: list[dict] = [
|
|
76
|
-
{"name": "boolean", "python": bool, "GraphQL": "Boolean", "dms": Boolean, "SQL": "BOOLEAN"},
|
|
77
|
-
{"name": "float", "python": float, "GraphQL": "Float", "dms": Float64, "SQL": "FLOAT"},
|
|
78
|
-
{"name": "double", "python": float, "GraphQL": "Float", "dms": Float64, "SQL": "DOUBLE"},
|
|
79
|
-
{"name": "integer", "python": int, "GraphQL": "Int", "dms": Int32, "SQL": "INTEGER"},
|
|
80
|
-
{"name": "nonPositiveInteger", "python": int, "GraphQL": "Int", "dms": Int32, "SQL": "INTEGER"},
|
|
81
|
-
{"name": "nonNegativeInteger", "python": int, "GraphQL": "Int", "dms": Int32, "SQL": "INTEGER"},
|
|
82
|
-
{"name": "negativeInteger", "python": int, "GraphQL": "Int", "dms": Int32, "SQL": "INTEGER"},
|
|
83
|
-
{"name": "long", "python": int, "GraphQL": "Int", "dms": Int64, "SQL": "INTEGER"},
|
|
84
|
-
{"name": "string", "python": str, "GraphQL": "String", "dms": Text, "SQL": "STRING"},
|
|
85
|
-
{"name": "langString", "python": str, "GraphQL": "String", "dms": Text, "SQL": "STRING"},
|
|
86
|
-
{"name": "anyURI", "python": str, "GraphQL": "String", "dms": Text, "SQL": "STRING"},
|
|
87
|
-
{"name": "normalizedString", "python": str, "GraphQL": "String", "dms": Text, "SQL": "STRING"},
|
|
88
|
-
{"name": "token", "python": str, "GraphQL": "String", "dms": Text, "SQL": "STRING"},
|
|
89
|
-
# Graphql does not have a datetime/date type this is CDF specific
|
|
90
|
-
{"name": "dateTime", "python": datetime, "GraphQL": "Timestamp", "dms": Timestamp, "SQL": "TIMESTAMP"},
|
|
91
|
-
{"name": "dateTimeStamp", "python": datetime, "GraphQL": "Timestamp", "dms": Timestamp, "SQL": "TIMESTAMP"},
|
|
92
|
-
{"name": "date", "python": date, "GraphQL": "String", "dms": Date, "SQL": "DATE"},
|
|
93
|
-
# Some RDF types which are not in XSD
|
|
94
|
-
{"name": "PlainLiteral", "python": str, "GraphQL": "String", "dms": Text, "SQL": "STRING"},
|
|
95
|
-
{"name": "Literal", "python": str, "GraphQL": "String", "dms": Text, "SQL": "STRING"},
|
|
96
|
-
# CDF specific types, not in XSD
|
|
97
|
-
{
|
|
98
|
-
"name": "timeseries",
|
|
99
|
-
"python": TimeSeriesReference,
|
|
100
|
-
"GraphQL": "TimeSeries",
|
|
101
|
-
"dms": TimeSeriesReference,
|
|
102
|
-
"SQL": "STRING",
|
|
103
|
-
},
|
|
104
|
-
{"name": "file", "python": FileReference, "GraphQL": "File", "dms": FileReference, "SQL": "STRING"},
|
|
105
|
-
{"name": "sequence", "python": SequenceReference, "GraphQL": "Sequence", "dms": SequenceReference, "SQL": "STRING"},
|
|
106
|
-
{"name": "json", "python": Json, "GraphQL": "Json", "dms": Json, "SQL": "STRING"},
|
|
107
|
-
]
|
|
108
|
-
|
|
109
|
-
_DMS_TYPES: list[dict] = [
|
|
110
|
-
{"name": "boolean", "python": bool, "GraphQL": "Boolean", "dms": Boolean, "SQL": "BOOLEAN"},
|
|
111
|
-
{"name": "float", "python": float, "GraphQL": "Float", "dms": Float32, "SQL": "FLOAT"},
|
|
112
|
-
{"name": "double", "python": float, "GraphQL": "Float", "dms": Float64, "SQL": "DOUBLE"},
|
|
113
|
-
{"name": "integer", "python": int, "GraphQL": "Int", "dms": Int32, "SQL": "INTEGER"},
|
|
114
|
-
{"name": "long", "python": int, "GraphQL": "Int", "dms": Int64, "SQL": "INTEGER"},
|
|
115
|
-
{"name": "string", "python": str, "GraphQL": "String", "dms": Text, "SQL": "STRING"},
|
|
116
|
-
{"name": "dateTimeStamp", "python": datetime, "GraphQL": "Timestamp", "dms": Timestamp, "SQL": "TIMESTAMP"},
|
|
117
|
-
{
|
|
118
|
-
"name": "timeseries",
|
|
119
|
-
"python": TimeSeriesReference,
|
|
120
|
-
"GraphQL": "TimeSeries",
|
|
121
|
-
"dms": TimeSeriesReference,
|
|
122
|
-
"SQL": "STRING",
|
|
123
|
-
},
|
|
124
|
-
{"name": "file", "python": FileReference, "GraphQL": "File", "dms": FileReference, "SQL": "STRING"},
|
|
125
|
-
{"name": "sequence", "python": SequenceReference, "GraphQL": "Sequence", "dms": SequenceReference, "SQL": "STRING"},
|
|
126
|
-
{"name": "json", "python": Json, "GraphQL": "Json", "dms": Json, "SQL": "STRING"},
|
|
127
|
-
]
|
|
128
|
-
|
|
129
|
-
XSD_VALUE_TYPE_MAPPINGS: dict[str, XSDValueType] = {
|
|
130
|
-
data_type["name"]: XSDValueType(
|
|
131
|
-
prefix="xsd",
|
|
132
|
-
suffix=cast(str, data_type["name"]),
|
|
133
|
-
name=cast(str, data_type["name"]),
|
|
134
|
-
mapping=ValueTypeMapping(
|
|
135
|
-
xsd=data_type["name"],
|
|
136
|
-
python=data_type["python"],
|
|
137
|
-
dms=data_type["dms"],
|
|
138
|
-
graphql=data_type["GraphQL"],
|
|
139
|
-
sql=data_type["SQL"],
|
|
140
|
-
),
|
|
141
|
-
)
|
|
142
|
-
for data_type in _DATA_TYPES
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
DMS_VALUE_TYPE_MAPPINGS: dict[str, DMSValueType] = {
|
|
146
|
-
data_type["dms"]._type.casefold(): DMSValueType(
|
|
147
|
-
prefix="dms",
|
|
148
|
-
suffix=data_type["dms"]._type.casefold(),
|
|
149
|
-
name=data_type["dms"]._type.casefold(),
|
|
150
|
-
mapping=ValueTypeMapping(
|
|
151
|
-
xsd=data_type["name"],
|
|
152
|
-
python=data_type["python"],
|
|
153
|
-
dms=data_type["dms"],
|
|
154
|
-
graphql=data_type["GraphQL"],
|
|
155
|
-
sql=data_type["SQL"],
|
|
156
|
-
),
|
|
157
|
-
)
|
|
158
|
-
for data_type in _DMS_TYPES
|
|
159
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|