On 06/01/2025 10:59, zPlus wrote:
Apache Jena RIOT version 5.2.0
Debian GNU/Linux 12 (bookworm)

I'm trying to import some nodes with IDs like <file:/path/to/file> into a TDB2
database. However, the IDs are automatically changed to <file:///path/to/file>
once they're added to the database. As far as I understand, the "file:" URI
scheme allows for a missing "host" component, therefore I'm not sure if this is
a bug or not.

The "file:" URI schema has not had the attention it should have had, it was old and unclear, until RFC 8089 cleaned this up but also has legacy compatibility.

Both file:/ and and file:/// are URIs with a missing host name.

See
https://datatracker.ietf.org/doc/html/rfc8089.html#section-2

and examples in
https://datatracker.ietf.org/doc/html/rfc8089.html#appendix-B

But we need one form for URI matching otherwise "file:/path" does not match "file:///path"

Jena prefers the "file:///" form.
(c.f. "http:/" which is resolved.)

Normally, the parser emits a warning

  Bad IRI: <file:/pdf/....> Code: 57/REQUIRED_COMPONENT_MISSING in
    AUTHORITY: A component that is required by the scheme is missing.

or soon to be:

  Unwise IRI: <file:/....> file: URLs are of the form file:///path/...


but, for some reason, the JSON-LD path does not print warnings.

Recorded as:
https://github.com/apache/jena/issues/2922

    Andy

{
     "@context": {
         "library": "dokk:vocab:library:",
         "license": "dokk:vocab:license:",
         "library:journal": { "@type": "@id" },
         "license:licensed_under": { "@type": "@id" ,
         "blob": "dokk:vocab:blob:"
     },
     "@type": [
         "library:Item",
         "library:JournalArticle"
     ],
     "@id": "dokk:theoryofcomputing_v020a001",
     "library:author": [
         "Ivan Hu",
         "Dieter van Melkebeek",
         "Andrew Morgan"
     ],
     "library:journal": "dokk:theoryofcomputing",
     "license:licensed_under": "dokk:license:CC-BY-3.0",
     "library:title": "Polynomial Identity Testing via Evaluation of Rational
Functions",
     "blob:at": {
         "@id": "file:/pdf/theoryofcomputing.org/v020a001.pdf",
         "blob:primary_source":
"https://theoryofcomputing.org/articles/v020a001/v020a001.pdf";,
         "blob:retrieval_date": "2025-01-01"
     }
}


Reply via email to