cognite-neat 0.127.23__py3-none-any.whl → 0.127.25__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.
@@ -93,6 +93,8 @@ def humanize_validation_error(
93
93
  )
94
94
  elif type_ == "union_tag_invalid":
95
95
  msg = error["msg"].replace(", 'direct'", "").replace("found using 'type' ", "").replace("tag", "value")
96
+ elif type_ == "string_pattern_mismatch":
97
+ msg = f"string '{error['input']}' does not match the required pattern: '{error['ctx']['pattern']}'."
96
98
 
97
99
  elif type_.endswith("_type"):
98
100
  msg = f"{error['msg']}. Got {error['input']!r} of type {type(error['input']).__name__}."
@@ -142,8 +144,11 @@ def _enum_message(type_: str, loc: tuple[int | str, ...], context: ValidationCon
142
144
  if loc[-1] != "values":
143
145
  raise RuntimeError("This is a neat bug, report to the team.")
144
146
  if type_ == "missing":
145
- return f"In {context.humanize_location(loc[:-1])} definition is missing the collection reference"
147
+ return (
148
+ f"In {context.humanize_location(loc[:-1])} definition should include "
149
+ "a reference to a collection in the 'Enum' sheet (e.g., collection='MyEnumCollection')."
150
+ )
146
151
  elif type_ == "too_short":
147
- return f"In {context.humanize_location(loc[:-1])} collection is not defined in 'Enum' sheet"
152
+ return f"In {context.humanize_location(loc[:-1])} collection is not defined in the 'Enum' sheet"
148
153
  else:
149
154
  raise RuntimeError("This is a neat bug, report to the team.")
cognite/neat/_version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.127.23"
1
+ __version__ = "0.127.25"
2
2
  __engine__ = "^2.0.4"
@@ -27,33 +27,53 @@ CLASSES_QUERY = """SELECT ?concept ?name ?description ?implements
27
27
 
28
28
  CLASSES_QUERY_PARAMETERS = {"concept", "name", "description", "implements"}
29
29
 
30
- PROPERTIES_QUERY = """
31
-
32
- SELECT ?concept ?property_ ?name ?description ?value_type ?minCount ?maxCount ?default
30
+ PROPERTIES_QUERY = """ SELECT ?concept ?property_ ?name ?description ?value_type ?min_count ?max_count ?default
33
31
  WHERE {{
34
32
  ?property_ a ?property_Type.
35
33
  FILTER (?property_Type IN (owl:ObjectProperty, owl:DatatypeProperty ) )
36
34
 
35
+ # --- 1. Explicit Domain Discovery ---
37
36
 
37
+ # A. Handling owl:domain when it is expressed as owl restriction
38
+ OPTIONAL {{
39
+ ?property_ rdfs:domain ?domain_exp_node .
40
+ FILTER(isBlank(?domain_exp_node))
41
+ ?domain_exp_node owl:unionOf|owl:intersectionOf ?exp_concepts_list .
42
+ ?exp_concepts_list rdf:rest*/rdf:first ?explicit_concept.
43
+ }}
38
44
 
39
- # Handling owl:domain when it is expressed as
40
- # owl restriction
45
+ # B. Handling the domain when it is a single concept
41
46
  OPTIONAL {{
42
- ?property_ rdfs:domain ?domain .
43
- FILTER(isBlank(?domain))
44
- ?domain owl:unionOf|owl:intersectionOf ?concepts .
45
- ?concepts rdf:rest*/rdf:first ?concept.
47
+ ?property_ rdfs:domain ?domain_exp_node .
48
+ FILTER(!isBlank(?domain_exp_node))
49
+ BIND(?domain_exp_node AS ?explicit_concept)
46
50
  }}
47
51
 
48
- # Handling the domain when it is a single concept
52
+ # --- 2. Inherited Domain Discovery (Fallback) ---
53
+
54
+ # C. Handling inherited domain when parent domain is a restriction
49
55
  OPTIONAL {{
50
- ?property_ rdfs:domain ?domain .
51
- FILTER(!isBlank(?domain))
52
- BIND(?domain AS ?concept)
56
+ ?property_ rdfs:subPropertyOf ?parent_property .
57
+ ?parent_property rdfs:domain ?parent_domain_node .
58
+ FILTER(isBlank(?parent_domain_node))
59
+ ?parent_domain_node owl:unionOf|owl:intersectionOf ?parent_concepts_list .
60
+ ?parent_concepts_list rdf:rest*/rdf:first ?inherited_concept.
53
61
  }}
54
62
 
55
- # Handling owl:range when it is expressed as
56
- # owl restriction
63
+ # D. Handling inherited domain when parent domain is a single concept
64
+ OPTIONAL {{
65
+ ?property_ rdfs:subPropertyOf ?parent_property .
66
+ ?parent_property rdfs:domain ?parent_domain_node .
67
+ FILTER(!isBlank(?parent_domain_node))
68
+ BIND(?parent_domain_node AS ?inherited_concept)
69
+ }}
70
+
71
+ # Final Concept Assignment with Priority ---
72
+ # COALESCE prioritizes ?explicit_concept over ?inherited_concept
73
+ BIND(COALESCE(?explicit_concept, ?inherited_concept) AS ?concept)
74
+
75
+
76
+ # Handling owl:range when it is expressed as owl restriction
57
77
  OPTIONAL {{
58
78
  ?property_ rdfs:range ?range .
59
79
  FILTER(isBlank(?range))
@@ -70,8 +90,8 @@ PROPERTIES_QUERY = """
70
90
 
71
91
  OPTIONAL {{?property_ rdfs:label|skos:prefLabel ?name }}.
72
92
  OPTIONAL {{?property_ rdfs:comment|skos:definition ?description}}.
73
- OPTIONAL {{?property_ owl:maxCardinality ?maxCount}}.
74
- OPTIONAL {{?property_ owl:minCardinality ?minCount}}.
93
+ OPTIONAL {{?property_ owl:maxCardinality ?max_count}}.
94
+ OPTIONAL {{?property_ owl:minCardinality ?min_count}}.
75
95
 
76
96
  # FILTERS
77
97
  FILTER (!isBlank(?property_))
@@ -85,8 +105,8 @@ PROPERTIES_QUERY_PARAMETERS = {
85
105
  "name",
86
106
  "description",
87
107
  "value_type",
88
- "minCount",
89
- "maxCount",
108
+ "min_count",
109
+ "max_count",
90
110
  "default",
91
111
  }
92
112
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-neat
3
- Version: 0.127.23
3
+ Version: 0.127.25
4
4
  Summary: Knowledge graph transformation
5
5
  Project-URL: Documentation, https://cognite-neat.readthedocs-hosted.com/
6
6
  Project-URL: Homepage, https://cognite-neat.readthedocs-hosted.com/
@@ -1,7 +1,7 @@
1
1
  cognite/neat/__init__.py,sha256=Lo4DbjDOwnhCYUoAgPp5RG1fDdF7OlnomalTe7n1ydw,211
2
2
  cognite/neat/_exceptions.py,sha256=ox-5hXpee4UJlPE7HpuEHV2C96aLbLKo-BhPDoOAzhA,1650
3
3
  cognite/neat/_issues.py,sha256=wH1mnkrpBsHUkQMGUHFLUIQWQlfJ_qMfdF7q0d9wNhY,1871
4
- cognite/neat/_version.py,sha256=6DktX2aOea0YNw_rdzDYmaQ9evSmuWHFadhPA0xSc_M,47
4
+ cognite/neat/_version.py,sha256=Hsl6r_Z4Ik-HLkbCToNXmmjME2_bdiVlGTB06JNU8HM,47
5
5
  cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  cognite/neat/v1.py,sha256=owqW5Mml2DSZx1AvPvwNRTBngfhBNrQ6EH-7CKL7Jp0,61
7
7
  cognite/neat/_client/__init__.py,sha256=75Bh7eGhaN4sOt3ZcRzHl7pXaheu1z27kmTHeaI05vo,114
@@ -116,7 +116,7 @@ cognite/neat/_utils/auxiliary.py,sha256=Cx-LP8dfN782R3iUcm--q26zdzQ0k_RFnVbJ0bwV
116
116
  cognite/neat/_utils/collection.py,sha256=BIwRrFbUXNPvHhEVujLHgVoDJXzdPEMScrbSBhyCibk,446
117
117
  cognite/neat/_utils/text.py,sha256=-ujNaG_hLkdurKsUmZB9ZI_kJkddlCKEf8g-g_XCk10,2010
118
118
  cognite/neat/_utils/useful_types.py,sha256=BwTjcWnpxnxN8rWXuYXMgU55O_YjVteMtYK0y25OmH0,1260
119
- cognite/neat/_utils/validation.py,sha256=Pg6EzS-sxB3k4P3OR1O15SSqBXIzpbPwvPSrosOxNJk,6675
119
+ cognite/neat/_utils/validation.py,sha256=U422V0TY5KujFJFyfhRLONVj5A4AcCWgqIKVK6BUm7M,6938
120
120
  cognite/neat/_utils/http_client/__init__.py,sha256=qaCLLLhi7H3b_cmbknX0S66KILT7JSKX1YSgZjNdd1U,786
121
121
  cognite/neat/_utils/http_client/_client.py,sha256=TO9C77LcsqX0R3Fu-mP560nnV6rP5oRXki9kxRYtBlg,9658
122
122
  cognite/neat/_utils/http_client/_config.py,sha256=C8IF1JoijmVMjA_FEMgAkiD1buEV1cY5Og3t-Ecyfmk,756
@@ -166,7 +166,7 @@ cognite/neat/v0/core/_data_model/importers/_spreadsheet2data_model.py,sha256=ksD
166
166
  cognite/neat/v0/core/_data_model/importers/_rdf/__init__.py,sha256=1yOjV2PKCxwH7uCTXVZhSdxtn5etmFX40cksvwtKcZ8,199
167
167
  cognite/neat/v0/core/_data_model/importers/_rdf/_base.py,sha256=Rv24TQQDZqAuFD8Qh0yRBiB7-JvoMVj3mGoPBm-xBFs,6052
168
168
  cognite/neat/v0/core/_data_model/importers/_rdf/_inference2rdata_model.py,sha256=w8LsdkzgoTXN3LZyjEL_5grWZGlf7PPj8qOu370_K6M,28976
169
- cognite/neat/v0/core/_data_model/importers/_rdf/_owl2data_model.py,sha256=JsL2gpVs4ntLyzncgRYic-4qSiDhXT-6xN3jTLo629U,4031
169
+ cognite/neat/v0/core/_data_model/importers/_rdf/_owl2data_model.py,sha256=6fS2IhmRjsQdENYb47bSvRcqTzp7zr0YUuRIsYY-EPc,5200
170
170
  cognite/neat/v0/core/_data_model/importers/_rdf/_shared.py,sha256=lcMnGIvqYZJ41JPjzanZHi9uG826EzYHpQXSMYVRK8A,9839
171
171
  cognite/neat/v0/core/_data_model/models/__init__.py,sha256=whWV0FrdUi01Du2mgan3_kZHQ9T2tGrGb2xRxoFDhNo,1258
172
172
  cognite/neat/v0/core/_data_model/models/_base_unverified.py,sha256=1Wfbp-tJaEF6hd1bFdp2FhTgPkInf-1ZokuEoVJRPxQ,6842
@@ -312,7 +312,7 @@ cognite/neat/v0/session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4
312
312
  cognite/neat/v0/session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
313
313
  cognite/neat/v0/session/engine/_interface.py,sha256=3W-cYr493c_mW3P5O6MKN1xEQg3cA7NHR_ev3zdF9Vk,533
314
314
  cognite/neat/v0/session/engine/_load.py,sha256=u0x7vuQCRoNcPt25KJBJRn8sJabonYK4vtSZpiTdP4k,5201
315
- cognite_neat-0.127.23.dist-info/METADATA,sha256=Ax86njFaCOT2zngYvUBqbGlWnTbu744tClzc7erssFs,9150
316
- cognite_neat-0.127.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
317
- cognite_neat-0.127.23.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
318
- cognite_neat-0.127.23.dist-info/RECORD,,
315
+ cognite_neat-0.127.25.dist-info/METADATA,sha256=t6VBbJO1-wAlt1FwCCk-rq9Pcdood0JN3AIw8SwdyTI,9150
316
+ cognite_neat-0.127.25.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
317
+ cognite_neat-0.127.25.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
318
+ cognite_neat-0.127.25.dist-info/RECORD,,