<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/sem.rdfSerialize.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>sem.rdfSerialize</api:function-name><api:suggest>sem.rdfserialize</api:suggest><api:suggest>sem</api:suggest><api:suggest>rdfserialize</api:suggest><api:function-link mode="xquery" fullname="sem:rdf-serialize">/apidoc/8.0/sem:rdf-serialize.xml</api:function-link><api:function mode="javascript" name="rdfSerialize" lib="sem" category="Semantics" hidden="false" bucket="MarkLogic Built-In Functions" prefix="sem" namespace="http://marklogic.com/semantics" fullname="sem.rdfSerialize"><api:summary>
		This function returns a string or json or XML serialization 
		of the provided triples.
	</api:summary><api:params><api:param name="triples" type="sem:triple*"><api:param-description>
		  The triples to serialize.
	  </api:param-description><api:param-name>triples</api:param-name><api:param-type>sem.triple[]</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
		  Parsing options. Only one of the format options is allowed. 
		  Valid option values include:
	<blockquote xmlns="http://www.w3.org/1999/xhtml">
        <dl>
           <dt>
             <pre>ntriple</pre>
          </dt>
        <dd>
		Specify N-Triples format for output as an xs:string.
		</dd>
		    <dt>
             <pre>nquad</pre>
          </dt>
        <dd>
        Specify N-Quads format for output as an xs:string (default).
		</dd>
		    <dt>
             <pre>turtle</pre>
          </dt>
        <dd>
        Specify Turtle format for output as an xs:string.
		</dd>
		    <dt>
             <pre>rdfxml</pre>
          </dt>
        <dd>
        Specify RDF/XML format for output as an element.
        </dd>
		    <dt>
             <pre>rdfjson</pre>
          </dt>
        <dd>
		Specify JSON format for output as a json:object. Note: To 
		serialize a JSON string, manually call 
		<code>xdmp:to-json</code> on this object.
		</dd>    
		    <dt>
             <pre>n3</pre>
          </dt>
        <dd>		
        Specify N3 format for output as an xs:string.
        </dd>
		<dt>
             <pre>trig</pre>
          </dt>
        <dd>		
        Specify TriG format for output as an xs:string.
        </dd>
          <dt>
             <pre>triplexml</pre>
          </dt>
        <dd>
                Specify <code>sem:triple</code> XML format for output, 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>
	</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>String</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var sem = require("/MarkLogic/semantics.xqy");

sem.rdfSerialize(
  (sem.triple(
     sem.iri("http://example.com/ns/directory#m"),
     sem.iri("http://example.com/ns/person#firstName"), "Michelle")));

=&gt; 
    &lt;http://example.com/ns/directory#m&gt; 
	&lt;http://example.com/ns/person#firstName&gt; "Michelle" .
    </pre>
  </api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var sem = require("/MarkLogic/semantics.xqy");

sem.rdfSerialize(
    sem.triple(sem.iri("http://example.com/ns/directory#m"),
	sem.iri("http://example.com/ns/person#firstName"),
	"Michelle")), "rdfxml");

=&gt;
&lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt;
    &lt;rdf:Description rdf:about="http://example.com/ns/directory#m"&gt;
      &lt;firstName rdf:datatype="http://www.w3.org/2001/XMLSchema#string" 
        xmlns="http://example.com/ns/person#"&gt;Michelle
      &lt;/firstName&gt;
    &lt;/rdf:Description&gt;
&lt;/rdf:RDF&gt;
    </pre>
  </api:example></api:function></api:function-page>