Re: Turtle null prefix and namespaces

On 18/01/10 12:02, Richard Light wrote:
>
> 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>

That doesn't work, as you suspect, but for a different reason.

URI references, such as a1 and a3 above, are resolved relative to the 
base of the document. Namespaces are not relevant to them.

I think your best bet is to output the full URI in those cases. For 
properties (a2) using the default namespace is mostly fine. (There are 
some nasty corner cases, but you rarely see them in practice)

Damian

Received on Monday, 18 January 2010 12:22:50 UTC