sem:rdf-parse( $in as item(), [$options as xs:string*] ) as sem:triple*
This function returns parsed sem:triple
objects
from a text format or XML.
xquery version "1.0-ml"; import module namespace sem = "http://marklogic.com/semantics" at "/MarkLogic/semantics.xqy"; declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; declare namespace dc = "http://purl.org/dc/elements/1.1/"; declare namespace v="http://www.w3.org/2006/vcard/"; sem:rdf-parse( <rdf:Description rdf:about="urn:isbn:006251587X"> <dc:title>Weaving the Web</dc:title> <dc:creator rdf:resource="http://www.w3.org/People/Berners-Lee/card#i"/> </rdf:Description>, "rdfxml") => sem:triple( sem:iri("urn:isbn:006251587X"), sem:iri("http://purl.org/dc/elements/1.1/title"), "Weaving the Web") sem:triple( sem:iri("urn:isbn:006251587X"), sem:iri("http://purl.org/dc/elements/1.1/creator"), sem:iri("http://www.w3.org/People/Berners-Lee/card#i"))
xquery version "1.0-ml"; import module namespace sem = "http://marklogic.com/semantics" at "/MarkLogic/semantics.xqy"; let $turtle-document := ' @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix ex: <http://example.org/people/1.0/> . <http://www.w3.org/TR/rdf-syntax-grammar> dc:title "RDF/XML Syntax Specification (Revised)" ; ex:editor [ ex:fullname "Dave Beckett"; ex:homePage <http://purl.org/net/dajobe/> ] .' return sem:rdf-parse($turtle-document, ("turtle", "repair") ) => sem:triple( sem:iri("http://www.w3.org/TR/rdf-syntax-grammar"), sem:iri("http://purl.org/dc/elements/1.1/title"), "RDF/XML Syntax Specification (Revised)") sem:triple( sem:iri("http://www.w3.org/TR/rdf-syntax-grammar"), sem:iri("http://example.org/people/1.0/editor"), sem:blank("http://marklogic.com/semantics/blank/15118066541381804840")) sem:triple( sem:blank("http://marklogic.com/semantics/blank/15118066541381804840"), sem:iri("http://example.org/people/1.0/fullname"), "Dave Beckett") sem:triple( sem:blank("http://marklogic.com/semantics/blank/15118066541381804840"), sem:iri("http://example.org/people/1.0/homePage"), sem:iri("http://purl.org/net/dajobe/"))
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.