Turtle null prefix and namespaces

Hi,

In writing a Turtle parser which serializes to RDF/XML, I'm hitting 
issues where RDF/XML can't represent some Turtle constructs.  No 
surprises there, but I would welcome guidance on one specific issue.

The null prefix construct (qname where the prefixname is empty), e.g.:

@prefix : <http://example.org/>  .
...
:a1 :b1 :c1 .

has the air of a default namespace about it.  The temptation is to put:

<rdf:RDF xmlns="http://example.org/" ...

at the head of the output, output the triple as:

<rdf:Description rdf:about="a1"><a2 
rdf:resource="a3"/></rdf:Description>

and consider the job done.  Am I right in concluding that this is a 
snare and a delusion, and that the null prefix should simply be expanded 
each time it is encountered, and NOT treated as a namespace of any sort?

My reason for drawing this conclusion is that declaring

<rdf:RDF xmlns="http://example.org/" ...

would cause this namespace to be incorrectly applied to all relative 
URIs in the document, not just those which have been declared as having 
a null prefix.

If true, this means that the null prefix cannot be treated in the same 
way as non-null prefixes, which you can declare as namespaces in the 
RDF/XML representation.  (This is rather significant, since predicates 
are represented as element names in RDF/XML, and so cannot be full 
URIs.)

Richard
-- 
Richard Light

Received on Monday, 18 January 2010 12:06:52 UTC