<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/sem.rdfParse.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>sem.rdfParse</api:function-name><api:suggest>sem.rdfparse</api:suggest><api:suggest>sem</api:suggest><api:suggest>rdfparse</api:suggest><api:function-link mode="xquery" fullname="sem:rdf-parse">/apidoc/8.0/sem:rdf-parse.xml</api:function-link><api:function mode="javascript" name="rdfParse" lib="sem" category="Semantics" hidden="false" bucket="MarkLogic Built-In Functions" prefix="sem" namespace="http://marklogic.com/semantics" fullname="sem.rdfParse"><api:summary>
		This function returns parsed <code xmlns="http://www.w3.org/1999/xhtml">sem:triple</code> objects 
		from a text format or XML.
	</api:summary><api:params><api:param name="in" type="item()"><api:param-description>
		  The source to parse. This must either be a string or a 
		  node.
	  </api:param-description><api:param-name>in</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
		  Parsing options. Only one each of the base, graph, 
		  override-graph, and format (ntriple, nquad, turtle, rdfxml, 
		  rdfjson, triplexml) options is allowed. Valid options 
		  include:
	<blockquote xmlns="http://www.w3.org/1999/xhtml">
        <dl>
          <dt>
             <pre>base=URI</pre>
          </dt>
        <dd>
        A base URI to use during parsing.
		</dd>
          <dt>
             <pre>graph=URI</pre>
          </dt>
        <dd>
		The graph/context value to give to quads with no explicit graph 
		specified in the data. Cannot be used with
		override-graph=URI (or an exception is thrown).
		</dd>
          <dt>
             <pre>override-graph=URI</pre>
          </dt>
        <dd>
		The graph/context value to give to every quad, whether 
		specified in the data or not.  Cannot be used with
		graph=URI (or an exception is thrown).
        </dd>
          <dt>
             <pre>ntriple</pre>
          </dt>
        <dd>		
        Specify N-Triples format for input.
        </dd>
          <dt>
             <pre>nquad</pre>
          </dt>
        <dd>		
		Specify N-Quads format for input (default if the $in 
		paramater is a string). 
		</dd>
          <dt>
             <pre>turtle</pre>
          </dt>
        <dd>	
        Specify Turtle format for input. 
		</dd>
          <dt>
             <pre>rdfxml</pre>
          </dt>
        <dd>	
		Specify RDF/XML format for input (default if the $in 
		parameter is an element).
	    </dd>
		<dt>
             <pre>n3</pre>
          </dt>
        <dd>		
        Specify N3 format for input.
        </dd>
		<dt>
             <pre>trig</pre>
          </dt>
        <dd>		
        Specify TriG format for input.
        </dd>
          <dt>
             <pre>rdfjson</pre>
          </dt>
        <dd>	
        Specify RDF/JSON format for input. 
        </dd>
          <dt>
             <pre>triplexml</pre>
          </dt>
        <dd>	
		Specify <code>sem:triple</code> XML format for input, either a 
		single <code>sem:triple</code> element or multiple elements 
		under a root element.  If you use the <code>triplexml</code>
		option, you cannot specify a graph.
        </dd>
          <dt>
             <pre>repair</pre>
          </dt>
        <dd>			
		Specify to repair if possible, or discard individual 
		triples that do not parse correctly. Otherwise any 
		malformed input results in an exception.
        </dd>
       </dl>	
    </blockquote>     	
	</api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var sem = require("/MarkLogic/semantics.xqy");

sem.rdfParse(xdmp.unquote(
'&lt;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/"&gt;\n\
  &lt;dc:title&gt;Weaving the Web&lt;/dc:title&gt;\n\
  &lt;dc:creator rdf:resource="http://www.w3.org/People/Berners-Lee/card#i"/&gt;\n\
&lt;/rdf:Description&gt;').next().value.root,
"rdfxml");	  
 
 =&gt; 
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"))
    </pre>
  </api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var sem = require("/MarkLogic/semantics.xqy");
      
var turtleDocument = '\n\
    @prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .\n\
    @prefix dc: &lt;http://purl.org/dc/elements/1.1/&gt; .\n\
    @prefix ex: &lt;http://example.org/people/1.0/&gt; .\n\
  &lt;http://www.w3.org/TR/rdf-syntax-grammar&gt;\n\
    dc:title "RDF/XML Syntax Specification (Revised)" ;\n\
    ex:editor [\n\
      ex:fullname "Dave Beckett";\n\
      ex:homePage &lt;http://purl.org/net/dajobe/&gt;\n\
    ] .'
sem.rdfParse(turtleDocument, ["turtle", "repair"] );

=&gt;  
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/"))
    </pre>
  </api:example></api:function></api:function-page>