Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > combining names and namespaces into a one URI

Reply
Thread Tools

combining names and namespaces into a one URI

 
 
nallen05@gmail.com
Guest
Posts: n/a
 
      02-25-2007
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

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      02-25-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
 
nallen05@gmail.com
Guest
Posts: n/a
 
      02-25-2007

Hey Joe

On Feb 24, 9:24 pm, Joe Kesselman <(E-Mail Removed)> wrote:
> (E-Mail Removed) 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/">
<rdfescription rdf:about="http://en.wikipedia.org/wiki/
Tony_Benn">
<dc:title>Tony Benn</dc:title>
<dcublisher>Wikipedia</dcublisher>
</rdfescription>
</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



 
Reply With Quote
 
Joe Kesselman
Guest
Posts: n/a
 
      02-25-2007
(E-Mail Removed) 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
 
Reply With Quote
 
Joe Kesselman
Guest
Posts: n/a
 
      02-25-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
combining 2 web applications into a single one but making it look like 2 domain names? Andy B ASP .Net 1 07-29-2008 01:40 PM
How to get absolute uri by combining the baseuri and the relative uri in an html page? Turbo Javascript 2 11-01-2006 01:08 AM
java.net.URI.relativize(java.net.URI) not really working Stanimir Stamenkov Java 1 08-17-2005 06:24 PM
Help with error: "Invalid URI: The format of the URI could not be determined." Simon Harris ASP .Net 0 05-10-2005 04:33 PM
XSLT: Relative URI "my.dtd" can not be resolved without a base URI Pavel XML 2 08-03-2004 11:40 PM



Advertisments