On 09/03/12 09:35, David Byrden wrote:

Sorry if this is a simple question, but I have looked for
examples without success...

I want Jena to read N3 with literal XML values,
possibly including namespaces. Then write them out
as RDF, preserving the XML and its namespaces.

An example of my input:

<THING> dc:description
"Text and a <link to='place'>complex element</link>."^^rdf:XMLLiteral .

But the RDF output is escaped XML; the angle brackets
are replaced by escape sequences. I want to process the output
with XSLT, so I would prefer the XML to remain as such.

Is this even supposed to be possible?

Yes and works for me:

temp.ttl =

[[[
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://www.openjena.org/eg#> .
:a :p 'Text and a <link to="place">complex element</link>.'^^rdf:XMLLiteral .
]]]


rdfcat temp.ttl produces

[[[
<rdf:RDF
    xmlns="http://www.openjena.org/eg#";
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
  <rdf:Description rdf:about="http://www.openjena.org/eg#a";>
<p rdf:parseType="Literal">Text and a <link to="place">complex element</link>.</p>
  </rdf:Description>
</rdf:RDF>
]]]


If you are seeing quoting then you probably have an error in the datatype URI, either in the rdf: declaration or in the spelling of XMLLiteral itself.

Dave

Reply via email to