
sem:triple( $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.
sem:triple that might not
be valid RDF triples. For example, you can create a triple with a blank
node (sem:bnode()) 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.
xquery version "1.0-ml";
import module namespace sem = "http://marklogic.com/semantics"
at "MarkLogic/semantics.xqy";
sem:triple(sem:iri("subject"), sem:iri("predicate"), "object")
(: Returns the specified triple. :)
xquery version "1.0-ml"; import module namespace sem = "http://marklogic.com/semantics" at "MarkLogic/semantics.xqy"; sem:triple( <sem:triple xmlns:sem="http://marklogic.com/semantics"> <sem:subject>subject</sem:subject> <sem:predicate>predicate</sem:predicate> <sem:object datatype="http://www.w3.org/2001/XMLSchema#string">object</sem:object> </sem:triple>) (: Returns the specified triple. :)
xquery version "1.0-ml";
import module namespace sem = "http://marklogic.com/semantics"
at "MarkLogic/semantics.xqy";
sem:triple(
object-node {
"triple" : object-node {
"subject" : "subject",
"predicate" : "predicate",
"object" : object-node {
"value" : "object",
"datatype" : "http://www.w3.org/2001/XMLSchema#string"
}
}
}
)
(: Returns the specified triple. :)
xquery version "1.0-ml";
import module namespace sem = "http://marklogic.com/semantics"
at "MarkLogic/semantics.xqy";
sem:triple(
<foo>{sem:triple(sem:iri("subject"), sem:iri("predicate"),
"object")}
</foo>/element())
(: Returns the specified triple. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.