sem.rdfParse( in as Item, [options as String[]] ) as Sequence
This function returns parsed sem:triple
objects
from a text format or XML.
var sem = require("/MarkLogic/semantics.xqy"); sem.rdfParse(fn.head(xdmp.unquote( '<rdf:Description rdf:about="urn:isbn:006251587X" \n\ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" \n\ xmlns:dc="http://purl.org/dc/elements/1.1/" \n\ xmlns:v="http://www.w3.org/2006/vcard/">\n\ <dc:title>Weaving the Web</dc:title>\n\ <dc:creator rdf:resource="http://www.w3.org/People/Berners-Lee/card#i"/>\n\ </rdf:Description>')).root, "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"))
var sem = require("/MarkLogic/semantics.xqy"); var turtleDocument = '\n\ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n\ @prefix dc: <http://purl.org/dc/elements/1.1/> .\n\ @prefix ex: <http://example.org/people/1.0/> .\n\ <http://www.w3.org/TR/rdf-syntax-grammar>\n\ dc:title "RDF/XML Syntax Specification (Revised)" ;\n\ ex:editor [\n\ ex:fullname "Dave Beckett";\n\ ex:homePage <http://purl.org/net/dajobe/>\n\ ] .' sem.rdfParse(turtleDocument, ["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/"))