cognite-neat 0.119.8__py3-none-any.whl → 0.120.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.
- cognite/neat/__init__.py +3 -2
- cognite/neat/_version.py +1 -1
- cognite/neat/{_client → core/_client}/_api/data_modeling_loaders.py +5 -5
- cognite/neat/{_client → core/_client}/_api/neat_instances.py +1 -1
- cognite/neat/{_client → core/_client}/_api/schema.py +9 -5
- cognite/neat/{_client → core/_client}/_api_client.py +1 -1
- cognite/neat/{_client → core/_client}/data_classes/schema.py +4 -4
- cognite/neat/{_client → core/_client}/testing.py +1 -1
- cognite/neat/{_constants.py → core/_constants.py} +27 -8
- cognite/neat/{_graph → core/_graph}/_tracking/base.py +1 -1
- cognite/neat/{_graph → core/_graph}/_tracking/log.py +1 -1
- cognite/neat/{_graph → core/_graph}/extractors/__init__.py +1 -1
- cognite/neat/{_graph → core/_graph}/extractors/_base.py +6 -6
- cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_base.py +23 -7
- cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_classic.py +16 -12
- cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_relationships.py +5 -3
- cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_sequences.py +7 -2
- cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_timeseries.py +10 -3
- cognite/neat/{_graph → core/_graph}/extractors/_dict.py +2 -2
- cognite/neat/{_graph → core/_graph}/extractors/_dms.py +6 -6
- cognite/neat/{_graph → core/_graph}/extractors/_dms_graph.py +15 -11
- cognite/neat/{_graph → core/_graph}/extractors/_mock_graph_generator.py +10 -10
- cognite/neat/{_graph → core/_graph}/extractors/_raw.py +3 -3
- cognite/neat/{_graph → core/_graph}/extractors/_rdf_file.py +10 -7
- cognite/neat/{_graph → core/_graph}/loaders/_base.py +5 -5
- cognite/neat/{_graph → core/_graph}/loaders/_rdf2dms.py +31 -18
- cognite/neat/{_graph → core/_graph}/queries/_select.py +3 -3
- cognite/neat/{_graph → core/_graph}/queries/_update.py +1 -1
- cognite/neat/{_graph → core/_graph}/transformers/_base.py +8 -4
- cognite/neat/{_graph → core/_graph}/transformers/_classic_cdf.py +6 -6
- cognite/neat/{_graph → core/_graph}/transformers/_prune_graph.py +4 -4
- cognite/neat/{_graph → core/_graph}/transformers/_rdfpath.py +1 -1
- cognite/neat/{_graph → core/_graph}/transformers/_value_type.py +8 -4
- cognite/neat/{_issues → core/_issues}/_base.py +12 -5
- cognite/neat/{_issues → core/_issues}/_contextmanagers.py +1 -1
- cognite/neat/{_issues → core/_issues}/_factory.py +2 -2
- cognite/neat/{_issues → core/_issues}/errors/__init__.py +1 -1
- cognite/neat/{_issues → core/_issues}/errors/_external.py +1 -1
- cognite/neat/{_issues → core/_issues}/errors/_general.py +1 -1
- cognite/neat/{_issues → core/_issues}/errors/_properties.py +1 -1
- cognite/neat/{_issues → core/_issues}/errors/_resources.py +7 -2
- cognite/neat/{_issues → core/_issues}/errors/_wrapper.py +2 -2
- cognite/neat/{_issues → core/_issues}/warnings/__init__.py +1 -1
- cognite/neat/{_issues → core/_issues}/warnings/_external.py +1 -1
- cognite/neat/{_issues → core/_issues}/warnings/_general.py +1 -1
- cognite/neat/{_issues → core/_issues}/warnings/_models.py +2 -2
- cognite/neat/{_issues → core/_issues}/warnings/_properties.py +2 -2
- cognite/neat/{_issues → core/_issues}/warnings/_resources.py +6 -1
- cognite/neat/{_issues → core/_issues}/warnings/user_modeling.py +1 -1
- cognite/neat/{_rules → core/_rules}/_shared.py +6 -4
- cognite/neat/{_rules → core/_rules}/analysis/_base.py +15 -8
- cognite/neat/{_rules → core/_rules}/exporters/_base.py +7 -7
- cognite/neat/{_rules → core/_rules}/exporters/_rules2dms.py +15 -9
- cognite/neat/{_rules → core/_rules}/exporters/_rules2excel.py +219 -163
- cognite/neat/{_rules → core/_rules}/exporters/_rules2instance_template.py +4 -4
- cognite/neat/{_rules → core/_rules}/exporters/_rules2ontology.py +10 -10
- cognite/neat/{_rules → core/_rules}/exporters/_rules2yaml.py +1 -1
- cognite/neat/{_rules → core/_rules}/exporters/_validation.py +2 -2
- cognite/neat/{_rules → core/_rules}/importers/_base.py +5 -5
- cognite/neat/{_rules → core/_rules}/importers/_dms2rules.py +20 -12
- cognite/neat/{_rules → core/_rules}/importers/_dtdl2rules/dtdl_converter.py +15 -7
- cognite/neat/{_rules → core/_rules}/importers/_dtdl2rules/dtdl_importer.py +13 -9
- cognite/neat/{_rules → core/_rules}/importers/_dtdl2rules/spec.py +1 -1
- cognite/neat/{_rules → core/_rules}/importers/_rdf/_base.py +12 -12
- cognite/neat/{_rules → core/_rules}/importers/_rdf/_imf2rules.py +5 -2
- cognite/neat/{_rules → core/_rules}/importers/_rdf/_inference2rules.py +14 -14
- cognite/neat/{_rules → core/_rules}/importers/_rdf/_owl2rules.py +5 -2
- cognite/neat/{_rules → core/_rules}/importers/_rdf/_shared.py +4 -4
- cognite/neat/{_rules → core/_rules}/importers/_spreadsheet2rules.py +7 -7
- cognite/neat/{_rules → core/_rules}/importers/_yaml2rules.py +5 -5
- cognite/neat/{_rules → core/_rules}/models/__init__.py +5 -3
- cognite/neat/{_rules → core/_rules}/models/_base_rules.py +9 -6
- cognite/neat/{_rules → core/_rules}/models/_types.py +5 -5
- cognite/neat/{_rules → core/_rules}/models/data_types.py +9 -3
- cognite/neat/{_rules → core/_rules}/models/dms/__init__.py +1 -1
- cognite/neat/{_rules → core/_rules}/models/dms/_exporter.py +15 -8
- cognite/neat/{_rules → core/_rules}/models/dms/_rules.py +9 -9
- cognite/neat/{_rules → core/_rules}/models/dms/_rules_input.py +10 -7
- cognite/neat/{_rules → core/_rules}/models/dms/_validation.py +14 -14
- cognite/neat/{_rules → core/_rules}/models/entities/_loaders.py +2 -2
- cognite/neat/{_rules → core/_rules}/models/entities/_multi_value.py +2 -2
- cognite/neat/{_rules → core/_rules}/models/entities/_single_value.py +3 -3
- cognite/neat/{_rules → core/_rules}/models/entities/_wrapped.py +13 -5
- cognite/neat/{_rules → core/_rules}/models/information/_rules.py +11 -9
- cognite/neat/{_rules → core/_rules}/models/information/_rules_input.py +5 -5
- cognite/neat/{_rules → core/_rules}/models/information/_validation.py +10 -10
- cognite/neat/{_rules → core/_rules}/models/mapping/_classic2core.py +5 -5
- cognite/neat/{_rules → core/_rules}/transformers/_base.py +4 -4
- cognite/neat/{_rules → core/_rules}/transformers/_converters.py +52 -26
- cognite/neat/{_rules → core/_rules}/transformers/_mapping.py +15 -7
- cognite/neat/{_rules → core/_rules}/transformers/_verification.py +7 -7
- cognite/neat/{_store → core/_store}/_graph_store.py +13 -10
- cognite/neat/{_store → core/_store}/_provenance.py +3 -3
- cognite/neat/{_store → core/_store}/_rules_store.py +19 -12
- cognite/neat/{_store → core/_store}/exceptions.py +4 -4
- cognite/neat/core/_utils/__init__.py +0 -0
- cognite/neat/{_utils → core/_utils}/auth.py +1 -1
- cognite/neat/{_utils → core/_utils}/auxiliary.py +1 -1
- cognite/neat/{_utils → core/_utils}/collection_.py +2 -2
- cognite/neat/{_utils → core/_utils}/graph_transformations_report.py +1 -1
- cognite/neat/{_utils → core/_utils}/rdf_.py +1 -1
- cognite/neat/{_utils → core/_utils}/reader/_base.py +1 -1
- cognite/neat/{_utils → core/_utils}/spreadsheet.py +11 -4
- cognite/neat/{_utils → core/_utils}/text.py +1 -1
- cognite/neat/{_utils → core/_utils}/upload.py +3 -3
- cognite/neat/{_session → session}/_base.py +10 -10
- cognite/neat/{_session → session}/_collector.py +1 -1
- cognite/neat/{_session → session}/_drop.py +3 -3
- cognite/neat/{_session → session}/_explore.py +2 -2
- cognite/neat/{_session → session}/_fix.py +2 -2
- cognite/neat/{_session → session}/_inspect.py +7 -3
- cognite/neat/{_session → session}/_mapping.py +3 -3
- cognite/neat/{_session → session}/_prepare.py +8 -8
- cognite/neat/{_session → session}/_read.py +73 -16
- cognite/neat/{_session → session}/_set.py +8 -8
- cognite/neat/{_session → session}/_show.py +5 -5
- cognite/neat/{_session → session}/_state.py +8 -8
- cognite/neat/{_session → session}/_subset.py +7 -4
- cognite/neat/{_session → session}/_template.py +22 -14
- cognite/neat/{_session → session}/_to.py +12 -12
- cognite/neat/{_session → session}/_wizard.py +1 -1
- cognite/neat/{_session → session}/engine/_load.py +1 -1
- cognite/neat/{_session → session}/exceptions.py +4 -4
- {cognite_neat-0.119.8.dist-info → cognite_neat-0.120.0.dist-info}/METADATA +47 -54
- cognite_neat-0.120.0.dist-info/RECORD +187 -0
- {cognite_neat-0.119.8.dist-info → cognite_neat-0.120.0.dist-info}/WHEEL +1 -1
- cognite_neat-0.119.8.dist-info/RECORD +0 -187
- cognite_neat-0.119.8.dist-info/entry_points.txt +0 -3
- /cognite/neat/{_client/_api → core}/__init__.py +0 -0
- /cognite/neat/{_client → core/_client}/__init__.py +0 -0
- /cognite/neat/{_client/data_classes → core/_client/_api}/__init__.py +0 -0
- /cognite/neat/{_graph → core/_client/data_classes}/__init__.py +0 -0
- /cognite/neat/{_client → core/_client}/data_classes/data_modeling.py +0 -0
- /cognite/neat/{_client → core/_client}/data_classes/neat_sequence.py +0 -0
- /cognite/neat/{_config.py → core/_config.py} +0 -0
- /cognite/neat/{_graph/extractors/_classic_cdf → core/_graph}/__init__.py +0 -0
- /cognite/neat/{_graph → core/_graph}/_shared.py +0 -0
- /cognite/neat/{_graph → core/_graph}/_tracking/__init__.py +0 -0
- /cognite/neat/{_graph → core/_graph}/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/{_graph → core/_graph}/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/{_graph → core/_graph}/examples/__init__.py +0 -0
- /cognite/neat/{_graph → core/_graph}/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- /cognite/neat/{_rules → core/_graph/extractors/_classic_cdf}/__init__.py +0 -0
- /cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_assets.py +0 -0
- /cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_data_sets.py +0 -0
- /cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_events.py +0 -0
- /cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_files.py +0 -0
- /cognite/neat/{_graph → core/_graph}/extractors/_classic_cdf/_labels.py +0 -0
- /cognite/neat/{_graph → core/_graph}/loaders/__init__.py +0 -0
- /cognite/neat/{_graph → core/_graph}/queries/__init__.py +0 -0
- /cognite/neat/{_graph → core/_graph}/queries/_base.py +0 -0
- /cognite/neat/{_graph → core/_graph}/queries/_queries.py +0 -0
- /cognite/neat/{_graph → core/_graph}/transformers/__init__.py +0 -0
- /cognite/neat/{_issues → core/_issues}/__init__.py +0 -0
- /cognite/neat/{_issues → core/_issues}/formatters.py +0 -0
- /cognite/neat/{_utils → core/_rules}/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/_constants.py +0 -0
- /cognite/neat/{_rules → core/_rules}/analysis/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/catalog/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/catalog/classic_model.xlsx +0 -0
- /cognite/neat/{_rules → core/_rules}/catalog/hello_world_pump.xlsx +0 -0
- /cognite/neat/{_rules → core/_rules}/catalog/info-rules-imf.xlsx +0 -0
- /cognite/neat/{_rules → core/_rules}/exporters/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/importers/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/importers/_dtdl2rules/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/importers/_dtdl2rules/_unit_lookup.py +0 -0
- /cognite/neat/{_rules → core/_rules}/importers/_rdf/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/models/_base_input.py +0 -0
- /cognite/neat/{_rules → core/_rules}/models/entities/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/models/entities/_constants.py +0 -0
- /cognite/neat/{_rules → core/_rules}/models/entities/_types.py +0 -0
- /cognite/neat/{_rules → core/_rules}/models/information/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/models/mapping/__init__.py +0 -0
- /cognite/neat/{_rules → core/_rules}/models/mapping/_classic2core.yaml +0 -0
- /cognite/neat/{_rules → core/_rules}/transformers/__init__.py +0 -0
- /cognite/neat/{_shared.py → core/_shared.py} +0 -0
- /cognite/neat/{_store → core/_store}/__init__.py +0 -0
- /cognite/neat/{_utils → core/_utils}/io_.py +0 -0
- /cognite/neat/{_utils → core/_utils}/reader/__init__.py +0 -0
- /cognite/neat/{_utils → core/_utils}/time_.py +0 -0
- /cognite/neat/{_utils → core/_utils}/xml_.py +0 -0
- /cognite/neat/{_session → session}/__init__.py +0 -0
- /cognite/neat/{_alpha.py → session/_experimental.py} +0 -0
- /cognite/neat/{_state → session/_state}/README.md +0 -0
- /cognite/neat/{_session → session}/engine/__init__.py +0 -0
- /cognite/neat/{_session → session}/engine/_import.py +0 -0
- /cognite/neat/{_session → session}/engine/_interface.py +0 -0
- {cognite_neat-0.119.8.dist-info → cognite_neat-0.120.0.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
from collections import Counter
|
|
2
2
|
from collections.abc import Callable, Sequence
|
|
3
3
|
|
|
4
|
-
from cognite.neat._issues import IssueList
|
|
5
|
-
from cognite.neat._issues.errors import (
|
|
4
|
+
from cognite.neat.core._issues import IssueList
|
|
5
|
+
from cognite.neat.core._issues.errors import (
|
|
6
6
|
PropertyTypeNotSupportedError,
|
|
7
7
|
ResourceMissingIdentifierError,
|
|
8
8
|
ResourceNotFoundError,
|
|
9
9
|
)
|
|
10
|
-
from cognite.neat._issues.warnings import
|
|
11
|
-
|
|
10
|
+
from cognite.neat.core._issues.warnings import (
|
|
11
|
+
PropertyTypeNotSupportedWarning,
|
|
12
|
+
ResourceTypeNotSupportedWarning,
|
|
13
|
+
)
|
|
14
|
+
from cognite.neat.core._rules.importers._dtdl2rules.spec import (
|
|
12
15
|
DTMI,
|
|
13
16
|
Command,
|
|
14
17
|
CommandV2,
|
|
@@ -25,9 +28,14 @@ from cognite.neat._rules.importers._dtdl2rules.spec import (
|
|
|
25
28
|
Telemetry,
|
|
26
29
|
TelemetryV2,
|
|
27
30
|
)
|
|
28
|
-
from cognite.neat._rules.models.data_types import
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
from cognite.neat.core._rules.models.data_types import (
|
|
32
|
+
_DATA_TYPE_BY_NAME,
|
|
33
|
+
DataType,
|
|
34
|
+
Json,
|
|
35
|
+
String,
|
|
36
|
+
)
|
|
37
|
+
from cognite.neat.core._rules.models.entities import ClassEntity
|
|
38
|
+
from cognite.neat.core._rules.models.information import (
|
|
31
39
|
InformationInputClass,
|
|
32
40
|
InformationInputProperty,
|
|
33
41
|
)
|
|
@@ -5,21 +5,25 @@ from pathlib import Path
|
|
|
5
5
|
|
|
6
6
|
from pydantic import ValidationError
|
|
7
7
|
|
|
8
|
-
from cognite.neat._issues import IssueList, MultiValueError, NeatIssue
|
|
9
|
-
from cognite.neat._issues.warnings import (
|
|
8
|
+
from cognite.neat.core._issues import IssueList, MultiValueError, NeatIssue
|
|
9
|
+
from cognite.neat.core._issues.warnings import (
|
|
10
10
|
FileItemNotSupportedWarning,
|
|
11
11
|
FileMissingRequiredFieldWarning,
|
|
12
12
|
FileReadWarning,
|
|
13
13
|
FileTypeUnexpectedWarning,
|
|
14
14
|
NeatValueWarning,
|
|
15
15
|
)
|
|
16
|
-
from cognite.neat._rules._shared import ReadRules
|
|
17
|
-
from cognite.neat._rules.importers._base import BaseImporter
|
|
18
|
-
from cognite.neat._rules.importers._dtdl2rules.dtdl_converter import _DTDLConverter
|
|
19
|
-
from cognite.neat._rules.importers._dtdl2rules.spec import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
from cognite.neat.core._rules._shared import ReadRules
|
|
17
|
+
from cognite.neat.core._rules.importers._base import BaseImporter
|
|
18
|
+
from cognite.neat.core._rules.importers._dtdl2rules.dtdl_converter import _DTDLConverter
|
|
19
|
+
from cognite.neat.core._rules.importers._dtdl2rules.spec import (
|
|
20
|
+
DTDL_CLS_BY_TYPE_BY_SPEC,
|
|
21
|
+
DTDLBase,
|
|
22
|
+
Interface,
|
|
23
|
+
)
|
|
24
|
+
from cognite.neat.core._rules.models import InformationInputRules
|
|
25
|
+
from cognite.neat.core._rules.models.information import InformationInputMetadata
|
|
26
|
+
from cognite.neat.core._utils.text import humanize_collection, to_pascal_case
|
|
23
27
|
|
|
24
28
|
|
|
25
29
|
class DTDLImporter(BaseImporter[InformationInputRules]):
|
|
@@ -15,7 +15,7 @@ from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeAlias
|
|
|
15
15
|
from pydantic import BaseModel, Field, field_validator, model_serializer, model_validator
|
|
16
16
|
from pydantic.fields import FieldInfo
|
|
17
17
|
|
|
18
|
-
from cognite.neat._rules.models.entities import ClassEntity
|
|
18
|
+
from cognite.neat.core._rules.models.entities import ClassEntity
|
|
19
19
|
|
|
20
20
|
if TYPE_CHECKING:
|
|
21
21
|
from pydantic.type_adapter import IncEx
|
|
@@ -6,18 +6,18 @@ from cognite.client import data_modeling as dm
|
|
|
6
6
|
from rdflib import Graph, Namespace, URIRef
|
|
7
7
|
from typing_extensions import Self
|
|
8
8
|
|
|
9
|
-
from cognite.neat._constants import get_default_prefixes_and_namespaces
|
|
10
|
-
from cognite.neat._issues import IssueList, MultiValueError
|
|
11
|
-
from cognite.neat._issues.errors import FileReadError
|
|
12
|
-
from cognite.neat._issues.errors._general import NeatValueError
|
|
13
|
-
from cognite.neat._rules._shared import ReadRules
|
|
14
|
-
from cognite.neat._rules.importers._base import BaseImporter
|
|
15
|
-
from cognite.neat._rules.models._base_rules import RoleTypes
|
|
16
|
-
from cognite.neat._rules.models.data_types import AnyURI
|
|
17
|
-
from cognite.neat._rules.models.entities import UnknownEntity
|
|
18
|
-
from cognite.neat._rules.models.information import InformationInputRules
|
|
19
|
-
from cognite.neat._store import NeatGraphStore
|
|
20
|
-
from cognite.neat._utils.rdf_ import get_namespace
|
|
9
|
+
from cognite.neat.core._constants import get_default_prefixes_and_namespaces
|
|
10
|
+
from cognite.neat.core._issues import IssueList, MultiValueError
|
|
11
|
+
from cognite.neat.core._issues.errors import FileReadError
|
|
12
|
+
from cognite.neat.core._issues.errors._general import NeatValueError
|
|
13
|
+
from cognite.neat.core._rules._shared import ReadRules
|
|
14
|
+
from cognite.neat.core._rules.importers._base import BaseImporter
|
|
15
|
+
from cognite.neat.core._rules.models._base_rules import RoleTypes
|
|
16
|
+
from cognite.neat.core._rules.models.data_types import AnyURI
|
|
17
|
+
from cognite.neat.core._rules.models.entities import UnknownEntity
|
|
18
|
+
from cognite.neat.core._rules.models.information import InformationInputRules
|
|
19
|
+
from cognite.neat.core._store import NeatGraphStore
|
|
20
|
+
from cognite.neat.core._utils.rdf_ import get_namespace
|
|
21
21
|
|
|
22
22
|
DEFAULT_NON_EXISTING_NODE_TYPE = AnyURI()
|
|
23
23
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"""This module performs importing of various formats to one of serializations for which
|
|
2
2
|
there are loaders to TransformationRules pydantic class."""
|
|
3
3
|
|
|
4
|
-
from cognite.neat._rules.importers._rdf._base import BaseRDFImporter
|
|
5
|
-
from cognite.neat._rules.importers._rdf._shared import
|
|
4
|
+
from cognite.neat.core._rules.importers._rdf._base import BaseRDFImporter
|
|
5
|
+
from cognite.neat.core._rules.importers._rdf._shared import (
|
|
6
|
+
parse_classes,
|
|
7
|
+
parse_properties,
|
|
8
|
+
)
|
|
6
9
|
|
|
7
10
|
CLASSES_QUERY = """
|
|
8
11
|
SELECT ?class_ ?name ?description ?implements
|
|
@@ -10,25 +10,25 @@ from cognite.client import data_modeling as dm
|
|
|
10
10
|
from rdflib import RDF, RDFS, Graph, Namespace, URIRef
|
|
11
11
|
from rdflib import Literal as RdfLiteral
|
|
12
12
|
|
|
13
|
-
from cognite.neat._config import GLOBAL_CONFIG
|
|
14
|
-
from cognite.neat._constants import NEAT, get_default_prefixes_and_namespaces
|
|
15
|
-
from cognite.neat._issues import IssueList
|
|
16
|
-
from cognite.neat._issues.warnings import PropertyValueTypeUndefinedWarning
|
|
17
|
-
from cognite.neat._rules.analysis import RulesAnalysis
|
|
18
|
-
from cognite.neat._rules.models import InformationRules, data_types
|
|
19
|
-
from cognite.neat._rules.models.data_types import AnyURI
|
|
20
|
-
from cognite.neat._rules.models.entities._single_value import UnknownEntity
|
|
21
|
-
from cognite.neat._rules.models.information import (
|
|
13
|
+
from cognite.neat.core._config import GLOBAL_CONFIG
|
|
14
|
+
from cognite.neat.core._constants import NEAT, get_default_prefixes_and_namespaces
|
|
15
|
+
from cognite.neat.core._issues import IssueList
|
|
16
|
+
from cognite.neat.core._issues.warnings import PropertyValueTypeUndefinedWarning
|
|
17
|
+
from cognite.neat.core._rules.analysis import RulesAnalysis
|
|
18
|
+
from cognite.neat.core._rules.models import InformationRules, data_types
|
|
19
|
+
from cognite.neat.core._rules.models.data_types import AnyURI
|
|
20
|
+
from cognite.neat.core._rules.models.entities._single_value import UnknownEntity
|
|
21
|
+
from cognite.neat.core._rules.models.information import (
|
|
22
22
|
InformationClass,
|
|
23
23
|
InformationInputClass,
|
|
24
24
|
InformationInputProperty,
|
|
25
25
|
InformationMetadata,
|
|
26
26
|
)
|
|
27
|
-
from cognite.neat._store import NeatGraphStore
|
|
28
|
-
from cognite.neat._store._provenance import INSTANCES_ENTITY
|
|
29
|
-
from cognite.neat._utils.collection_ import iterate_progress_bar
|
|
30
|
-
from cognite.neat._utils.rdf_ import remove_namespace_from_uri, uri_to_short_form
|
|
31
|
-
from cognite.neat._utils.text import NamingStandardization
|
|
27
|
+
from cognite.neat.core._store import NeatGraphStore
|
|
28
|
+
from cognite.neat.core._store._provenance import INSTANCES_ENTITY
|
|
29
|
+
from cognite.neat.core._utils.collection_ import iterate_progress_bar
|
|
30
|
+
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri, uri_to_short_form
|
|
31
|
+
from cognite.neat.core._utils.text import NamingStandardization
|
|
32
32
|
|
|
33
33
|
from ._base import DEFAULT_NON_EXISTING_NODE_TYPE, BaseRDFImporter
|
|
34
34
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"""This module performs importing of various formats to one of serializations for which
|
|
2
2
|
there are loaders to TransformationRules pydantic class."""
|
|
3
3
|
|
|
4
|
-
from cognite.neat._rules.importers._rdf._base import BaseRDFImporter
|
|
5
|
-
from cognite.neat._rules.importers._rdf._shared import
|
|
4
|
+
from cognite.neat.core._rules.importers._rdf._base import BaseRDFImporter
|
|
5
|
+
from cognite.neat.core._rules.importers._rdf._shared import (
|
|
6
|
+
parse_classes,
|
|
7
|
+
parse_properties,
|
|
8
|
+
)
|
|
6
9
|
|
|
7
10
|
CLASSES_QUERY = """SELECT ?class_ ?name ?description ?implements
|
|
8
11
|
WHERE {{
|
|
@@ -4,13 +4,13 @@ from rdflib import BNode, Graph
|
|
|
4
4
|
from rdflib.plugins.sparql import prepareQuery
|
|
5
5
|
from rdflib.query import ResultRow
|
|
6
6
|
|
|
7
|
-
from cognite.neat._issues._base import IssueList
|
|
8
|
-
from cognite.neat._issues.errors._general import NeatValueError
|
|
9
|
-
from cognite.neat._issues.warnings._resources import (
|
|
7
|
+
from cognite.neat.core._issues._base import IssueList
|
|
8
|
+
from cognite.neat.core._issues.errors._general import NeatValueError
|
|
9
|
+
from cognite.neat.core._issues.warnings._resources import (
|
|
10
10
|
ResourceRedefinedWarning,
|
|
11
11
|
ResourceRetrievalWarning,
|
|
12
12
|
)
|
|
13
|
-
from cognite.neat._utils.rdf_ import convert_rdflib_content
|
|
13
|
+
from cognite.neat.core._utils.rdf_ import convert_rdflib_content
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def parse_classes(graph: Graph, query: str, language: str, issue_list: IssueList) -> tuple[dict, IssueList]:
|
|
@@ -13,22 +13,22 @@ from cognite.client.utils._importing import local_import
|
|
|
13
13
|
from pandas import ExcelFile
|
|
14
14
|
from rdflib import Namespace, URIRef
|
|
15
15
|
|
|
16
|
-
from cognite.neat._issues import IssueList, MultiValueError
|
|
17
|
-
from cognite.neat._issues.errors import (
|
|
16
|
+
from cognite.neat.core._issues import IssueList, MultiValueError
|
|
17
|
+
from cognite.neat.core._issues.errors import (
|
|
18
18
|
FileMissingRequiredFieldError,
|
|
19
19
|
FileNotFoundNeatError,
|
|
20
20
|
FileReadError,
|
|
21
21
|
)
|
|
22
|
-
from cognite.neat._issues.warnings import FileMissingRequiredFieldWarning
|
|
23
|
-
from cognite.neat._rules._shared import ReadRules, T_InputRules
|
|
24
|
-
from cognite.neat._rules.models import (
|
|
22
|
+
from cognite.neat.core._issues.warnings import FileMissingRequiredFieldWarning
|
|
23
|
+
from cognite.neat.core._rules._shared import ReadRules, T_InputRules
|
|
24
|
+
from cognite.neat.core._rules.models import (
|
|
25
25
|
INPUT_RULES_BY_ROLE,
|
|
26
26
|
VERIFIED_RULES_BY_ROLE,
|
|
27
27
|
RoleTypes,
|
|
28
28
|
SchemaCompleteness,
|
|
29
29
|
)
|
|
30
|
-
from cognite.neat._utils.spreadsheet import SpreadsheetRead, read_individual_sheet
|
|
31
|
-
from cognite.neat._utils.text import humanize_collection
|
|
30
|
+
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead, read_individual_sheet
|
|
31
|
+
from cognite.neat.core._utils.text import humanize_collection
|
|
32
32
|
|
|
33
33
|
from ._base import BaseImporter
|
|
34
34
|
|
|
@@ -3,17 +3,17 @@ from typing import Any, cast
|
|
|
3
3
|
|
|
4
4
|
import yaml
|
|
5
5
|
|
|
6
|
-
from cognite.neat._issues import IssueList, MultiValueError, NeatIssue
|
|
7
|
-
from cognite.neat._issues.errors import (
|
|
6
|
+
from cognite.neat.core._issues import IssueList, MultiValueError, NeatIssue
|
|
7
|
+
from cognite.neat.core._issues.errors import (
|
|
8
8
|
FileMissingRequiredFieldError,
|
|
9
9
|
FileNotAFileError,
|
|
10
10
|
FileNotFoundNeatError,
|
|
11
11
|
FileReadError,
|
|
12
12
|
FileTypeUnexpectedError,
|
|
13
13
|
)
|
|
14
|
-
from cognite.neat._issues.warnings import NeatValueWarning
|
|
15
|
-
from cognite.neat._rules._shared import ReadRules, T_InputRules
|
|
16
|
-
from cognite.neat._rules.models import INPUT_RULES_BY_ROLE, RoleTypes
|
|
14
|
+
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
15
|
+
from cognite.neat.core._rules._shared import ReadRules, T_InputRules
|
|
16
|
+
from cognite.neat.core._rules.models import INPUT_RULES_BY_ROLE, RoleTypes
|
|
17
17
|
|
|
18
18
|
from ._base import BaseImporter
|
|
19
19
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from cognite.neat._client.data_classes.schema import DMSSchema
|
|
2
|
-
from cognite.neat._rules.models.information._rules import InformationRules
|
|
3
|
-
from cognite.neat._rules.models.information._rules_input import
|
|
1
|
+
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
2
|
+
from cognite.neat.core._rules.models.information._rules import InformationRules
|
|
3
|
+
from cognite.neat.core._rules.models.information._rules_input import (
|
|
4
|
+
InformationInputRules,
|
|
5
|
+
)
|
|
4
6
|
|
|
5
7
|
from ._base_rules import DataModelType, ExtensionCategory, RoleTypes, SchemaCompleteness, SheetList, SheetRow
|
|
6
8
|
from .dms._rules import DMSRules
|
|
@@ -26,8 +26,8 @@ from pydantic.main import IncEx
|
|
|
26
26
|
from pydantic_core import core_schema
|
|
27
27
|
from rdflib import Namespace, URIRef
|
|
28
28
|
|
|
29
|
-
from cognite.neat._constants import DEFAULT_NAMESPACE
|
|
30
|
-
from cognite.neat._rules.models._types import (
|
|
29
|
+
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
30
|
+
from cognite.neat.core._rules.models._types import (
|
|
31
31
|
ContainerEntityType,
|
|
32
32
|
DataModelExternalIdType,
|
|
33
33
|
DmsPropertyType,
|
|
@@ -37,9 +37,13 @@ from cognite.neat._rules.models._types import (
|
|
|
37
37
|
VersionType,
|
|
38
38
|
ViewEntityType,
|
|
39
39
|
)
|
|
40
|
-
from cognite.neat._rules.models.data_types import DataType
|
|
41
|
-
from cognite.neat._rules.models.entities import
|
|
42
|
-
|
|
40
|
+
from cognite.neat.core._rules.models.data_types import DataType
|
|
41
|
+
from cognite.neat.core._rules.models.entities import (
|
|
42
|
+
EdgeEntity,
|
|
43
|
+
ReverseConnectionEntity,
|
|
44
|
+
ViewEntity,
|
|
45
|
+
)
|
|
46
|
+
from cognite.neat.core._utils.rdf_ import uri_display_name
|
|
43
47
|
|
|
44
48
|
if sys.version_info >= (3, 11):
|
|
45
49
|
from enum import StrEnum
|
|
@@ -102,7 +106,6 @@ class DataModelAspect(StrEnum):
|
|
|
102
106
|
|
|
103
107
|
|
|
104
108
|
class RoleTypes(StrEnum):
|
|
105
|
-
domain_expert = "domain expert"
|
|
106
109
|
information = "information architect"
|
|
107
110
|
dms = "DMS Architect"
|
|
108
111
|
|
|
@@ -14,17 +14,17 @@ from pydantic import (
|
|
|
14
14
|
)
|
|
15
15
|
from pydantic.functional_serializers import PlainSerializer
|
|
16
16
|
|
|
17
|
-
from cognite.neat._issues.errors import RegexViolationError
|
|
18
|
-
from cognite.neat._issues.warnings import RegexViolationWarning
|
|
19
|
-
from cognite.neat._rules._constants import (
|
|
17
|
+
from cognite.neat.core._issues.errors import RegexViolationError
|
|
18
|
+
from cognite.neat.core._issues.warnings import RegexViolationWarning
|
|
19
|
+
from cognite.neat.core._rules._constants import (
|
|
20
20
|
DATA_MODEL_COMPLIANCE_REGEX,
|
|
21
21
|
PATTERNS,
|
|
22
22
|
PREFIX_COMPLIANCE_REGEX,
|
|
23
23
|
VERSION_COMPLIANCE_REGEX,
|
|
24
24
|
EntityTypes,
|
|
25
25
|
)
|
|
26
|
-
from cognite.neat._rules.models.entities._multi_value import MultiValueTypeInfo
|
|
27
|
-
from cognite.neat._rules.models.entities._single_value import (
|
|
26
|
+
from cognite.neat.core._rules.models.entities._multi_value import MultiValueTypeInfo
|
|
27
|
+
from cognite.neat.core._rules.models.entities._single_value import (
|
|
28
28
|
ClassEntity,
|
|
29
29
|
ContainerEntity,
|
|
30
30
|
ViewEntity,
|
|
@@ -10,9 +10,15 @@ from pydantic import BaseModel, Field, model_serializer, model_validator
|
|
|
10
10
|
from pydantic.functional_validators import ModelWrapValidatorHandler
|
|
11
11
|
from rdflib import URIRef
|
|
12
12
|
|
|
13
|
-
from cognite.neat._constants import XML_SCHEMA_NAMESPACE
|
|
14
|
-
from cognite.neat._rules._constants import
|
|
15
|
-
|
|
13
|
+
from cognite.neat.core._constants import XML_SCHEMA_NAMESPACE
|
|
14
|
+
from cognite.neat.core._rules._constants import (
|
|
15
|
+
SPLIT_ON_COMMA_PATTERN,
|
|
16
|
+
SPLIT_ON_EQUAL_PATTERN,
|
|
17
|
+
)
|
|
18
|
+
from cognite.neat.core._rules.models.entities._single_value import (
|
|
19
|
+
ClassEntity,
|
|
20
|
+
UnitEntity,
|
|
21
|
+
)
|
|
16
22
|
|
|
17
23
|
if sys.version_info >= (3, 11):
|
|
18
24
|
from typing import Self
|
|
@@ -13,26 +13,33 @@ from cognite.client.data_classes.data_modeling.views import (
|
|
|
13
13
|
ViewPropertyApply,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
-
from cognite.neat._client.data_classes.data_modeling import (
|
|
16
|
+
from cognite.neat.core._client.data_classes.data_modeling import (
|
|
17
17
|
ContainerApplyDict,
|
|
18
18
|
NodeApplyDict,
|
|
19
19
|
SpaceApplyDict,
|
|
20
20
|
ViewApplyDict,
|
|
21
21
|
)
|
|
22
|
-
from cognite.neat._client.data_classes.schema import DMSSchema
|
|
23
|
-
from cognite.neat._constants import (
|
|
22
|
+
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
23
|
+
from cognite.neat.core._constants import (
|
|
24
24
|
COGNITE_SPACES,
|
|
25
25
|
DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT,
|
|
26
26
|
DMS_PRIMITIVE_LIST_DEFAULT_LIMIT,
|
|
27
27
|
)
|
|
28
|
-
from cognite.neat._issues.errors import
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
from cognite.neat.core._issues.errors import (
|
|
29
|
+
NeatTypeError,
|
|
30
|
+
NeatValueError,
|
|
31
|
+
ResourceNotFoundError,
|
|
32
|
+
)
|
|
33
|
+
from cognite.neat.core._issues.warnings import (
|
|
34
|
+
NotSupportedWarning,
|
|
35
|
+
PropertyNotFoundWarning,
|
|
36
|
+
)
|
|
37
|
+
from cognite.neat.core._issues.warnings.user_modeling import (
|
|
31
38
|
EmptyContainerWarning,
|
|
32
39
|
HasDataFilterOnNoPropertiesViewWarning,
|
|
33
40
|
)
|
|
34
|
-
from cognite.neat._rules.models.data_types import DataType, Double, Enum, Float
|
|
35
|
-
from cognite.neat._rules.models.entities import (
|
|
41
|
+
from cognite.neat.core._rules.models.data_types import DataType, Double, Enum, Float
|
|
42
|
+
from cognite.neat.core._rules.models.entities import (
|
|
36
43
|
ClassEntity,
|
|
37
44
|
ContainerEntity,
|
|
38
45
|
DMSFilter,
|
|
@@ -8,11 +8,11 @@ from cognite.client import data_modeling as dm
|
|
|
8
8
|
from pydantic import Field, field_serializer, field_validator, model_validator
|
|
9
9
|
from pydantic_core.core_schema import SerializationInfo, ValidationInfo
|
|
10
10
|
|
|
11
|
-
from cognite.neat._client.data_classes.schema import DMSSchema
|
|
12
|
-
from cognite.neat._constants import DMS_CONTAINER_LIST_MAX_LIMIT
|
|
13
|
-
from cognite.neat._issues.errors import NeatValueError
|
|
14
|
-
from cognite.neat._issues.warnings._general import NeatValueWarning
|
|
15
|
-
from cognite.neat._rules.models._base_rules import (
|
|
11
|
+
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
12
|
+
from cognite.neat.core._constants import DMS_CONTAINER_LIST_MAX_LIMIT
|
|
13
|
+
from cognite.neat.core._issues.errors import NeatValueError
|
|
14
|
+
from cognite.neat.core._issues.warnings._general import NeatValueWarning
|
|
15
|
+
from cognite.neat.core._rules.models._base_rules import (
|
|
16
16
|
BaseMetadata,
|
|
17
17
|
BaseRules,
|
|
18
18
|
ContainerProperty,
|
|
@@ -23,7 +23,7 @@ from cognite.neat._rules.models._base_rules import (
|
|
|
23
23
|
ViewProperty,
|
|
24
24
|
ViewRef,
|
|
25
25
|
)
|
|
26
|
-
from cognite.neat._rules.models._types import (
|
|
26
|
+
from cognite.neat.core._rules.models._types import (
|
|
27
27
|
ClassEntityType,
|
|
28
28
|
ContainerEntityType,
|
|
29
29
|
DmsPropertyType,
|
|
@@ -31,8 +31,8 @@ from cognite.neat._rules.models._types import (
|
|
|
31
31
|
URIRefType,
|
|
32
32
|
ViewEntityType,
|
|
33
33
|
)
|
|
34
|
-
from cognite.neat._rules.models.data_types import DataType
|
|
35
|
-
from cognite.neat._rules.models.entities import (
|
|
34
|
+
from cognite.neat.core._rules.models.data_types import DataType
|
|
35
|
+
from cognite.neat.core._rules.models.entities import (
|
|
36
36
|
ContainerEntityList,
|
|
37
37
|
DMSEntity,
|
|
38
38
|
DMSNodeEntity,
|
|
@@ -48,7 +48,7 @@ from cognite.neat._rules.models.entities import (
|
|
|
48
48
|
)
|
|
49
49
|
|
|
50
50
|
if TYPE_CHECKING:
|
|
51
|
-
from cognite.neat._rules.models import InformationRules
|
|
51
|
+
from cognite.neat.core._rules.models import InformationRules
|
|
52
52
|
|
|
53
53
|
_DEFAULT_VERSION = "1"
|
|
54
54
|
|
|
@@ -10,11 +10,14 @@ from cognite.client import data_modeling as dm
|
|
|
10
10
|
from cognite.client.data_classes.data_modeling import ContainerId, ViewId
|
|
11
11
|
from rdflib import Namespace, URIRef
|
|
12
12
|
|
|
13
|
-
from cognite.neat._constants import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
from cognite.neat.
|
|
13
|
+
from cognite.neat.core._constants import (
|
|
14
|
+
DEFAULT_NAMESPACE,
|
|
15
|
+
DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT,
|
|
16
|
+
)
|
|
17
|
+
from cognite.neat.core._issues.warnings import DeprecatedWarning
|
|
18
|
+
from cognite.neat.core._rules.models._base_input import InputComponent, InputRules
|
|
19
|
+
from cognite.neat.core._rules.models.data_types import DataType
|
|
20
|
+
from cognite.neat.core._rules.models.entities import (
|
|
18
21
|
ContainerEntity,
|
|
19
22
|
DMSNodeEntity,
|
|
20
23
|
DMSUnknownEntity,
|
|
@@ -24,8 +27,8 @@ from cognite.neat._rules.models.entities import (
|
|
|
24
27
|
load_connection,
|
|
25
28
|
load_dms_value_type,
|
|
26
29
|
)
|
|
27
|
-
from cognite.neat._rules.models.entities._wrapped import DMSFilter
|
|
28
|
-
from cognite.neat._utils.rdf_ import uri_display_name
|
|
30
|
+
from cognite.neat.core._rules.models.entities._wrapped import DMSFilter
|
|
31
|
+
from cognite.neat.core._utils.rdf_ import uri_display_name
|
|
29
32
|
|
|
30
33
|
from ._rules import _DEFAULT_VERSION, DMSContainer, DMSEnum, DMSMetadata, DMSNode, DMSProperty, DMSRules, DMSView
|
|
31
34
|
|
|
@@ -12,17 +12,17 @@ from cognite.client.data_classes.data_modeling.views import (
|
|
|
12
12
|
ViewPropertyApply,
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
from cognite.neat._client import NeatClient
|
|
16
|
-
from cognite.neat._client.data_classes.data_modeling import ViewApplyDict
|
|
17
|
-
from cognite.neat._client.data_classes.schema import DMSSchema
|
|
18
|
-
from cognite.neat._constants import (
|
|
15
|
+
from cognite.neat.core._client import NeatClient
|
|
16
|
+
from cognite.neat.core._client.data_classes.data_modeling import ViewApplyDict
|
|
17
|
+
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
18
|
+
from cognite.neat.core._constants import (
|
|
19
19
|
COGNITE_MODELS,
|
|
20
20
|
COGNITE_SPACES,
|
|
21
21
|
DMS_CONTAINER_PROPERTY_SIZE_LIMIT,
|
|
22
22
|
DMS_VIEW_CONTAINER_SIZE_LIMIT,
|
|
23
23
|
)
|
|
24
|
-
from cognite.neat._issues import IssueList, NeatError
|
|
25
|
-
from cognite.neat._issues.errors import (
|
|
24
|
+
from cognite.neat.core._issues import IssueList, NeatError
|
|
25
|
+
from cognite.neat.core._issues.errors import (
|
|
26
26
|
CDFMissingClientError,
|
|
27
27
|
PropertyDefinitionDuplicatedError,
|
|
28
28
|
PropertyMappingDuplicatedError,
|
|
@@ -31,25 +31,25 @@ from cognite.neat._issues.errors import (
|
|
|
31
31
|
ResourceNotFoundError,
|
|
32
32
|
ReversedConnectionNotFeasibleError,
|
|
33
33
|
)
|
|
34
|
-
from cognite.neat._issues.errors._external import CDFMissingResourcesError
|
|
35
|
-
from cognite.neat._issues.warnings import (
|
|
34
|
+
from cognite.neat.core._issues.errors._external import CDFMissingResourcesError
|
|
35
|
+
from cognite.neat.core._issues.warnings import (
|
|
36
36
|
NotSupportedHasDataFilterLimitWarning,
|
|
37
37
|
NotSupportedViewContainerLimitWarning,
|
|
38
38
|
UndefinedViewWarning,
|
|
39
39
|
user_modeling,
|
|
40
40
|
)
|
|
41
|
-
from cognite.neat._issues.warnings.user_modeling import (
|
|
41
|
+
from cognite.neat.core._issues.warnings.user_modeling import (
|
|
42
42
|
ContainerPropertyLimitWarning,
|
|
43
43
|
DirectRelationMissingSourceWarning,
|
|
44
44
|
NotNeatSupportedFilterWarning,
|
|
45
45
|
)
|
|
46
|
-
from cognite.neat._rules.models.data_types import DataType
|
|
47
|
-
from cognite.neat._rules.models.entities import ContainerEntity, RawFilter
|
|
48
|
-
from cognite.neat._rules.models.entities._single_value import (
|
|
46
|
+
from cognite.neat.core._rules.models.data_types import DataType
|
|
47
|
+
from cognite.neat.core._rules.models.entities import ContainerEntity, RawFilter
|
|
48
|
+
from cognite.neat.core._rules.models.entities._single_value import (
|
|
49
49
|
ViewEntity,
|
|
50
50
|
)
|
|
51
|
-
from cognite.neat._utils.spreadsheet import SpreadsheetRead
|
|
52
|
-
from cognite.neat._utils.text import humanize_collection
|
|
51
|
+
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead
|
|
52
|
+
from cognite.neat.core._utils.text import humanize_collection
|
|
53
53
|
|
|
54
54
|
from ._rules import DMSProperty, DMSRules
|
|
55
55
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import Literal
|
|
2
2
|
|
|
3
|
-
from cognite.neat._issues.errors import NeatTypeError
|
|
4
|
-
from cognite.neat._rules.models.data_types import DataType
|
|
3
|
+
from cognite.neat.core._issues.errors import NeatTypeError
|
|
4
|
+
from cognite.neat.core._rules.models.data_types import DataType
|
|
5
5
|
|
|
6
6
|
from ._multi_value import MultiValueTypeInfo
|
|
7
7
|
from ._single_value import (
|
|
@@ -6,8 +6,8 @@ from pydantic import (
|
|
|
6
6
|
model_validator,
|
|
7
7
|
)
|
|
8
8
|
|
|
9
|
-
from cognite.neat._rules._constants import EntityTypes
|
|
10
|
-
from cognite.neat._rules.models.data_types import DataType
|
|
9
|
+
from cognite.neat.core._rules._constants import EntityTypes
|
|
10
|
+
from cognite.neat.core._rules.models.data_types import DataType
|
|
11
11
|
|
|
12
12
|
from ._constants import _PARSE, Undefined
|
|
13
13
|
from ._single_value import ClassEntity, UnknownEntity
|
|
@@ -22,8 +22,8 @@ from pydantic import (
|
|
|
22
22
|
model_validator,
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
-
from cognite.neat._issues.errors import NeatValueError
|
|
26
|
-
from cognite.neat._utils.text import replace_non_alphanumeric_with_underscore
|
|
25
|
+
from cognite.neat.core._issues.errors import NeatValueError
|
|
26
|
+
from cognite.neat.core._utils.text import replace_non_alphanumeric_with_underscore
|
|
27
27
|
|
|
28
28
|
if sys.version_info >= (3, 11):
|
|
29
29
|
from enum import StrEnum
|
|
@@ -32,7 +32,7 @@ else:
|
|
|
32
32
|
from backports.strenum import StrEnum
|
|
33
33
|
from typing_extensions import Self
|
|
34
34
|
|
|
35
|
-
from cognite.neat._rules._constants import (
|
|
35
|
+
from cognite.neat.core._rules._constants import (
|
|
36
36
|
ENTITY_PATTERN,
|
|
37
37
|
SPLIT_ON_COMMA_PATTERN,
|
|
38
38
|
SPLIT_ON_EDGE_ENTITY_ARGS_PATTERN,
|
|
@@ -107,12 +107,20 @@ class DMSFilter(WrappedEntity):
|
|
|
107
107
|
(body := dumped.get(dm.filters.Equals._filter_name))
|
|
108
108
|
and (value := body.get("value"))
|
|
109
109
|
and isinstance(value, dict)
|
|
110
|
+
and (space := value.get("space"))
|
|
111
|
+
and (external_id := value.get("externalId"))
|
|
112
|
+
):
|
|
113
|
+
return NodeTypeFilter(inner=[DMSNodeEntity(space=space, externalId=external_id)])
|
|
114
|
+
elif (
|
|
115
|
+
(body := dumped.get(dm.filters.In._filter_name))
|
|
116
|
+
and (values := body.get("values"))
|
|
117
|
+
and all(
|
|
118
|
+
[
|
|
119
|
+
(True if isinstance(entry, dict) and "space" in entry and "externalId" in entry else False)
|
|
120
|
+
for entry in values
|
|
121
|
+
]
|
|
122
|
+
)
|
|
110
123
|
):
|
|
111
|
-
space = value.get("space")
|
|
112
|
-
external_id = value.get("externalId")
|
|
113
|
-
if space is not None and external_id is not None:
|
|
114
|
-
return NodeTypeFilter(inner=[DMSNodeEntity(space=space, externalId=external_id)])
|
|
115
|
-
elif (body := dumped.get(dm.filters.In._filter_name)) and (values := body.get("values")):
|
|
116
124
|
return NodeTypeFilter(
|
|
117
125
|
inner=[
|
|
118
126
|
DMSNodeEntity(space=entry["space"], externalId=entry["externalId"])
|