MarkLogic Server
XQUERY API DOCUMENTATION
3.1
This page was generated
November  5,  2007
6:02  PM
XQuery Built-In and Modules Function Reference

XQuery Built-In and Module Functions

The following table is an alphabetical listing of all of the Built-In and Module functions available in MarkLogic Server. Click on a function name to go directly to the detailed function description, or use the tree on the left to navigate to the functions by group.
Function Summary
cpf:document-get-error Fetch a trace of the error that caused the document's processing to fail, if any.
cpf:document-get-last-updated Determine the date and time of the last update to the document's content, if any.
cpf:document-get-processing-status Determine the document's current processing status, if any.
cpf:document-get-state Determine the document's current state, if any.
cpf:document-set-error Set the document's error trace to the given value.
cpf:document-set-last-updated Set the date and time of the document's last update.
cpf:document-set-processing-status Set the document's processing status to the given value.
cpf:document-set-state Set the document's state to the given state.
cpf:failure Concludes the state action in failure, advancing the state as defined by the state transition.
cpf:success Concludes the action successfully, advancing the state as defined by the transition.
css:convert Convert CSS text to an equivalent XML representation that is more suitable for analysis.
css:get Fetch the CSS for the given document, be it embedded or linked.
cts:and-not-query Returns a query specifying the set difference of the matches specified by two sub-queries.
      cts:and-not-query-negative-query
Returns the negative (second parameter) query used to construct the specified query.
      cts:and-not-query-positive-query
Returns the positive (first parameter) query used to construct the specified query.
cts:and-query Returns a query specifying the intersection of the matches specified by the sub-queries.
      cts:and-query-options
Returns the options for the specified query.
      cts:and-query-queries
Returns a sequence of the queries that were used to construct the specified query.
cts:classify Classifies a sequence of nodes based on training data.
cts:collection-query Returns a query matching documents in the collections with the given URIs.
      cts:collection-query-uris
Returns the URIs used to construct the specified query.
cts:confidence Returns the confidence of a node, or of the context node if no node is provided.
cts:contains Returns true if any of a sequence of nodes matches a query.
cts:deregister Deregister a registered query, explicitly releasing the associated resources.
cts:directory-query Returns a query matching documents in the directories with the given URIs.
      cts:directory-query-depth
Returns the depth used to construct the specified query.
      cts:directory-query-uris
Returns the URIs used to construct the specified query.
cts:document-query Returns a query matching documents with the given URIs.
      cts:document-query-uris
Returns the URIs used to construct the specified query.
cts:element-attribute-value-match Returns values from the specified element-attribute value lexicon(s) that match the specified wildcard pattern.
cts:element-attribute-value-query Returns a query matching elements by name with attributes by name with text content equal a given phrase.
      cts:element-attribute-value-query-attribute-name
Returns the attribute QNames used to construct the specified query.
      cts:element-attribute-value-query-element-name
Returns the element QNames used to construct the specified query.
      cts:element-attribute-value-query-options
Returns the options for the specified query.
      cts:element-attribute-value-query-text
Returns the text used to construct the specified query.
      cts:element-attribute-value-query-weight
Returns the weight with which the specified query was constructed.
cts:element-attribute-values Returns values from the specified element-attribute value lexicon(s).
cts:element-attribute-word-match Returns words from the specified element-attribute word lexicon(s) that match a wildcard pattern.
cts:element-attribute-word-query Returns a query matching elements by name with attributes by name with text content containing a given phrase.
      cts:element-attribute-word-query-attribute-name
Returns the attribute QNames used to construct the specified query.
      cts:element-attribute-word-query-element-name
Returns the element QNames used to construct the specified query.
      cts:element-attribute-word-query-options
Returns the options for the specified query.
      cts:element-attribute-word-query-text
Returns the text used to construct the specified query.
      cts:element-attribute-word-query-weight
Returns the weight with which the specified query was constructed.
cts:element-attribute-words Returns words from the specified element-attribute word lexicon(s).
cts:element-query Returns a cts:query matching elements by name with the content constrained by the given cts:query in the second parameter.
      cts:element-query-element-name
Returns the QNames used to construct the specified query.
      cts:element-query-query
Returns the query used to construct the element query.
cts:element-value-match Returns values from the specified element value lexicon(s) that match the specified wildcard pattern.
cts:element-value-query Returns a query matching elements by name with text content equal a given phrase.
      cts:element-value-query-element-name
Returns the QNames used to construct the specified query.
      cts:element-value-query-options
Returns the options for the specified query.
      cts:element-value-query-text
Returns the text used to construct the specified query.
      cts:element-value-query-weight
Returns the weight with which the specified query was constructed.
cts:element-values Returns values from the specified element value lexicon(s).
cts:element-word-match Returns words from the specified element word lexicon(s) that match a wildcard pattern.
cts:element-word-query Returns a query matching elements by name with text content containing a given phrase.
      cts:element-word-query-element-name
Returns the QNames used to construct the specified query.
      cts:element-word-query-options
Returns the options for the specified query.
      cts:element-word-query-text
Returns the text used to construct the specified query.
      cts:element-word-query-weight
Returns the weight with which the specified query was constructed.
cts:element-words Returns words from the specified element word lexicon.
cts:highlight Returns a copy of the node, replacing any text matching the query with the specified expression.
cts:near-query Returns a query matching all of the specified queries, where the matches occur within the specified distance from each other.
      cts:near-query-distance
Returns the distance used to construct the near query.
      cts:near-query-options
Returns the options for the specified query.
      cts:near-query-queries
Returns the query sequence used to construct the near query.
      cts:near-query-weight
Returns the weight with which the specified query was constructed.
cts:not-query Returns a query specifying the matches not specified by its sub-query.
      cts:not-query-query
Returns the query used to construct the specified query.
      cts:not-query-weight
Returns the weight with which the specified query was constructed.
cts:or-query Returns a query specifying the union of the matches specified by the sub-queries.
      cts:or-query-queries
Returns a sequence of the queries that were used to construct the specified query.
cts:quality Returns the quality of a node, or of the context node if no node is provided.
cts:register Register a query for later use.
cts:registered-query Returns a query matching fragments specified by previously registered queries (see cts:register).
      cts:registered-query-ids
Returns the registered query identifiers used to construct the specified query.
      cts:registered-query-options
Returns the options for the specified query.
      cts:registered-query-weight
Returns the weight with which the specified query was constructed.
cts:remainder Returns an estimated search result size for a node, or of the context node if no node is provided.
cts:score Returns the score of a node, or of the context node if no node is provided.
cts:search Returns a relevance-ordered sequence of nodes specified by a given query.
cts:similar-query Returns a query matching nodes similar to the model nodes.
      cts:similar-query-nodes
Returns the nodes used to construct the specified query.
      cts:similar-query-weight
Returns the weight with which the specified query was constructed.
cts:thresholds Compute precision, recall, the F measure, and thresholds for the classes computed by the classifier, by comparing with the labels for the same set.
cts:tokenize Tokenizes text into words, punctuation, and spaces.
cts:train Produces a set of classifiers from a list of labeled training documents.
cts:word-match Returns words from the word lexicon that match the wildcard pattern.
cts:word-query Returns a query matching text content containing a given phrase.
      cts:word-query-options
Returns the options for the specified query.
      cts:word-query-text
Returns the text used to construct the specified query.
      cts:word-query-weight
Returns the weight with which the specified query was constructed.
cts:words Returns words from the word lexicon.
cvt:basename Return the filename part of the URI, cutting off any query strings or fragments.
cvt:basepath Return the base path of the URI, cutting off the filename.
cvt:destination-uri Construct the destination URI from the source URI using the following rules: The path prefix of the destination URI is the same as the source URI's.
cvt:part-uri Construct the URI for the part using the following rules: The path prefix of the part URI is the same source URI's, followed by a subdirectory name.
cvt:save-converted-documents Save a set of converted documents, with appropriate links.
dbk:convert Convert XHTML to DocBook lite vocabulary, if possible.
dom:add-permissions Add permissions to the domain.
dom:add-pipeline Add another pipeline to the set of pipelines bound to the domain.
dom:collection Return the name of the collection in which domains are stored.
dom:create Create a new content processing domain, along with the triggers that perform work in that domain.
dom:domain-scope Create a domain scope element.
dom:domains Return all the domains.
dom:evaluation-context Create an evaluation context element.
dom:get Find a particular domain.
dom:remove Remove the domain and any associated triggers.
dom:remove-permissions Remove permissions to the domain.
dom:remove-pipeline Remove the association between a pipeline and the domain.
dom:set-description Set the description of the domain.
dom:set-domain-scope Set the scope of the domain.
dom:set-evaluation-context Set the evaluation context of the domain.
dom:set-name Set the name of the domain to something else.
dom:set-permissions Set the permissions of the domain.
dom:set-pipelines Bind a new set of pipelines to the domain.
excel:clean Clean up any conversion artifacts or other infelicities, putting each sheet into its own div element.
fn:abs Returns the absolute value of $arg.
fn:adjust-date-to-timezone Adjusts an xs:date value to a specific timezone, or to no timezone at all.
fn:adjust-dateTime-to-timezone Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all.
fn:adjust-time-to-timezone Adjusts an xs:time value to a specific timezone, or to no timezone at all.
fn:avg Returns the average of the values in the input sequence $arg, that is, the sum of the values divided by the number of values.
fn:base-uri Returns the value of the base-uri property for the specified node.
fn:boolean Computes the effective boolean value of the sequence $arg.
fn:ceiling Returns the smallest (closest to negative infinity) number with no fractional part that is not less than the value of $arg.
fn:codepoint-equal Returns true if the specified parameters are the same Unicode code point, otherwise returns false.
fn:codepoints-to-string Creates an xs:string from a sequence of Unicode code points.
fn:collection Returns all of the documents that belong to the specified collection(s).
fn:compare Returns -1, 0, or 1, depending on whether the value of the $comparand1 is respectively less than, equal to, or greater than the value of $comparand2, according to the rules of the collation that is used.
fn:concat Returns the xs:string that is the concatenation of the values of the specified parameters.
fn:contains Returns true if the first parameter contains the string from the second parameter, otherwise returns false.
fn:count Returns the number of items in the value of $arg.
fn:current-date Returns xs:date(fn:current-dateTime()).
fn:current-dateTime Returns the current dateTime value (with timezone) from the dynamic context.
fn:current-time Returns xs:time(fn:current-dateTime()).
fn:data Takes a sequence of items and returns a sequence of atomic values.
fn:day-from-date Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.
fn:day-from-dateTime Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.
fn:days-from-duration Returns an xs:integer representing the days component in the canonical lexical representation of the value of $arg.
fn:deep-equal This function assesses whether two sequences are deep-equal to each other.
fn:default-collation Returns the value of the default collation property from the static context.
fn:distinct-values Returns the sequence that results from removing from $arg all but one of a set of values that are eq to one other.
fn:doc Returns the document(s) stored in the database at the specified URI(s).
fn:doc-available If fn:doc($uri) returns a document node, this function returns true.
fn:document-uri Returns the value of the document-uri property for the specified node.
fn:empty If the value of $arg is the empty sequence, the function returns true; otherwise, the function returns false.
fn:encode-for-uri Invertible function that escapes characters required to be escaped inside path segments of URIs.
fn:ends-with Returns true if the first parameter ends with the string from the second parameter, otherwise returns false.
fn:error Throw the given error.
fn:escape-html-uri %-escapes everything except printable ASCII characters.
fn:escape-uri Returns a string representing the specified URI either with escaped reserved characters ($escape-reserved=true) or with the reserved characters left as specified ($escape-reserved=true).
fn:exactly-one Returns $arg if it contains exactly one item.
fn:exists If the value of $arg is not the empty sequence, the function returns true; otherwise, the function returns false.
fn:false Returns the xs:boolean value false.
fn:floor Returns the largest (closest to positive infinity) number with no fractional part that is not greater than the value of $arg.
fn:hours-from-dateTime Returns an xs:integer between 0 and 23, both inclusive, representing the hours component in the localized value of $arg.
fn:hours-from-duration Returns an xs:integer representing the hours component in the canonical lexical representation of the value of $arg.
fn:hours-from-time Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.
fn:id Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $arg.
fn:idref Returns the sequence of element or attribute nodes that have an IDREF value matching the value of one or more of the ID values supplied in $arg.
fn:implicit-timezone Returns the value of the implicit timezone property from the dynamic context.
fn:in-scope-prefixes Returns the prefixes of the in-scope namespaces for $element.
fn:index-of Returns a sequence of positive integers giving the positions within the sequence $seqParam of items that are equal to $srchParam.
fn:insert-before Returns a new sequence constructed from the value of $target with the value of $inserts inserted at the position specified by the value of $position.
fn:iri-to-uri Idempotent function that escapes non-URI characters.
fn:lang This function tests whether the language of $node, or the context node if the second argument is omitted, as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $testlang.
fn:last Returns the context size from the dynamic context.
fn:local-name Returns the local part of the name of $arg as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName.
fn:local-name-from-QName Returns an xs:NCName representing the local part of $arg.
fn:lower-case Returns the specified string converting all of the characters to lower-case characters.
fn:matches Returns true if the specified $input matches the specified $pattern, otherwise returns false.
fn:max Selects an item from the input sequence $arg whose value is greater than or equal to the value of every other item in the input sequence.
fn:min Selects an item from the input sequence $arg whose value is less than or equal to the value of every other item in the input sequence.
fn:minutes-from-dateTime Returns an xs:integer value between 0 and 59, both inclusive, representing the minute component in the localized value of $arg.
fn:minutes-from-duration Returns an xs:integer representing the minutes component in the canonical lexical representation of the value of $arg.
fn:minutes-from-time Returns an xs:integer value between 0 to 59, both inclusive, representing the value of the minutes component in the localized value of $arg.
fn:month-from-date Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.
fn:month-from-dateTime Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.
fn:months-from-duration Returns an xs:integer representing the months component in the canonical lexical representation of the value of $arg.
fn:name Returns the name of a node, as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName.
fn:namespace-uri Returns the namespace URI of the xs:QName of $arg.
fn:namespace-uri-for-prefix Returns the namespace URI of one of the in-scope namespaces for $element, identified by its namespace prefix.
fn:namespace-uri-from-QName Returns the namespace URI for $arg as an xs:string.
fn:node-kind Returns an xs:string representing the node's kind: either "document", "element", "attribute", "text", "namespace", "processing-instruction", "binary", or "comment".
fn:node-name Returns an expanded-QName for node kinds that can have names.
fn:normalize-space Returns the specified string with normalized whitespace, which strips off any leading or trailing whitespace and replaces any other sequences of more than one whitespace characters with a single space character (#x20).
fn:normalize-unicode [This function is not supported].
fn:not $arg is first reduced to an effective boolean value by applying the fn:boolean function.
fn:number Returns the value indicated by $arg or, if $arg is not specified, the context item after atomization, converted to an xs:double.
fn:one-or-more Returns $arg if it contains one or more items.
fn:position Returns the context position from the dynamic context.
fn:prefix-from-QName Returns an xs:NCName representing the prefix of $arg.
fn:QName Returns an xs:QName with the namespace URI given in $paramURI.
fn:remove Returns a new sequence constructed from the value of $target with the item at the position specified by the value of $position removed.
fn:replace Returns a string constructed by replacing the specified $pattern on the $input string with the specified $replacement string.
fn:resolve-QName Returns an xs:QName value (that is, an expanded-QName) by taking an xs:string that has the lexical form of an xs:QName (a string in the form "prefix:local-name" or "local-name") and resolving it using the in-scope namespaces for a given element.
fn:resolve-uri Resolves a relative URI against an absolute URI.
fn:reverse Reverses the order of items in a sequence.
fn:root Returns the root of the tree to which $arg belongs.
fn:round Returns the number with no fractional part that is closest to the argument.
fn:round-half-to-even The value returned is the nearest (that is, numerically closest) numeric to $arg that is a multiple of ten to the power of minus $precision.
fn:seconds-from-dateTime Returns an xs:decimal value between 0 and 60.
fn:seconds-from-duration Returns an xs:decimal representing the seconds component in the canonical lexical representation of the value of $arg.
fn:seconds-from-time Returns an xs:decimal value between 0 and 60.
fn:starts-with Returns true if the first parameter starts with the string from the second parameter, otherwise returns false.
fn:static-base-uri Returns the value of the base-uri property from the static context.
fn:string Returns the value of $arg represented as an xs:string.
fn:string-join Returns an xs:string created by concatenating the members of the $parameter1 sequence using $parameter2 as a separator.
fn:string-length Returns an integer representing the length of the specified string.
fn:string-pad Returns a string representing the $padString concatenated with itself the number of times specifed in $padCount.
fn:string-to-codepoints Returns the sequence of Unicode code points that constitute an xs:string.
fn:subsequence Returns the contiguous sequence of items in the value of $sourceSeq beginning at the position indicated by the value of $startingLoc and continuing for the number of items indicated by the value of $length.
fn:substring Returns a substring starting from the $startingLoc and continuing for $length characters.
fn:substring-after Returns the substring created by taking all of the input characters that occur after the specified $after characters.
fn:substring-before Returns the substring created by taking all of the input characters that occur before the specified $before characters.
fn:sum Returns a value obtained by adding together the values in $arg.
fn:timezone-from-date Returns the timezone component of $arg if any.
fn:timezone-from-dateTime Returns the timezone component of $arg if any.
fn:timezone-from-time Returns the timezone component of $arg if any.
fn:tokenize Returns a sequence of strings contructed by breaking the specified input into substrings separated by the specified $pattern.
fn:trace Return the input $value unchanged and, if $label is the name of an enabled server event, emit that server event to the server log file (ErrorLog.
fn:translate Returns a string where every character in $src that occurs in some position in the $mapString is translated into the $transString character in the corresponding location of the $mapString character.
fn:true Returns the xs:boolean value true.
fn:unordered Returns the items of $sourceSeq in an implementation dependent order.
fn:upper-case Returns the specified string converting all of the characters to upper-case characters.
fn:year-from-date Returns an xs:integer representing the year component in the localized value of $arg.
fn:year-from-dateTime Returns an xs:integer representing the year component in the localized value of $arg.
fn:years-from-duration Returns an xs:integer representing the years component in the canonical lexical representation of the value of $arg.
fn:zero-or-one Returns $arg if it contains zero or one items.
lnk:create Create a link between the two given documents with the given role labels and strength.
lnk:from Find and return all the links from the given document to some other.
lnk:get Find and return the link between the two documents, if any.
lnk:remove Remove the link between the two given documents and return the removed link.
lnk:to Find and return all the links to the given document from some other.
math:acos Returns the arc cosine of x, in radians, in the range from 0 to pi (inclusive).
math:asin Returns the arc sine of x, in radians, in the range from -pi/2 to +pi/2 (inclusive).
math:atan Returns the arc tangent of x, in radians.
math:atan2 Returns the arc tangent of y/x, in radians, in the range from -pi/2 to +pi/2 (inclusive), using the signs of y and x to determine the apropriate quadrant.
math:ceil Returns the smallest integer greater than or equal to x.
math:cos Returns the cosine of x, in the range from -1 to +1 (inclusive).
math:cosh Returns the hyperbolic cosine of x.
math:exp Returns e to the xth power.
math:fabs Returns the absolute value of x.
math:floor Returns the largest integer less than or equal to x.
math:fmod Returns the remainder of x/y.
math:frexp Returns x broken up into mantissa and exponent, where x = mantissa*2^exponent.
math:ldexp Returns x*2^i.
math:log Returns the base-e logarithm of x.