Thanks Ivan :)
Any chance of an updated 6 as currently I'm getting the following:
http://bit.ly/dueNeF
my current build is Version 6.0.1-pre1.3124-pthreads
regards & cheers,
Nathan
Ivan Mikhailov wrote:
> Hello Nathan,
>
> That's the current status of version 5 tree:
>
> 1. Loading of XML literals in RDF/XML and TTL is correct:
>
> -----8<-----
>
> DB.DBA.RDF_LOAD_RDFXML ('
> <?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>',
> 'http://g3/', 'http://g3/')
>
> Done. -- 1 msec.
>
> -- Line 15:
> DB.DBA.TTLP ('
> <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 .',
> 'http://g4/', 'http://g4/')
>
> Done. -- 0 msec.
>
> -- Line 22:
> sparql select (bif:xpath_eval ('//strong', ?o, 1)) from
> <http://g3/> where { ?s
> <http://purl.org/rss/1.0/modules/content/encoded> ?o }
> callret-0
> VARCHAR
> _______________________________________________________________________________
>
> <n0:strong xmlns:n0="http://www.w3.org/1999/xhtml">html</n0:strong>
>
> 1 Rows. -- 2 msec.
>
> -- Line 26:
> sparql select (bif:xpath_eval ('//strong', ?o, 1)) from
> <http://g4/> where { ?s
> <content:encoded> ?o }
> callret-0
> VARCHAR
> _______________________________________________________________________________
>
> <n0:strong xmlns:n0="http://www.w3.org/1999/xhtml">html</n0:strong>
>
> 1 Rows. -- 0 msec.
>
> -----8<-----
>
>>> Option 1: RDF+XML w/ CDATA
>>> <content:encoded><![CDATA[<p>some <strong>html</strong> in
>>> here.</p>]]></content:encoded>
>
> If one wish to save an XML literal, not a string that resembles XML in
> syntax, then the rdf:parseType="Literal" is required. No other way, and
> CDATA is for XML parser of the text, not for an RDF loader of the XML
> document.
>
>>> 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 .
>
> This works but probably not as expected: it should be either
> content:encoded without <> and with proper namespace declaration or
> <http://purl.org/rss/1.0/modules/content/encoded> . Otherwise it's
> correctly loaded, as demonstrated by the query in the cited log.
>
>>> 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>
>
>>> -a: can't get any of the bif:(x|xpath_|xquery_)contains methods to work
>>> correctly
>
> Works for me with current version 5 tree, see the log above.
>
>>> -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
>
> Now it's as follows:
>
> for CONSTRUCT:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
> <rdf:Description
> rdf:about="http://something.com/anyoluri"><n0pred:encoded
> xmlns:n0pred="content:"
> rdf:datatype="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"
> rdf:parseType="Literal"><n0:p
> xmlns:n0="http://www.w3.org/1999/xhtml">some
> <n0:strong>html</n0:strong> in
> here.</n0:p></n0pred:encoded></rdf:Description>
> </rdf:RDF>
>
> for SELECT:
>
> <rdf:RDF xmlns:res="http://www.w3.org/2005/sparql-results#"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description rdf:nodeID="rset">
> <rdf:type
> rdf:resource="http://www.w3.org/2005/sparql-results#ResultSet" />
> <res:resultVariable>s</res:resultVariable>
> <res:resultVariable>p</res:resultVariable>
> <res:resultVariable>o</res:resultVariable>
> ...
> ...
> <res:solution rdf:nodeID="r1">
> <res:binding
> rdf:nodeID="r1c0"><res:variable>s</res:variable><res:value
> rdf:resource="http://something.com/anyoluri"/></res:binding>
> <res:binding
> rdf:nodeID="r1c1"><res:variable>p</res:variable><res:value
> rdf:resource="http://purl.org/rss/1.0/modules/content/encoded"/></res:binding>
> <res:binding
> rdf:nodeID="r1c2"><res:variable>o</res:variable><res:value
> rdf:parseType="Literal"><n0:p
> xmlns:n0="http://www.w3.org/1999/xhtml">some <n0:strong>html</n0:strong>
> here.</n0:p></res:value></res:binding>
> </res:solution>
> </rdf:Description>
> </rdf:RDF>
>
>>>
>>> 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
>
> CONSTRUCT gives
>
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix ns1: <content:> .
> @prefix ns2: <http://something.com/> .
> ns2:anyoluri ns1:encoded "<n0:p xmlns:n0=\"http://www.w3.org/1999/xhtml
> \">some\n <n0:strong>html</n0:strong> in\n
> here.</n0:p>"^^rdf:XMLLiteral .
>
> SELECT is not worse but the string is so long that the mail client
> corrupts it :)
>
> In current state of version 6 results are the same, except one loading
> bug that is being fixed right now.
>
> Best Regards,
>
> Ivan Mikhailov
> OpenLink Software
> http://virtuoso.openlinksw.com
>
>
>
>