Skip to content

Commit cf960f0

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 fc22cee commit cf960f0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

linkml_runtime/utils/metamodelcore.py

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

168168
@classmethod
169169
def ns_ln(cls, v: str) -> Optional[Tuple[str, str]]:
170-
# See if this is indeed a valid CURIE, ie, it can be split by a colon
170+
if not validate_curie(v):
171+
return None
172+
# assume the presence of a colon and try to split the CURIE
171173
curie_split = v.split(':', 1)
172174
if len(curie_split) == 1:
173-
# there is no ':' character in the string, ie, it is not a valid CURIE
174-
return None
175+
# there is no ':' character in the string, it's only a reference
176+
return '', v
175177
else:
176178
prefix = curie_split[0].lower()
177-
if not NCName.is_valid(prefix):
178-
return None
179179
reference = curie_split[1]
180-
if not cls.term_name.match(reference):
181-
return None
182-
return prefix, reference
180+
return prefix, reference
183181

184182
@classmethod
185183
def is_valid(cls, v: str) -> bool:

0 commit comments

Comments
 (0)