Loading TOC...

MarkLogic 12 EA 2 Product Documentation
sem.inMemoryStore

sem.inMemoryStore(
   dataset as sem.triple[]
) as sem.store

Summary

Returns a sem:store constructor that queries from the sequence of sem:triple values passed in as an argument. The sem:store constructor returned from this function will raise an error if it is passed as part of the options argument to a call to sem:sparql-update().

The default rulesets configured on the current database have no effect on a sem:store constructor created with sem:in-memory-store().

This should be used along with sem:sparql() in preference to the deprecated sem:sparql-triples() function. We will remove documentation of sem:sparql-triples(), but leave the function for backwards compatibility.

This function is a built-in.

Parameters
dataset A set of triple values representing the dataset for the store.

The results from a SPARQL construct query or call to sem:rdf-parse() can be used directly as the value for this argument.

Required Privileges

http://marklogic.com/xdmp/privileges/sem-sparql

Example

var sem = require("/MarkLogic/semantics.xqy");
var turtleDocument = '\n\
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n\
    @prefix dc: <http://purl.org/dc/elements/1.1/> .\n\
    @prefix ex: <http://example.org/people/1.0/> .\n\
  <http://www.w3.org/TR/rdf-syntax-grammar>\n\
    dc:title "RDF/XML Syntax Specification (Revised)" ;\n\
    ex:editor [\n\
      ex:fullname "Dave Beckett";\n\
      ex:homePage <http://purl.org/net/dajobe/>\n\
    ] .';
var triples = sem.rdfParse(turtleDocument, ["turtle", "repair"] );
sem.inMemoryStore(triples);
=>
sem.store() :  Use the value to pass into a function that
requires a sem.store (like sem.sparqlUpdate).

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