Skip to content

Commit a8b4dd1

Browse files
authored
Merge pull request #142 from linkml/revert-140-revert-132-cmungall-patch-8
Revert "Revert "removing shexjsg""
2 parents 63f31fa + 42f8a06 commit a8b4dd1

File tree

4 files changed

+162
-197
lines changed

4 files changed

+162
-197
lines changed

linkml_runtime/utils/metamodelcore.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from typing import Union, Optional, Tuple
77
from urllib.parse import urlparse
88

9-
from ShExJSG.ShExJ import IRIREF, PN_PREFIX
109
from rdflib import Literal, BNode, URIRef
1110
from rdflib.namespace import is_ncname
1211
from rdflib.term import Identifier as rdflib_Identifier
@@ -137,9 +136,13 @@ def __init__(self, v: str) -> None:
137136
raise ValueError(f"{v}: is not a valid URI")
138137
super().__init__(v)
139138

139+
# this is more inclusive than the W3C specification
140+
#uri_re = re.compile("^[A-Za-z]\\S*$")
141+
uri_re = re.compile("^\\S+$")
142+
140143
@classmethod
141144
def is_valid(cls, v: str) -> bool:
142-
return v is not None and not URIorCURIE.is_curie(v) and isinstance(v, IRIREF)
145+
return v is not None and not URIorCURIE.is_curie(v) and cls.uri_re.match(v)
143146

144147

145148
class Curie(URIorCURIE):
@@ -172,7 +175,8 @@ def ns_ln(cls, v: str) -> Optional[Tuple[str, str]]:
172175
@classmethod
173176
def is_valid(cls, v: str) -> bool:
174177
pnln = cls.ns_ln(v)
175-
return pnln is not None and (not pnln[0] or isinstance(pnln[0], PN_PREFIX))
178+
#return pnln is not None and (not pnln[0] or isinstance(pnln[0], PN_PREFIX))
179+
return pnln is not None
176180

177181
# This code was extracted from the termorcurie package of the rdfa
178182
def as_uri(self, nsm: Namespaces) -> Optional[URIRef]:

0 commit comments

Comments
 (0)