-
Notifications
You must be signed in to change notification settings - Fork 125
Description
Describe the bug
Urieorcurie type is declared with URI xsd:anyURI, what is wrong since a CURIE might not be a valid URI.
To reproduce
Steps to reproduce the behavior:
- Get an XML Schema Validator (I have tested it with this and this online validators )
- Provide an XML Schema that specifies the type
xsd:anyURI
on an attribute value. This is the one that I have used:<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="slot_type"> <xs:complexType> <xs:attribute name="src" type="xs:anyURI"/> </xs:complexType> </xs:element> </xs:schema>
- Provide a minimalistic XML document containing a CURIE with an underscore
'_'
in the prefix. This is what I have used:<slot_type src="pre_fix:reference"/>
- See error
cvc-datatype-valid.1.2.1: 'pre_fix:reference' is not a valid value for 'anyURI'.
or similar.
Expected behavior
A type that gets a XML-Schema URI as its URI, should comply with the corresponding XML-Schema.
The is no type in the "W3C XML Schema Definition Language (XSD) 1.1" for CURIEs. The CURIE specification provides an XML-Schema for CURIEs, but this does not help for the URI of the LinkML Uriorcurie
or Curie
types.
In this specific case, having xsd:anyURI
as URI for Uriorcurie
LinkML type should mean that any value that is a valid URI or CURIE should pass the XML-Schema validation, what is not true for the valid CURIE test_pref:Boat
.
Additional context
LinkML Model version: 1.8.x
I have discovered the issue by chance when trying to improve the JSON-Schema generated for URI, CURIE and URIorCURIE in MR #2212.
In commit 82b753b I have assigned JSON-Schema type string
with format uri
for all there types, assuming that CURIEs would be valid URIs because of the use of xsd:anyURI
for the URI of the LinkML type Uriorcurie
.
Luckily a test exists covering the corner case of a CURIE prefix containing an underscore: test_pref:Boat
and this test is failing with the changes proposed in the PR #2212.