Loading TOC...

sem.graph

sem.graph(
   graphname as sem.iri
) as Sequence

Summary

This function returns all triples from a named graph in the database.

Parameters
graphname The name of the graph to retrieve.

Example

const sem = require("/MarkLogic/semantics.xqy");
 
sem.graph(sem.iri("http://marklogic.com/semantics#default-graph"));
 
=> 
returns all triples from the default graph 

Example

const sem = require("/MarkLogic/semantics.xqy");
sem.graph(sem.iri("bookgraph"));

=> 
returns all triples from a named graph as triples 

    sem:triple(sem:iri("urn:isbn:006251587X"), 
	sem:iri("http://purl.org/dc/elements/1.1/title"),
	"Weaving the Web", 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", 
	sem:iri("bookgraph"))

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