Skip to content

Using wrong XSD type for URIorCURIE #2213

@Silvanoc

Description

@Silvanoc

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:

  1. Get an XML Schema Validator (I have tested it with this and this online validators )
  2. 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>
  3. 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"/>
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that should work but isn't, with an example and a test case.community-generated

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions