MarkLogic Server 11.0 Product Documentation
sem:rdf-get

sem:rdf-get(
   $location as xs:string,
   [$options as xs:string*],
   [$http-opts as element()?]
) as sem:triple*

Summary

This function returns sem:triples from a specified location.

Parameters
location The location of the document.
options Parsing options. Valid options include:
base=URI
A base URI to use during parsing.
graph=URI
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).
override-graph=URI
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).
ntriple
Specify N-Triples format for input.
nquad
Specify N-Quads format for input (default).
turtle
Specify Turtle format for input.
rdfxml
Specify RDF/XML format for input.
rdfjson
Specify RDF/JSON format for input.
n3
Specify N3 format for input.
trig
Specify TriG format for input.
repair
Specify to repair if possible, or discard individual triples that do not parse correctly. Otherwise any malformed input results in an exception.
triplexml
Specify sem:triple XML format for input, either a single sem:triple element or multiple elements under a root element. If you use the triplexml option, you cannot specify a graph.
http-opts An options node as described for the function xdmp:http-get.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-document-get

Example

xquery version "1.0-ml"; 
 
import module namespace sem = "http://marklogic.com/semantics" 
      at "/MarkLogic/semantics.xqy";
 
sem:rdf-get('C:/Data/Semantics/example.ttl', "turtle")
	
=> 
    sem:triple(sem:iri("http://example.com/ns/data#item342"),
	sem:iri("http://example.com/ns/details#shipped"), xs:date("2013-05-20"))
    
    sem:triple(sem:iri("http://example.com/ns/data#item342"),
	sem:iri("http://example.com/ns/details#quantity"), 4)
    
    sem:triple(sem:iri("http://example.com/ns/data#item342"),
	sem:iri("http://example.com/ns/details#invoiced"), fn:false())
     
    sem:triple(sem:iri("http://example.com/ns/data#item342"),
	sem:iri("http://example.com/ns/details#costPerItem"), 10.5)
    
Powered by MarkLogic Server | Terms of Use | Privacy Policy