You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Stian Soiland-Reyes (JIRA)" <ji...@apache.org> on 2018/01/11 18:33:00 UTC

[jira] [Created] (JENA-1463) RDF/XML parsing of file://hostname/ base URI miswrites URI

Stian Soiland-Reyes created JENA-1463:
-----------------------------------------

             Summary: RDF/XML parsing of file://hostname/ base URI miswrites URI
                 Key: JENA-1463
                 URL: https://issues.apache.org/jira/browse/JENA-1463
             Project: Apache Jena
          Issue Type: Bug
          Components: ARQ, RDF/XML
    Affects Versions: Jena 3.6.0, Jena 3.5.0, Jena 3.4.0, Jena 3.3.0, Jena 3.2.0, Jena 3.1.1, Jena 3.1.0, Jena 3.0.1
            Reporter: Stian Soiland-Reyes


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:

{code:xml}
<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>
{code}

using 

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

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

it comes out wrongly as:

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

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:

{code}
@base <file://example.com/nested/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<foo.txt> rdfs:seeAlso </bar.txt> .
{code}

becomes:

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

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

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



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)