Hi Ivan, I think I explained badly in the first place.. when one uploads XML contained in a CDATA section (via PUT to a rdf_sink folder), the XML contained is converted to (and stored as) a string literal, rather than an XMLLiteral.
Need to do a bit of explaining here, as I've noted a few issues. one can save snippets of XML in rdf triples in the following ways: Option 1: RDF+XML w/ CDATA <content:encoded><![CDATA[<p>some <strong>html</strong> in here.</p>]]></content:encoded> Option 2: rdf:XMLLiteral in turtle/n3 <http://something.com/anyoluri> <content:encoded> """<p xmlns="http://www.w3.org/1999/xhtml">some <strong xmlns="http://www.w3.org/1999/xhtml">html</strong> in here.</p>"""^^rdf:XMLLiteral . Option 3: XML+RDF w/ namespace and embedded XML <?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:sioc="http://rdfs.org/sioc/ns#"> <sioc:Post rdf:about="http://something.com/anyoluri"> <content:encoded rdf:parseType="Literal"> <p>some <strong>html</strong> here.</p> </content:encoded> </sioc:Post> </rdf:RDF> Details on Option 1: When storing xml using (1) the xml get's converted to a double-encoded string literal. Details on Option 2: haven't tested, sure it'll be the same as (3) though. Details on Option 3: The XML snippets gets stored correctly as an XMLLiteral (great), however: -a: can't get any of the bif:(x|xpath_|xquery_)contains methods to work correctly -b: differing errors occur when output in sparql results (as follows): SELECT w/ content type "application/rdf+xml": error: <res:valuerdf:parseType="Literal"> note: the lack of a space between res:value and rdf:parseType SELECT w/ content type "text/rdf+n3": error: res:binding [ res:variable "o" ; res:value "some html here." ] note: converted to only text, all xml stripped SELECT w/ content type "text/plain" (turtle) error: "some html here."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> note: XMLLiteral is correct, but xml is stripped again SELECT w/ application/sparql-results+xml, application/sparql-results+json, application/javascript, text/html note: all fine! CONSTRUCT w/ application/rdf+json error: "value" : "some html here." , "datatype" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral" note: all xml stripped but XMLLiteral correct CONSTRUCT w/ text/rdf+n3 error: content:encoded some html here. . note: everything stripped, no type quotes anything CONSTRUCT w/ application/rdf+xml note: perfect! DESCRIBE w/ text/rdf+n3 error: content:encoded "some html here." . note: quoted, but no type & xml stripped DESCRIBE w/ application/rdf+json error: "value" : "some html here." , "datatype" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral" note: all xml stripped but XMLLiteral correct DESCRIBE w/ application/rdf+xml note: perfect! As always I'm using the 6.0.1 snapshot; to replicate any of this and test for yourself the RDF in option 3 is probably ideal to replicate. And to replicate the initial content:encoded CDATA issue simply drop in RDF/RSS 1.0 with html in a content:encoded cdata section. Many Regards, Nathan Ivan Mikhailov wrote: > Hello Nathan, > > We have a support for CDATA output but first of all, the XML serializer > should know that an element should be encoded with CDATA. For an XSLT > output, this can be controlled by options of the stylesheet. How was the > XML in question generated? What's missing in that path? > > Best Regards, > > Ivan Mikhailov > OpenLink Software > http://virtuoso.openlinksw.com > > On Mon, 2009-11-30 at 17:25 +0000, Nathan wrote: >> Hi All, >> >> Slight question about content:encoded (I know it's a bit of a special case). >> >> assumption(s): >> 1 - the following is valid content:encoded >> <![CDATA[<p>some <strong>html</strong> in here.</p>]]> >> >> 2 - the following is invalid content:encoded >> <p>some <strong>html</strong>.</p> >> >> question / problem >> virtuoso consumes [1] perfectly, yet returns http://bit.ly/5zp6aQ >> (without cdata); so following the above assumptions isn't it invalid >> considering the element has a type of content:encoded(?) >> >> Apologies in advance, it's nothing urgent and I can easily work around >> it on the client-side. >> >> Many Regards, >> >> Nathan >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >> trial. Simplify your report design, integration and deployment - and focus >> on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Virtuoso-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/virtuoso-users > > >
