Loading TOC...

MarkLogic 12 EA 2 Product Documentation
sem:rdf-insert

sem:rdf-insert(
   $triples as sem:triple*,
   [$options as xs:string*],
   [$permissions as element],
   [$collections as xs:string*],
   [$quality as xs:int?],
   [$forest-ids as xs:unsignedLong*]
) as xs:string*

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 elements 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

xquery version "1.0-ml"; 
 
import module namespace sem = "http://marklogic.com/semantics" 
      at "/MarkLogic/semantics.xqy";

sem:rdf-insert(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.