Loading TOC...


   subject_or_node as Item,
   [predicate as xs.anyAtomicType],
   [object as xs.anyAtomicType],
   [graph as sem.iri?]
) as sem.triple


Creates a triple object, which represents an RDF triple containing atomic values representing the subject, predicate, object, and optionally graph identifier (graph IRI).

This function is a built-in.

subject_or_node The triple's subject as an atomic value, or the whole triple as a JavaScript object. If specifying a node as a triple, this function must be used as a single-parameter version (that is, you cannot specify a triple in this parameter and also use the other parameters).
predicate The triple's predicate.
object The triple's object.
graph The triple's graph IRI. This parameter is only available if you have specified a subject, predicate, and object, and is not available if you have specified an element as a triple in the first parameter.

Usage Notes

It is possible to create triples with sem.triple that might not be valid RDF triples. For example, you can create a triple with a number as a predicate, even though that is not allowed in RDF. This is because the triples you can create with sem:triple are more general than what is allowed in RDF.


sem.triple(sem.iri("subject"), sem.iri("predicate"), "object")

(: Returns the specified triple. :)


    "triple" : {
      "subject" : "subject",
      "predicate" : "predicate",
      "object" : {
        "value" : "object",
        "datatype" : "http://www.w3.org/2001/XMLSchema#string"

(: Returns the specified triple. :)

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