Loading TOC...

sem.graphInsert

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

Summary

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.

Parameters
$graphnameThe name of the graph to insert triples into.
$triplesThe 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.
$collectionsAdditional 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.
$qualityThe quality setting to use for inserted documents.
$forest-idsThe 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.

Example

declareUpdate();
var sem = require("/MarkLogic/semantics.xqy");
     
sem.graphInsert(sem.iri('bookgraph'), 
   sem.triple(sem.iri('urn:isbn:9780080540160'),
              sem.iri('http://purl.org/dc/elements/1.1/title'), 
              "Query XML,XQuery, XPath, and SQL/XML in context"));
			 
=>
    /triplestore/2c78915c5854b0f8.xml
    

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy