Standards

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • xml:base and URIs with hashes

    10 answers - 3341 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Just putting this on the record
    I've just discovered a technical detail wrt xml:base attribute in RDF/XML docs - if you put a hash at the end of the base URI it is ignored when constructing relative URIs.
    I.e. the following RDF/XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <rdf:RDF
    xml:base="http://example.com/foo#"
    xmlns:rdf="#"
    xmlns:rdfs="#">
    <rdf:Description rdf:about="">
    <rdfs:label>this</rdfs:label>
    </rdf:Description>
    </rdf:RDF>
    gives the following triple:
    <http://example.com/foordfs:label "this".
    It doesn't matter if you put more than one hash at the end of the base URI, they are all ignored. I.e. the following RDF/XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <rdf:RDF
    xml:base="http://example.com/foo"
    xmlns:rdf="#"
    xmlns:rdfs="#">
    <rdf:Description rdf:about="">
    <rdfs:label>this</rdfs:label>
    </rdf:Description>
    </rdf:RDF>
    gives the same triple as above:
    <http://example.com/foordfs:label "this".
    Note however that the absolute URI <http://example.com/spongis treated by RDF parsers as different from the absolute URI <http://example.com/spong#(which spec can verify that this?). I.e. the following RDF/XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <rdf:RDF
    xmlns:rdf="#"
    xmlns:rdfs="#">
    <rdf:Description rdf:about="http://example.com/spong#">
    <rdfs:label>spong#</rdfs:label>
    </rdf:Description>
    <rdf:Description rdf:about="http://example.com/spong">
    <rdfs:label>spong</rdfs:label>
    </rdf:Description>
    </rdf:RDF>
    gives the following triples:
    <http://example.com/spong#rdfs:label "spong#".
    <http://example.com/spongrdfs:label "spong".
    Interestingly, the URI <http://example.com/spong raises an error when using the W3C RDF validation service (running ARP) -
    Error: {W107} Bad URI <http://elsewhere.org/spong: Fragment contains invalid character:#
    However, Sesame 1.2.3 doesn't raise an error, and creates a new URI resource in the graph.
    I remember vaguely Jeremy Carroll saying that hashes are actually allowed in fragment ids is this right or wrong?
    Finally, this has implications for RDFS/WL vocabularies/ontologies that use a hash namespace, because it means we have to be careful not to confuse the 'vocabulary URI' (a.k.a. the 'ontology URI', i.e. the URI that identifies the vocabulary/ontology) and the 'namespace URI' (i.e. the actual URI you append the local name of each term to). E.g.
    http://example.com/vocab - vocabulary URI.
    http://example.com/vocab# - namespace URI.
    For RDFS/WL vocabularies/ontologies that use a slash namespace both the vocabulary URI and the namespace URI are the same, e.g.
    - vocabulary URI.
    - namespace URI.
    Cheers,
    Al.
    Alistair Miles
    Research Associate
    CCLRC - Rutherford Appleton Laboratory
    Building R1 Room 1.60
    Fermi Avenue
    Chilton
    Didcot
    X11 0QX
    United Kingdom
    Email: a.j.miles (AT) rl (DOT) ac.uk
    Tel: +44 (0)1235 445440
  • No.1 | | 257 bytes | |

    * Miles, AJ (Alistair) wrote:
    >I remember vaguely Jeremy Carroll saying that hashes are actually
    >allowed in fragment ids is this right or wrong?

    You have to %xx-escape them, http://example.org/## is not allowed.
  • No.2 | | 257 bytes | |

    * Miles, AJ (Alistair) wrote:
    >I remember vaguely Jeremy Carroll saying that hashes are actually
    >allowed in fragment ids is this right or wrong?

    You have to %xx-escape them, http://example.org/## is not allowed.
  • No.3 | | 571 bytes | |

    Bjoern Hoehrmann wrote:
    * Miles, AJ (Alistair) wrote:
    >I remember vaguely Jeremy Carroll saying that hashes are actually
    >allowed in fragment ids is this right or wrong?


    You have to %xx-escape them, http://example.org/## is not allowed.

    I may have said that; but if I did I was wrong.
    In a URI or IRI only a single # is allowed and it separates the main URI
    from the fragment.

    Personally, I prefer omitting any # and fragment, from an xml:base
    because it is simply confusing.

    Jeremy
  • No.4 | | 571 bytes | |

    Bjoern Hoehrmann wrote:
    * Miles, AJ (Alistair) wrote:
    >I remember vaguely Jeremy Carroll saying that hashes are actually
    >allowed in fragment ids is this right or wrong?


    You have to %xx-escape them, http://example.org/## is not allowed.

    I may have said that; but if I did I was wrong.
    In a URI or IRI only a single # is allowed and it separates the main URI
    from the fragment.

    Personally, I prefer omitting any # and fragment, from an xml:base
    because it is simply confusing.

    Jeremy
  • No.5 | | 113 bytes | |

    According to RFC 3986 [1], a base URI is not permitted to have a fragment. See
    sections 5.1 and 4.3.
    #g
  • No.6 | | 113 bytes | |

    According to RFC 3986 [1], a base URI is not permitted to have a fragment. See
    sections 5.1 and 4.3.
    #g
  • No.7 | | 402 bytes | |

    * Graham Klyne wrote:
    >According to RFC 3986 [1], a base URI is not permitted to have a fragment. See
    >sections 5.1 and 4.3.


    Though note that the value of the xml:base attribute is a string that
    can be converted to a URI reference using a specific algorithm, it's
    not a "Base URI" as defined in RFC 3986 though it can be transformed
    into that.
  • No.8 | | 402 bytes | |

    * Graham Klyne wrote:
    >According to RFC 3986 [1], a base URI is not permitted to have a fragment. See
    >sections 5.1 and 4.3.


    Though note that the value of the xml:base attribute is a string that
    can be converted to a URI reference using a specific algorithm, it's
    not a "Base URI" as defined in RFC 3986 though it can be transformed
    into that.
  • No.9 | | 797 bytes | |

    Bjoern Hoehrmann wrote:
    * Graham Klyne wrote:
    >According to RFC 3986 [1], a base URI is not permitted to have a fragment. See
    >sections 5.1 and 4.3.


    Though note that the value of the xml:base attribute is a string that
    can be converted to a URI reference using a specific algorithm, it's
    not a "Base URI" as defined in RFC 3986 though it can be transformed
    into that.

    Yes. xmlbase specifies:

    [[
    The value of this attribute is interpreted as a URI Reference as defined
    in RFC 2396 [IETF RFC 2396], after processing according to Section 3.1.
    ]]

    and then implicitly suggests dropping any fragment, since the latter
    parts of the document talks about URIs rather than URI Reference.

    Jeremy
  • No.10 | | 797 bytes | |

    Bjoern Hoehrmann wrote:
    * Graham Klyne wrote:
    >According to RFC 3986 [1], a base URI is not permitted to have a fragment. See
    >sections 5.1 and 4.3.


    Though note that the value of the xml:base attribute is a string that
    can be converted to a URI reference using a specific algorithm, it's
    not a "Base URI" as defined in RFC 3986 though it can be transformed
    into that.

    Yes. xmlbase specifies:

    [[
    The value of this attribute is interpreted as a URI Reference as defined
    in RFC 2396 [IETF RFC 2396], after processing according to Section 3.1.
    ]]

    and then implicitly suggests dropping any fragment, since the latter
    parts of the document talks about URIs rather than URI Reference.

    Jeremy

Re: xml:base and URIs with hashes


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 3 =
QUESTION ON "Standards"

EMSDN.COM