Loading TOC...


   $location as xs:string,
   [$options as xs:string*],
   [$http-opts as element()?],
   [$permissions as item()*],
   [$collections as xs:string*],
   [$quality as xs:int?],
   [$forest-ids as xs:unsignedLong*]
) as xs:string*


This function inserts an RDF document from a specified location into the designated database. It also creates the graph metadata for the graph specified by the "graph=URI" or "override-graph=URI" option. This is an update function that returns the document URIs of inserted documents.

location The location of the input file. If the file is not a recognized format, an exception is thrown.
options Parsing options: Only one base, or graph, or override-graph option along with one format option (ntriple, nquad, turtle, trig, n3, rdfxml, or rdfjson) is allowed. The graph and override-graph options cannot be used together. Valid options include:
A base URI to use during parsing.
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).
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).
The database directory path.
Specify N-Triples format for input.
Specify N-Quads format for input (default).
Specify Turtle format for input.
Specify RDF/XML format for input.
Specify RDF/JSON format for input.
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.
Specify N3 format for input.
Specify TriG format for input.
Specify to repair if possible, or discard individual triples that do not parse correctly. Otherwise any malformed input results in an exception.
http-opts An options node as described for the function xdmp:http-get.
permissions Permissions to apply to the inserted documents. When run in an XQuery context, the permissions are a sequence of XML elements (sec:permission). When importing this module into a Server-Side JavaScript context, the permissions are an array of Objects.
collections Additional collections to set on inserted documents. If you use the collections argument when inserting triples, no graph document will be created for these collections.
quality The quality setting for inserted documents.
forest-ids The forest-ids to use for inserted documents.

Required Privileges


Usage Notes

Using additional collections with sem:rdf-load in the context of SPARQL Update can result in undefined behavior.


xquery version "1.0-ml"; 
import module namespace sem = "http://marklogic.com/semantics" 
      at "/MarkLogic/semantics.xqy";
sem:rdf-load('C:/data/example.rdf', "rdfxml")


xquery version "1.0-ml"; 
import module namespace sem = "http://marklogic.com/semantics" 
      at "/MarkLogic/semantics.xqy";
    ("turtle", "graph=http://marklogic.com/semantics/sb/books1/"),
    xdmp:permission("demo-reader", "read")
  (: permissions on graph for demo-reader now set to "read" :)

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.