Re: Summary of the QName to URI Mapping Problem

Patrick.Stickler@nokia.com wrote:
> 
> > -----Original Message-----
> > From: ext Dan Connolly [mailto:connolly@w3.org]
> > Sent: 16 August, 2001 16:43
> > To: Stickler Patrick (NRC/Tampere)
> > Cc: drew.mcdermott@yale.edu; www-rdf-logic@w3.org;
> > www-rdf-interest@w3.org
> > Subject: Re: Summary of the QName to URI Mapping Problem
> >
> >
> > [This will be my last message in this thread unless/until
> > I see some new information. We're convering well-trodden
> > ground here. cf
> > http://www.w3.org/2000/03/rdf-tracking/#rdfms-uri-substructure ]
> 
> Well trodden but hidden ground? Sorry, I don't see how your reference
> does anything but reiterate that there is an issue here.

That's all the pointer was meant to do.

But I did get some new information out of your most recent
message: you're trying to match qnames in RDF without
expanding them to URIs; for example, using XSLT.

I have to admit I do that myself from time to time...

[...]

> > Subject to the limitation that some URIs aren't usable as
> > RDF 1.0 property names, there are simple, generic approaches.
> > The simplest one I can think of is:
> >
> >       1. scanning from the end
> >               if you find an XML name start character, go to step 2
> >               if you find something that's not an XML name character,
> >                       stop and throw an exception (you've run
> >                       into a limitation in RDF 1.0 syntax).
> >               keep scanning
> >       2. split the string into a namespace name and a localname.
> >
> > So
> >       mid:xyz@fooble
> > becomes
> >       <e xmlns="mid:xyz@foobl">...</e>
> >
> > and
> >       mid:xyz@fooble1
> > becomes
> >       <e1 xmlns="mid:xyz@foobl">...</e1>
> 
> Uhhh, but if the actual QNames needed, according to the actual
> ontology are (mid:xyz@foo)(ble) and (mid:xyz@foo)(ble1) and
> you have applications, style sheets, etc. etc. looking for the
> real QNames, just what do you expect them to do with the above
> guesses.

I don't expect "real ontologies" to deal with Qnames... just URIs.

But XSLT is kinda handy... the actual mapping convention I tend
to use in practice is:

I. If you're designing and RDF vocabulary and you
want to make it easy to use XSLT with it,
choose a namespace name that ends in a non-XML-name character
(e.g. # or / or ?)

II. to split a URI into a namespace-name/local-name pair,
use the last non-xml-name character as the split point.

So
       mid:xyz@fooble
 becomes
       <fooble xmlns="mid:xyz@">...</fooble>

 and
       mid:xyz@fooble1
 becomesow
       <fooble1 xmlns="mid:xyz@">...</fooble>



In fact... this is what TimBL implemented in the semantic web toolkit
we're hacking on:

    def figurePrefix(self, uriref, rawAttrs, prefixes):
	i = len(uriref)
	while i>0:
	    if uriref[i-1] in self._namechars:
		i = i - 1
	    else:
		break
	ln = uriref[i:]
	ns = uriref[:i]

        [...]

    -- excerpted from http://www.w3.org/2000/10/swap/notation3.py

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/

Received on Thursday, 16 August 2001 17:41:06 UTC