
sem.rdfLoad( location as String, [options as String[]], [http-opts as Node?], [permissions as Sequence], [collections as String[]], [quality as xs.int?], [forest-ids as (Number|String)[]] ) as Sequence
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.
| Parameters | |
|---|---|
| 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:
|
| 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. |
http://marklogic.com/xdmp/privileges/xdmp-document-get
sem:rdf-load
in the context of SPARQL Update can result in undefined behavior.
declareUpdate();
const sem = require("/MarkLogic/semantics.xqy");
sem.rdfLoad('C:/data/example.rdf', "rdfxml")
=>
/triplestore/fbd28af1471b39e9.xml
declareUpdate();
const sem = require("/MarkLogic/semantics.xqy");
sem.rdfLoad(
'C:/data/books.ttl',
["turtle", "graph=http://marklogic.com/semantics/sb/books1/"],
null,
xdmp.permission("demo-reader", "read")
);
=>
/triplestore/fbd28af1471b39e9.xml
// permissions on graph for demo-reader now set to "read"
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.