W3C home > Mailing lists > Public > www-rdf-interest@w3.org > October 2003

Re: RDF Parsing resolving empty URI

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Mon, 13 Oct 2003 18:38:54 +0100
To: Raphael Volz <volz@aifb.uni-karlsruhe.de>
Cc: www-rdf-interest <www-rdf-interest@w3.org>
Message-Id: <20031013183854.211fe93f.dave.beckett@bristol.ac.uk>

On Mon, 13 Oct 2003 18:24:39 +0200
Raphael Volz <volz@aifb.uni-karlsruhe.de> wrote:

> a user (Sean Bechhofer) discovered a possible bug within our parser.
> However we are not sure, whether it is a bug. What is the correct
> behaviour when having an empty rdf:ID ? Take for example:
> 
> <owl:Ontology rdf:ID="" />
> 
> We found the RDF specification to be quite ambiguous with respect to
> this issue. Namely, they say I should
> resolve any URI against the XML base. Well, this is exactly what we
> do. We are
> using Java's methods for this. However, Java resolves against the file
> name if no
> XML base is specfied but chops off things from the URI:

The above is not a URI.  I'd hope the RDF[/XML] specification was
quite clear on the constraints for the rdf:ID attribute (you don't
actually say which document you are reading):

[[
7.2.34 Production rdf-id

An attribute *string-value* matching any legal [XML-NS] token NCName
]] -- http://www.w3.org/TR/rdf-syntax-grammar/#rdf-id

which links to
http://www.w3.org/TR/REC-xml-names/#NT-NCName

and clearly shows that you must have at least one character, starting
with Letter | _.

Was there something that I'm missing here?

> For example, the URI http://xyz.com/ontologies/animals is interpreted
> as a file URI (as doesn't end with a slash).

That's also illegal as an XML Name - you can't have :, or / in them. 
See the XML spec again, nearby above.

> Then Java thinks it should chop off  the last file name and replace it
> with your relative URI, which is empty. Hence,
> http://xyz.com/ontologies/ is the correct resolution of an empty  URI
> against
> the URI http://xyz.com/ontologies/animals.
> 
> 
> The only thing how one could really get
> http://xyz.com/ontologies/animals
> back is if we would test for the empty ID. We can do that, but we
> really don't know what is correct. We tried to look this up in the
> spec, but we
> didn't find anything that would answer our question. Hence we left it
> as it is.
> 
> If you have any evidence we should really test the empty case, please
> let us know and we do this immediately - this is a one-liner.

If you were, however, using rdf:about="" then that would be
a same-document reference URI and would resolve to the absolute
URI of the current in-scope base URI (such as from xml:base), or the
document URI if none were given (all RDF/XML documents must have a base
URI).

See section "5.3 Resolving URIs"
http://www.w3.org/TR/rdf-syntax-grammar/#section-baseURIs
which links to some of the many test cases we have about resolving URIs
(some duplication with the URI spec, present there to help people out)

Dave
Received on Monday, 13 October 2003 13:40:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:52:02 GMT