Loading TOC...


   [prefixes as Object?],
   [graph as sem.iri?]
) as function(item(),item(),item()) as sem.triple


This function returns a function that builds triples from CURIE and blank node syntax. The resulting function takes three string arguments, representing subject, predicate, and object respectively, which returns a sem:triple object using the graph and prefix mappings passed in to the call to sem:rdf-builder. Blank nodes specified with a leading underscore (_) will be assigned blank node identifiers, and will maintain that identity across multiple invocations; for example, "_:person1" will refer to the same node as a later invocation that also mentions "_:person1". In the predicate position, the special value of "a" will be interpreted as the same as "rdf:type".

prefixes An optional set of prefix mappings.
graph The graph value in which to place triples. Defaults to "http://marklogic.com/semantics#default-graph".

Usage Notes

If you pass in a string to sem:rdf-builder, it will be interpreted as a CURIE. If you want it to be interpreted as an IRI, then cast the string to an IRI using sem:iri.


var sem = require("/MarkLogic/semantics.xqy");
var prefixes = {"a": "http://marklogic.com/a"};
var fac = sem.rdfBuilder();
xdmp.apply(fac, "_:person1", "a", "foaf:Person");

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