Skip to content

Commit 2262599

Browse files
committed
fix: curie validation in metamodelcore erroneous
CURIE validation in metamodelcore was erroneous and rejecting valid CURIEs like those missing a prefix and a colon. This patch fixes it. Signed-off-by: Silvano Cirujano Cuesta <[email protected]>
1 parent 2e2bdcb commit 2262599

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

linkml_runtime/utils/metamodelcore.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,17 @@ def __init__(self, v: str) -> None:
172172

173173
@classmethod
174174
def ns_ln(cls, v: str) -> Optional[tuple[str, str]]:
175-
# See if this is indeed a valid CURIE, ie, it can be split by a colon
175+
if not validate_curie(v):
176+
return None
177+
# assume the presence of a colon and try to split the CURIE
176178
curie_split = v.split(":", 1)
177179
if len(curie_split) == 1:
178-
# there is no ':' character in the string, ie, it is not a valid CURIE
179-
return None
180+
# there is no ':' character in the string, it's only a reference
181+
return '', v
180182
else:
181183
prefix = curie_split[0].lower()
182-
if not NCName.is_valid(prefix):
183-
return None
184184
reference = curie_split[1]
185-
return prefix, reference
185+
return prefix, reference
186186

187187
@classmethod
188188
def is_valid(cls, v: str) -> bool:

0 commit comments

Comments
 (0)