combining names and namespaces into a one URI

Discussion in 'XML' started by nallen05@gmail.com, Feb 25, 2007.

  1. Guest

    Is there a standardized recommendation for combining names and
    namespaces into a single URI?

    I found a post on the Stylus Studio forum asking the same question,
    the response was "use James Clark's {http://www.namespace.com}name
    notation". The post is 7 years old and I'm wondering if anything has
    changed...

    thanks

    Nick
    , Feb 25, 2007
    #1
    1. Advertising

  2. wrote:
    > Is there a standardized recommendation for combining names and
    > namespaces into a single URI?
    >
    > I found a post on the Stylus Studio forum asking the same question,
    > the response was "use James Clark's {http://www.namespace.com}name
    > notation". The post is 7 years old and I'm wondering if anything has
    > changed...


    That combined form isn't a URI.

    It's still one common solution to displaying the NSURI/localname pair,
    but there is absolutely no "standard" behind it; it's just that most
    folks are aware of it and find it adequate for their needs.

    But the more common solution is to just declare (or explain) your use of
    prefixes and use standard Qualified Names. The combined form is
    generally not particularly necessary or useful except, perhaps, as a
    debugging tool; if you're looking for an internal representation(s) of
    this value pair, something which lets you more efficiently
    access/compare/store the information is generally preferable -- struct
    references, table indices, that sort of thing.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Feb 25, 2007
    #2
    1. Advertising

  3. Guest

    Hey Joe

    On Feb 24, 9:24 pm, Joe Kesselman <> wrote:
    > wrote:
    > > Is there a standardized recommendation for combining names and
    > > namespaces into a single URI?

    >
    > > I found a post on the Stylus Studio forum asking the same question,
    > > the response was "use James Clark's {http://www.namespace.com}name
    > > notation". The post is 7 years old and I'm wondering if anything has
    > > changed...

    >
    > That combined form isn't a URI.


    Right


    >
    > It's still one common solution to displaying the NSURI/localname pair,
    > but there is absolutely no "standard" behind it; it's just that most
    > folks are aware of it and find it adequate for their needs.
    >
    > But the more common solution is to just declare (or explain) your use of
    > prefixes and use standard Qualified Names. The combined form is
    > generally not particularly necessary or useful except, perhaps, as a
    > debugging tool; if you're looking for an internal representation(s) of
    > this value pair, something which lets you more efficiently
    > access/compare/store the information is generally preferable -- struct
    > references, table indices, that sort of thing.
    >


    I want to take some data in and out of an rdf-oriented triple store in
    standard XML syntax, not RDF/XML... I'd like to do it in as "least
    bad" a manner as possible... ;-)

    Looking at other people's RDF/XML (like this from Wikipedia)

    <rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <rdf:Description rdf:about="http://en.wikipedia.org/wiki/
    Tony_Benn">
    <dc:title>Tony Benn</dc:title>
    <dc:publisher>Wikipedia</dc:publisher>
    </rdf:Description>
    </rdf:RDF>

    when it is transformed to N-Triples RDF

    <http://en.wikipedia.org/wiki/Tony_Benn> <http://purl.org/dc/elements/
    1.1/title> "Tony Benn" .
    <http://en.wikipedia.org/wiki/Tony_Benn> <http://purl.org/dc/elements/
    1.1/publisher> "Wikipedia" .

    "{http://purl.org/dc/elements/1.1/}title" changes to "http://purl.ord/
    dc/elements/1.1/title". But even the other ns url "http://www.w3.org/
    1999/02/22-rdf-syntax-ns#" ends in a hash and not a /...

    thanks for your time

    Nick



    > --
    > () ASCII Ribbon Campaign | Joe Kesselman
    > /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    , Feb 25, 2007
    #3
  4. wrote:
    > I want to take some data in and out of an rdf-oriented triple store in
    > standard XML syntax, not RDF/XML... I'd like to do it in as "least
    > bad" a manner as possible... ;-)


    In that case, it's sorta "whatever works", right? You aren't (very)
    concerned about human-readability, you just want something that lets you
    efficiently recover both values from the single string.

    The {nsuri}local solution counts on the fact that the {} characters
    aren't permitted in localnames and are uncommon in URIs. To unbundle,
    you skip the leading {, and search backward for the last } as a division
    point between the two fields. Not hugely pretty, but it works and is
    reasonably fast. But the leading { isn't really necessary if you know a
    priori that the value will be in this form.

    The other example you've shown us just concatenates the NSURI and
    localname. As you noted, that has a nontrivial problem: most namespace
    URIs don't end with a / so the combined form is likely to be hard to
    divide up again. The best I can call this is "sloppy". I would recommend
    always inserting a delimiter character so you are *certain* you know how
    to break it apart again. If you want something that looks URI-like you
    could use / as your delimiter (or :, for that matter), but that's really
    a matter of taste since nobody outside your own applications should ever
    be trying to parse these.


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Feb 25, 2007
    #4
  5. Joe Kesselman wrote:
    > always inserting a delimiter character so you are *certain* you know how
    > to break it apart again. If you want something that looks URI-like you
    > could use / as your delimiter (or :, for that matter)


    Or #. The important thing is that it's something that absolutely can't
    appear in the localname and that it be inserted every time, so you can
    always be sure the last instance of it is the delimiter between
    namespace name and localname.

    Which brings me back to "What's easiest for your own code to handle?"


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Feb 25, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harris
    Replies:
    0
    Views:
    6,342
    Simon Harris
    May 10, 2005
  2. Stanimir Stamenkov
    Replies:
    1
    Views:
    2,444
    Stanimir Stamenkov
    Aug 17, 2005
  3. Pavel
    Replies:
    2
    Views:
    1,624
    Peter Flynn
    Aug 4, 2004
  4. Andy B
    Replies:
    1
    Views:
    291
    Evan Camilleri
    Jul 29, 2008
  5. Turbo
    Replies:
    2
    Views:
    145
    Turbo
    Nov 1, 2006
Loading...

Share This Page