Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1463

RDF/XML parsing of file://hostname/ base URI miswrites URI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Jena 3.0.1, Jena 3.1.0, Jena 3.1.1, Jena 3.2.0, Jena 3.3.0, Jena 3.4.0, Jena 3.5.0, Jena 3.6.0
    • Jena 3.7.0
    • ARQ, RDF/XML
    • None

    Description

      Similar to JENA-1462, but there seems to be special handling of file: URLs in RDF/XML parsing, where parsing an RDF/XML file like:

      <rdf:RDF
          xml:base="file://example.com/nested/"
          xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
          xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
        <rdf:Description rdf:about="foo.txt">
          <rdfs:seeAlso rdf:resource="/bar.txt"/>
        </rdf:Description>
      </rdf:RDF>
      

      using

      RDFDataMgr.read(m, load("file-base.rdf"), Lang.RDFXML);
      

      (Note, load() returns a InputStream, no explicit base)

      it comes out wrongly as:

      <file:///example.com/nested/foo.txt> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <file:///example.com/bar.txt> .
      

      Notice the hostname somehow became part of the path, now with a file:/// with no hostname.

      *Note: *https://tools.ietf.org/html/rfc8089#section-2 says that file URIs can have a hostname, as well as the obvious hostname "localhost", this is typically used to address Windows shares no remote hosts.

      Equivalent in Turtle parses fine:

      @base <file://example.com/nested/> .
      @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
      
      <foo.txt> rdfs:seeAlso </bar.txt> .
      

      becomes:

      <file://example.com/nested/foo.txt> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <file://example.com/bar.txt> .
      

      Equivalent RDF/XML without xml:base and passing file://example.com/nested/ as Base also fails:

      RDFDataMgr.read(m, load("rel.rdf"), "file://example.com/nested/", Lang.RDFXML);
      

      Attachments

        Issue Links

          Activity

            People

              andy Andy Seaborne
              stain Stian Soiland-Reyes
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: