The semantic functions include functions that are built into MarkLogic Server as well as functions that are implemented in an XQuery library.
To use the semantics XQuery library module as part of your own XQuery module, include the following line in your XQuery prolog:
import module namespace sem = "http://marklogic.com/semantics" at "/MarkLogic/semantics.xqy";
The library namespace prefix sem
is predefined in
the server.
Function name | Description |
---|---|
sem:binding | Creates a sem:binding object, which is a sub-type of json:object (and map:map). |
sem:bnode | This function returns an identifier for a blank node, allowing the construction of a triple that refers to a blank node. |
sem:coalesce | Returns the value of the first argument that evaluates without error. |
sem:curie-expand | This function expands a CURIE (Compact URI) into a sem:iri object. |
sem:curie-shorten | This function shortens an IRI into a CURIE (Compact URI) into a sem:iri object. |
sem:database-nodes | This function returns database nodes backing given triples. |
sem:datatype | Returns the name of the simple type of the atomic value argument as a SPARQL style IRI. |
sem:default-graph-iri | Returns the iri of the default graph. |
sem:describe | This function implements the Concise Bounded Description (CBD) specification to describe one or more nodes in the graph. |
sem:graph | This function returns all triples from a named graph in the database. |
sem:graph-add-permissions | Add permissions to the graph specified. |
sem:graph-delete | This function deletes a named graph, and its graph document containing metadata, from the database. |
sem:graph-get-permissions | Get permissions to the graph specified. |
sem:graph-insert | This function inserts triples into a named graph, creating the graph if necessary. |
sem:graph-remove-permissions | Remove permissions from the graph specified. |
sem:graph-set-permissions | Set permissions to the graph specified. |
sem:if | The IF function form evaluates the first argument, interprets it as a effective boolean value, then returns the value of expression2 if the EBV is true, otherwise it returns the value of expression3. |
sem:in-memory-store | Returns a sem:store constructor that queries from the sequence of sem:triple values passed in as an argument. |
sem:invalid | Returns a sem:invalid value with the given literal value and datatype IRI. |
sem:invalid-datatype | Returns the datatype IRI of a sem:invalid value. |
sem:iri | This is a constructor function that takes a string and constructs an item of type sem:iri from it. |
sem:isBlank | Returns true if the argument is an RDF blank node - that is, derived from type sem:blank. |
sem:isIRI | Returns true if the argument is an RDF IRI - that is, derived from type sem:iri, but not derived from type sem:blank. |
sem:isLiteral | Returns true if the argument is an RDF literal - that is, derived from type xs:anyAtomicType, but not derived from type sem:iri. |
sem:isNumeric | Returns true if the argument is a valid numeric RDF literal. |
sem:lang | Returns the language of the value passed in, or the empty string if the value has no language. |
sem:langMatches | Returns true if $lang-tag matches $lang-range according to the basic filtering scheme defined in RFC4647. |
sem:prefixes | This function returns a set of prefix mappings for use with CURIE processing. |
sem:query-results-serialize | This function implements the W3C SPARQL Query Results format. |
sem:random | Returns a random double between 0 and 1. |
sem:rdf-builder | This function returns a function that builds triples from CURIE and blank node syntax. |
sem:rdf-get | This function returns sem:triples from a specified location. |
sem:rdf-insert | This function inserts triples into a specified database as one or more sem:triples documents. |
sem:rdf-load | This function inserts an RDF document from a specified location into the designated database. |
sem:rdf-parse | This function returns parsed sem:triple objects from a text format or XML. |
sem:rdf-serialize | This function returns a string or json or XML serialization of the provided triples. |
sem:ruleset-store | The sem:ruleset-store function returns a set of triples derived by applying the ruleset to the triples in the sem:store constructor provided in $store ("the triples that can be inferred from these rules"). |
sem:sameTerm | Returns true if the arguments are the same RDF term as defined by the RDF concepts specification. |
sem:sparql | Executes a SPARQL query against the database. |
sem:sparql-plan | Return a node representing the query plan of the given SPARQL query. |
sem:sparql-update | Executes a SPARQL Update operation against the database. |
sem:sparql-values | This function executes a SPARQL SELECT query using passed-in bindings participating as a starting point for the query. |
sem:store | The sem:store function defines a set of criteria, that when evaluated, selects a set of triples to be passed in to sem:sparql(), sem:sparql-update(), or sem:sparql-values() as part of the options argument. |
sem:timezone-string | Returns the timezone of an xs:dateTime value as a string. |
sem:transitive-closure | From a starting set of seeds, follow a given set of predicates, to a given depth, and return all unique node IRIs. |
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). |
sem:triple-graph | Returns the graph identifier (graph IRI) from a sem:triple value. |
sem:triple-object | Returns the object from a sem:triple value. |
sem:triple-predicate | Returns the predicate from a sem:triple value. |
sem:triple-subject | Returns the subject from a sem:triple value. |
sem:typed-literal | Returns a value to represent the RDF typed literal with lexical value $value and datatype IRI $datatype. |
sem:unknown | Returns a sem:unknown value with the given literal value and datatype IRI. |
sem:unknown-datatype | Returns the datatype IRI of a sem:unknown value. |
sem:uuid | Return a UUID URN (RFC4122) as a sem:iri value. |
sem:uuid-string | Return a string that is the scheme specific part of random UUID URN (RFC4122). |