Loading TOC...

MarkLogic Server 11.0 Product Documentation
sem.rdfInsert

sem.rdfInsert(
   triples as sem.triple | Sequence | Array,
   [options as String[]],
   [permissions as Object[]],
   [collections as String[]],
   [quality as xs.int?],
   [forest-ids as (Number|String)[]]
) as Sequence

Summary

This function inserts triples into a specified database as one or more sem:triples documents. It also creates graph metadata for the graph specified by the "graph" or "override-graph=URI" option. This is an update function that returns the document URIs of inserted documents.

Parameters
triples The triples to insert.
options Insertion options. Valid options values include:
override-graph=URI
The graph/context value to give to every quad, whether specified in the data or not.
directory=URI
The database directory path.
permissions Security permission objects corresponding to the permissions for the document.
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.

Usage Notes

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

Example

declareUpdate();
const sem = require("/MarkLogic/semantics.xqy");

sem.rdfInsert(
  sem.triple(
        sem.iri("http://example.com/ns/directory#m"),
	sem.iri("http://example.com/ns/person#firstName"), "Michael"));
 
 =>
   /triplestore/74521a908ece2074.xml
 

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