Loading TOC...


   $graphname as sem.iri,
   $triples as sem.triple[],
   [$permissions as Sequence],
   [$collections as String[]],
   [$quality as xs.int?],
   [$forest-ids as String[]]
) as Sequence


This function inserts triples into a named graph, creating the graph if necessary. It also creates the graph metadata for the graph specified by the "graphname" option. This is an update function that returns document IDs.

$graphname The name of the graph to insert triples into.
$triples The set of triples to insert.
$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. When additional collections are set, inserted triples will exist in multiple collections.
$quality The quality setting to use for inserted documents.
$forest-ids The forest-ids to use when inserting documents.

Usage Notes

Using additional collections with graph-insert in the context of SPARQL Update can result in undefined behavior.


var sem = require("/MarkLogic/semantics.xqy");
              "Query XML,XQuery, XPath, and SQL/XML in context"));

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