W3C home > Mailing lists > Public > www-rdf-interest@w3.org > January 2001

Re: Formation of RDF terms

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Mon, 29 Jan 2001 10:42:32 +0000
To: Jonathan Borden <jborden@mediaone.net>
cc: RDF Interest <www-rdf-interest@w3.org>
Message-ID: <29981.980764952@tatooine.ilrt.bris.ac.uk>

>>>Jonathan Borden said:
> As I said. A typedNode qname is not always correctly converted into a URI
> according to RDF M&S 1.0. Is there a problem with my example? Even if
> roundtripping XML -> RDF -> XML is a non-goal (which *is* suprising for
> something which is supposed to serialize RDF models), the current RDF rule
> for qname -> URI doesn't work.


> 	According to RFC 2396 a URI reference is defined as (EBNF):
> 	[absoluteURI | relativeURI] ['#' fragmentId]
> 	According to the definition of a URI reference, you *can*
> deconstruct a URI 
> into a namespace and localName (where the localName is the fragmentId )

The URI spec does not know of the concept of namespaces.  There is no
algorithm in the URI spec to extract such things from URIs.  You
can, as you say, get an absoluteURI from a URI but you can't be sure
that it corresponds to what the XML Namespaces document defines as a

Re: relativeURI and absoluteURI - the RDF model does not use
relativeURIs, only absolute ones (+ fragment ids).  All RDF systems
I've made or seen, and that is a lot of them, only use absolute URIs
in the model.

Dave said:
> > In the RDF formal model (section 5) this is even more important since
> > there are no XML syntax concepts at all.  URIs are 'black boxes' that
> > are never broken open.
Jonathan said: 
> Not according to RFC 2396, which contains a whole bunch of normative EBNF
> productions that allow parsing an URI. A URI is simply not a random string,
> or unique identifier, at least according to its normative definition.

Going to RFC2396 - http://www.ietf.org/rfc/rfc2396.txt - appendix A,
first two rules:

  A. Collected BNF for URI

	URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
	absoluteURI   = scheme ":" ( hier_part | opaque_part )

and that is enough of the URI spec for RDF to deal with in the model.
Some URIs will be using opaque_part (urn:, data:, other URNs uuids,
...) and others will have the hier_part (http, ftp and friends).  RDF
mostly doesn't care about either of those distinctions - it just
neads to construct URI-reference (absoluteURI) using the
concatenation of XML Namespace namespace + XML qname.  See <a
href="#below">below</a> for the methods you do need for URIs in RDF

When reading RDF's XML syntax, you will need to construct
absoluteURIs from relative ones if they are present, so the URI
object needs to have a constructor that can do the relative URI
resolving.  Jason Diamond implemented this in his:
  Repat RDF Parser Toolkit
to complete all the URI work he needed for an RDF/XML parser.

Jonathan said:
> > > >
> > > <xsd:unsignedInt rdf:about="http://www.foo.org/someNumber/123">
> > > 	...
> > > </xsd:unsignedInt>
> > >
[snip for clarity - moved below]
> > > Ought RDF applications use XML Schema datatypes?
> >
> > > What triples ought be generated? Certainly not:
> > > http://www.w3.org/2000/10/XMLSchemaunsignedInt
> > >
> > > N3 already appends a '#' to such namespaces in a bind.

The xsd:unsignedInt concept indeed has the URI above.  There is
nothing wrong with that.  In the syntax it looks clear as
xsd:unsignedInt and in the RDF model it is a unique (absolute!) URI
that can be used as a web-wide identifier.  This may be wierd but it
is OK.

Jonathan said:
> There are applications which cannot always choose the namespace encountered.
> Such applications, if they are to use RDF, need to be able to deal with
> arbitrary namespaces.
> For example RDDL which uses XLink syntax. It could have used RDF syntax
> except for this single killer issue. Certainly if even the W3C XML Schema WG
> does not care to use RDF friendly namespaces why ought other applications?
> Doesn't this say something? Purity is fine except when it goes against
> practicality.

As I said, the resulting absolute URIs can look odd but still work
fine.  You said above:
>  A typedNode qname is not always correctly converted into a URI
>  according to RDF M&S 1.0.

Can you tell me what isn't correct about the resulting URI:

Dave said:
> >
> > Lets leave N3 out of this and deal with the XML syntax in the
> > standard rather than experiments for more friendly syntax.
> >
Jonathan said:
> If the RDF syntax were adequate, there would be no need for so many
> 'experiments' at producing something better. Again my problem is not with
> RDF Model which I think is terrific, rather Syntax. Do you really think that
> the current RDF syntax is adequate? --  or might not be revisited circa 2001
> now that we have XPointer, XML Base, XML Schema etc. I don't even think that
> the syntax needs to be totally trashed, rather tweaked here and there. It's
> good to tweak things every couple of years.

Yes - RDF is the model not the funky XML syntax, but somehow people
forget this.  I've done years of work with RDF and not bothered doing
anything about the syntax till recently, just using other people's parsers.

I've already posted various thoughts on the syntax before including
  RDF and RDF Schema Concepts
since it was difficult to interpret what the syntax concepts meant and
  A Proposed Interpretation of RDF Containers
with Brian McBride to propose how to interpret containers.

I think we might need a note of RDF best practice or errata that

  In RDF, it is recommended that the XML namespace URIs with # or /.
  If there is no # or / on the URI, assume that # is present.

The relationship between XPointer, XML Base, Xlink, XML Schemas and
RDF does certainly bear looking at since the RDF syntax we have is
based on XML and all those technologies are now part of the core XML.
We may be able to just 'stand on their shoulders' and deal with the
semantics in the RDF model.  That is a goal I would like.

You mentioned roundtripping XML -> RDF -> XML above; that would need
some or all of the following:
  * XML Namespaces URIs and prefixes to be stored in the Model
  * Literal properties preserved: XML lang, XML space, isWellFormed
  * XPath of every syntax element recorded
  * lists of outer top-level elements recorded
  * order of every element recorded
  * ... lots more ...
[ignoring aboutEach, aboutEachPrefix]

but doing all of that is pretty daft.  The only sensible ones IMHO
are the first two.   In Redland I haven't done the first year (TODO)
and the second is done - the XML literal properties are part of the literal.

(<a name="#below"></a>) To do this RDF to XML serialisation, the RDF
model would need 1 method on URIs that passed in a URI of the
namespace and returned the qname.  This is just a substring
operation e.g. thinking in perl:

  sub qname ($$) {
    my $self=shift;
    my $namespace_uri=shift;

    # Return string part of URI that is after URI prefix
    return substr($self->{URI}, length($namespace_uri->{URI}));

  # if I made/had a URI object $uri for xsd:unsignedInt with URI
  #   http://www.w3.org/2000/10/XMLSchemaunsignedInt
  # and a URI object $xsd for the xsd namespace with URI
  #   http://www.w3.org/2000/10/XMLSchema
  # then


  # would return 'unsignedInt'

This is based on my implementation experience - creating Redland, the
RDF Parser I wrote Rapier, the support I needed for the other 4
parsers, and the Redland RSS / RDF demos I've created.  All linked
from http://www.redland.opensource.ac.uk/

Let's have fun with some of this at the RDF Interest Group meeting in
Boston next month.  :-)

Received on Monday, 29 January 2001 05:43:01 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:07:34 UTC