2

I get ValueError: https://ceur-ws.org/Vol-2931/ICBO_2019_paper_20.pdf : is not a valid URI when trying to set an URI typed value using the generated python code from the linkml yaml file at https://github.com/WolfgangFahl/pyMetaModel/tree/main/examples/ceur-ws. There seems to be only a global strict setting to make this more lenientl.

Why would this URI be considered invalid?

The link https://ceur-ws.org/Vol-2931/ICBO_2019_paper_20.pdf seems to work just fine.

May be my runtime is outdated and i have to require a new version in my projects - the error showed up in 1.4.5 ...?

I upgraded (see below) and regenerated the code and the error persists.

see https://pypi.org/project/linkml-runtime/

 pip show linkml-runtime 
Name: linkml-runtime
Version: 1.4.10
Summary: Runtime environment for LinkML, the Linked open data modeling language
Home-page: https://github.com/linkml/linkml-runtime
Author: Chris Mungall
Author-email: cjmungall@lbl.gov
License: 
Location: /Users/wf/Library/Python/3.10/lib/python/site-packages
Requires: click, curies, deprecated, hbreader, json-flattener, jsonasobj2, jsonschema, prefixcommons, prefixmaps, pyyaml, rdflib, requests
Required-by: linkml, linkml-dataops, pyCEURspt, pyMetaModel

debugging leads to

class URI(URIorCURIE):
    """ A relative absolute URI
    """
    def __init__(self, v: str) -> None:
        if is_strict() and not URI.is_valid(v):
            raise ValueError(f"{v}: is not a valid URI")
        super().__init__(v)

    # this is more inclusive than the W3C specification
    #uri_re = re.compile("^[A-Za-z]\\S*$")
    uri_re = re.compile("^\\S+$")

    @classmethod
    def is_valid(cls, v: str) -> bool:
        return v is not None and not URIorCURIE.is_curie(v) and cls.uri_re.match(v)

Scientific Events Context

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186

1 Answers1

3

The cause for the problem was simply a trailing blank in the URLs:

constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2931/ICBO_2019_paper_20.pdf ' failed with https://ceur-ws.org/Vol-2931/ICBO_2019_paper_20.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_6.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_6.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_8.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_8.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_20.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_20.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_31.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_31.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_2.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_2.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_3.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_3.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_4.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_4.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_5.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_5.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_7.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_7.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_9.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_9.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_10.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_10.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_11.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_11.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_13.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_13.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_14.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_14.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_16.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_16.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_18.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_18.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_19.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_19.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_21.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_21.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_22.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_22.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_23.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_23.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_26.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_26.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_27.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_27.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_30.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_30.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_32.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_32.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-2178/SSN2018_paper_33.pdf ' failed with https://ceur-ws.org/Vol-2178/SSN2018_paper_33.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-1822/ ftp://SunSITE.Informatik.RWTH-Aachen.DE/pub/publications/CEUR-WS/Vol-1822.zip' failed with https://ceur-ws.org/Vol-1822/ ftp://SunSITE.Informatik.RWTH-Aachen.DE/pub/publications/CEUR-WS/Vol-1822.zip: is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-52/oas01-cranefield-1.pdf ' failed with https://ceur-ws.org/Vol-52/oas01-cranefield-1.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-52/oas01-cranefield-2.pdf ' failed with https://ceur-ws.org/Vol-52/oas01-cranefield-2.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-52/oas01-pouchard.pdf ' failed with https://ceur-ws.org/Vol-52/oas01-pouchard.pdf : is not a valid URI
constructor for Paper for pdfUrl 'https://ceur-ws.org/Vol-52/oas01-tout.pdf ' failed with https://ceur-ws.org/Vol-52/oas01-tout.pdf : is not a valid URI
Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
  • https://github.com/linkml/linkml-runtime/pull/257 has been merged and there are now quotes around the URL to improve the visibility of the problem if someone should run into a similar situation – Wolfgang Fahl Apr 10 '23 at 17:19