MarkLogic 12 EA 1 Product Documentation
sem.graphInsertsem.graphInsert(
graphname as sem.iri,
triples as sem.triple[],
[permissions as Sequence],
[collections as String[]],
[quality as xs.int?],
[forest-ids as (Number|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 |
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.
Example
declareUpdate();
const 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
Copyright © 2024 MarkLogic Corporation. MARKLOGIC is a
registered trademark of MarkLogic Corporation.