MarkLogic 10 Product Documentation
sem:graph

sem:graph(
   $graphname as sem:iri
) as sem:triple*

Summary

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

Parameters
graphname The name of the graph to retrieve.

Example

xquery version "1.0-ml"; 
 
import module namespace sem = "http://marklogic.com/semantics" 
      at "/MarkLogic/semantics.xqy";
 
sem:graph(sem:iri("http://marklogic.com/semantics#default-graph"))
 
 => (: returns all triples from the default graph :)

Example

xquery version "1.0-ml"; 
 
import module namespace sem = "http://marklogic.com/semantics" 
      at "/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"))
Powered by MarkLogic Server | Terms of Use | Privacy Policy