We list here the most important functions supported by RumbleDB, and introduce them by means of examples. Highly detailed specifications can be found in the underlying W3C standardarrow-up-right , unless the function is marked as specific to JSON or RumbleDB, in which case it can be found herearrow-up-right . JSONiq and RumbleDB intentionally do not support builtin functions on XML nodes, NOTATION or QNames. RumbleDB supports almost all other W3C-standardized functions, please contact us if you are still missing one.
For the sake of ease of use, all W3C standard builtin functions and JSONiq builtin functions are in the RumbleDB namespace, which is the default function namespace and does not require any prefix in front of function names.
It is recommended that user-defined functions are put in the local namespace, i.e., their name should have the local: prefix (which is predefined). Otherwise, there is the risk that your code becomes incompatible with subsequent releases if new (unprefixed) builtin functions are introduced.
Errors and diagnostics
Diagnostic tracing
W3C specificationarrow-up-right
Fully implemented
returns (1, 2, 3) and logs it in the log-path if specified
Functions and operators on numerics
Functions on numeric values
W3C specificationarrow-up-right
Fully implemented
returns 2.0
W3C specificationarrow-up-right
Fully implemented
returns 3.0
W3C specificationarrow-up-right
Fully implemented
returns 2.0
W3C specificationarrow-up-right
Fully implemented
returns 2.0
returns 2.23
round-half-to-even
W3C specificationarrow-up-right
Fully implemented
Parsing numbers
W3C specificationarrow-up-right
Fully implemented
returns 15 as a double
returns NaN as a double
returns 15 as a double
W3C specificationarrow-up-right
Not implemented
##Formatting numbers
W3C specificationarrow-up-right
Not implemented
##Trigonometric and exponential functions
###pi W3C specificationarrow-up-right
Fully implemented
returns 3.141592653589793
###exp W3C specificationarrow-up-right
Fully implemented
###exp10 W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
returns 2
W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
JSONiq-specific. Fully implemented
JSONiq-specific. Fully implemented
W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
W3C specificationarrow-up-right
Fully implemented
random-number-generator
W3C specificationarrow-up-right
Not implemented
Functions on strings
Functions to assemble and disassemble strings
string-to-codepoint
W3C specificationarrow-up-right
Fully implemented
returns (84, 104, 233, 114, 232, 115, 101)
returns ()
codepoints-to-string
W3C specificationarrow-up-right
Fully implemented
returns "अशॊक"
returns ""
Comparison of strings
W3C specificationarrow-up-right
Fully implemented
returns -1
codepoint-equal
W3C specificationarrow-up-right
Fully implemented
returns true
returns ()
W3C specificationarrow-up-right
Not implemented
W3C specificationarrow-up-right
Not implemented
Functions on string values
W3C specificationarrow-up-right
Fully implemented
returns "foobarfoobar"
W3C specificationarrow-up-right
Fully implemented
returns "foobarfoobar"
returns "foo-bar-foobar"
W3C specificationarrow-up-right
Fully implemented
returns "bar"
returns "ba"
W3C specificationarrow-up-right
Fully implemented
Returns the length of the supplied string, or 0 if the empty sequence is supplied.
returns 3.
returns 0.
###normalize-space W3C specificationarrow-up-right
Fully implemented
Normalization of spaces in a string.
returns "The wealthy curled darlings of our nation."
normalize-unicode
W3C specificationarrow-up-right
Fully implemented
Returns the value of the input after applying Unicode normalization.
returns the unicode-normalized version of the input string. Normalization forms NFC, NFD, NFKC, and NFKD are supported. "FULLY-NORMALIZED" though supported, should be used with caution as only the composition exclusion characters supported FULLY-NORMALIZED are which are uncommented in the following filearrow-up-right .
W3C specificationarrow-up-right
Fully implemented
returns "ABCD0"
W3C specificationarrow-up-right
Fully implemented
returns "abc!d"
W3C specificationarrow-up-right
Fully implemented
returns "BAr"
returns "AAA"
Functions based on substring matching
W3C specificationarrow-up-right
Fully implemented
returns true.
W3C specificationarrow-up-right
Fully implemented
returns true
W3C specificationarrow-up-right
Fully implemented
returns true.
substring-before
W3C specificationarrow-up-right
Fully implemented
returns "foo"
returns "f"
substring-after
W3C specificationarrow-up-right
Fully implemented
returns "bar"
returns ""
String functions that use regular expressions
W3C specificationarrow-up-right
Arity 2 implemented, arity 3 is not.
Regular expression matching. The semantics of regular expressions are those of Java's Pattern class.
returns true.
returns true.
W3C specificationarrow-up-right
Arity 3 implemented, arity 4 is not.
Regular expression matching and replacing. The semantics of regular expressions are those of Java's Pattern class.
returns "a*cada*"
returns "abbraccaddabbra"
W3C specificationarrow-up-right
Arity 2 implemented, arity 3 is not.
returns ("aa", "bb", "cc", "dd")
returns ("aa", "bb", "cc", "dd")
W3C specificationarrow-up-right
Not implemented
Functions that manipulate URIs
W3C specificationarrow-up-right
Fully implemented
returns http://www.examples.com/examples
W3C specificationarrow-up-right
Fully implemented
returns 100%25%20organic
W3C specificationarrow-up-right
Not implemented
escape-html-uri
W3C specificationarrow-up-right
Not implemented
Functions and operators on Boolean values
Boolean constant functions
W3C specificationarrow-up-right
Fully implemented
returns true
W3C specificationarrow-up-right
Fully implemented
returns false
W3C specificationarrow-up-right
Fully implemented
returns true
returns false
W3C specificationarrow-up-right
Fully implemented
returns false
returns true
Functions and operators on durations
Component extraction functions on durations
years-from-duration
W3C specificationarrow-up-right
Fully implemented
returns 2021.
months-from-duration
W3C specificationarrow-up-right
Fully implemented
returns 6.
days-from-duration
W3C specificationarrow-up-right
Fully implemented
returns 17.
hours-from-duration
W3C specificationarrow-up-right
Fully implemented
returns 12.
minutes-from-duration
W3C specificationarrow-up-right
Fully implemented
returns 35.
seconds-from-duration
W3C specificationarrow-up-right
Fully implemented
returns 30.
Functions and operators on dates and times
Constructing a DateTime
W3C specificationarrow-up-right
Fully implemented
returns 2004-04-12T13:20:00+14:00
Component extraction functions on dates and times
year-from-dateTime
W3C specificationarrow-up-right
Fully implemented
returns 2021.
month-from-dateTime
W3C specificationarrow-up-right
Fully implemented
returns 04.
day-from-dateTime
W3C specificationarrow-up-right
Fully implemented
returns 12.
hours-from-dateTime
W3C specificationarrow-up-right
Fully implemented
returns 13.
minutes-from-dateTime
W3C specificationarrow-up-right
Fully implemented
returns 20.
seconds-from-dateTime
W3C specificationarrow-up-right
Fully implemented
returns 32.
timezone-from-dateTime
W3C specificationarrow-up-right
Fully implemented
returns PT2H.
W3C specificationarrow-up-right
Fully implemented
returns 2021.
month-from-date
W3C specificationarrow-up-right
Fully implemented
returns 6.
W3C specificationarrow-up-right
Fully implemented
returns 4.
timezone-from-date
W3C specificationarrow-up-right
Fully implemented
returns -PT14H.
hours-from-time
W3C specificationarrow-up-right
Fully implemented
returns 13.
minutes-from-time
W3C specificationarrow-up-right
Fully implemented
returns 20.
seconds-from-time
W3C specificationarrow-up-right
Fully implemented
returns 32.123.
timezone-from-time
W3C specificationarrow-up-right
Fully implemented
returns PT2H.
Timezone adjustment functions on dates and time values
adjust-dateTime-to-timezone
W3C specificationarrow-up-right
Fully implemented
returns 2004-04-12T03:25:15+04:05.
adjust-date-to-timezone
W3C specificationarrow-up-right
Fully implemented
returns 2014-03-12+04:00.
adjust-time-to-timezone
W3C specificationarrow-up-right
Fully implemented
returns 04:20:00-14:00.
The functions in this section accept a simplified version of the picture string, in which a variable marker accepts only:
One of the following component specifiers: Y, M, d, D, F, H, m, s, P
A first presentation modifier, for which the value can be:
Nn, for all supported component specifiers, besides P
N, if the component specifier is P
a format token that indicates a numbering sequence of the the following form: '0001'
A second presentation modifier, for which the value can be t or c, which are also the default values
A width modifier, both minimum and maximum values
W3C specificationarrow-up-right
Fully implemented
returns 20-13-12-4-2004
W3C specificationarrow-up-right
Fully implemented
returns 12-4-2004
W3C specificationarrow-up-right
Fully implemented
returns 13-20-0
Not implemented
Functions and operators on sequences
General functions and operators on sequences
W3C specificationarrow-up-right
Fully implemented
Returns a boolean whether the input sequence is empty or not.
returns false.
W3C specificationarrow-up-right
Fully implemented
Returns a boolean whether the input sequence has at least one item or not.
returns true.
returns false.
This is pushed down to Spark and works on big sequences.
W3C specificationarrow-up-right
Fully implemented
Returns the first item of a sequence, or the empty sequence if it is empty.
returns 1.
returns ().
This is pushed down to Spark and works on big sequences.
W3C specificationarrow-up-right
Fully implemented
Returns all but the last item of a sequence, or the empty sequence if it is empty.
returns (2, 3, 4, 5).
returns ().
This is pushed down to Spark and works on big sequences.
W3C specificationarrow-up-right
Fully implemented
returns (1, 2, 3, 4, 5).
W3C specificationarrow-up-right
Fully implemented
returns (1, 2).
W3C specificationarrow-up-right
Fully implemented
returns (3, 2, 1).
W3C specificationarrow-up-right
Fully implemented
returns (2, 3).
W3C specificationarrow-up-right
Fully implemented
returns (1, 2, 3).
Functions that compare values in sequences
distinct-values
W3C specificationarrow-up-right
Fully implemented
Eliminates duplicates from a sequence of atomic items.
returns (1, 4, 3, "foo", true, 5).
This is pushed down to Spark and works on big sequences.
W3C specificationarrow-up-right
Fully implemented
returns 3.
returns "".
W3C specificationarrow-up-right
Fully implemented
returns true.
returns false.
Functions that test the cardinality of sequences
W3C specificationarrow-up-right
Fully implemented
returns "a".
returns an error.
W3C specificationarrow-up-right
Fully implemented
returns "a".
returns an error.
W3C specificationarrow-up-right
Fully implemented
returns "a".
returns an error.
Aggregate functions
W3C specificationarrow-up-right
Fully implemented
returns 4.
Count calls are pushed down to Spark, so this works on billions of items as well:
W3C specificationarrow-up-right
Fully implemented
returns 2.5.
Avg calls are pushed down to Spark, so this works on billions of items as well:
W3C specificationarrow-up-right
Fully implemented
returns 4.
returns (1, 2, 3).
Max calls are pushed down to Spark, so this works on billions of items as well:
W3C specificationarrow-up-right
Fully implemented
returns 1.
returns (1, 2, 3).
Min calls are pushed down to Spark, so this works on billions of items as well:
W3C specificationarrow-up-right
Fully implemented
returns 10.
Sum calls are pushed down to Spark, so this works on billions of items as well:
W3C specificationarrow-up-right
Fully implemented
Returns the corresponding document node
W3C specificationarrow-up-right
Not implemented
Parsing and serializing
W3C specificationarrow-up-right
Fully implemented
Serializes the supplied input sequence, returning the serialized representation of the sequence as a string
returns { "hello" : "world" }
Context Functions
W3C specificationarrow-up-right
Fully implemented
returns 5
W3C specificationarrow-up-right
Fully implemented
returns 10
returns 10
current-dateTime
W3C specificationarrow-up-right
Fully implemented
returns 2020-02-26T11:22:48.423+01:00
W3C specificationarrow-up-right
Fully implemented
returns 2020-02-26Europe/Zurich
W3C specificationarrow-up-right
Fully implemented
returns 11:24:10.064+01:00
implicit-timezone
W3C specificationarrow-up-right
Fully implemented
returns PT1H.
default-collation
W3C specificationarrow-up-right
Fully implemented
returns http://www.w3.org/2005/xpath-functions/collation/codepoint.
High order functions
Functions on functions
function-lookup
W3C specificationarrow-up-right
Not implemented
W3C specificationarrow-up-right
Not implemented
W3C specificationarrow-up-right
Not implemented
Basic higher-order functions
W3C specificationarrow-up-right
Not implemented
W3C specificationarrow-up-right
Not implemented
W3C specificationarrow-up-right
Not implemented
W3C specificationarrow-up-right
Not implemented
W3C specificationarrow-up-right
Not implemented
JSONiq functions
JSONiq specificationarrow-up-right
Fully implemented
returns ("foo", "bar"). Also works on an input sequence, eliminating duplicates
Keys calls are pushed down to Spark, so this works on billions of items as well:
JSONiq specificationarrow-up-right
Fully implemented
This function returns the members as an array, but not recursively, i.e., nested arrays are not unboxed.
Returns the first 100 integers as a sequence. Also works on an input sequence, in a distributive way.
JSONiq specificationarrow-up-right
Fully implemented
Returns a JSON null (also available as the literal null).
JSONiq specificationarrow-up-right
Fully implemented
JSONiq specificationarrow-up-right
Fully implemented
returns 100. Also works if the empty sequence is supplied, in which case it returns the empty sequence.
JSONiq specificationarrow-up-right
Fully implemented
returns
descendant-arrays
JSONiq specificationarrow-up-right
Fully implemented
returns
descendant-objects
JSONiq specificationarrow-up-right
Fully implemented
returns
descendant-pairs
JSONiq specificationarrow-up-right
Fully implemented
returns
JSONiq specificationarrow-up-right
Fully implemented
Unboxes arrays recursively, stopping the recursion when any other item is reached (object or atomic). Also works on an input sequence, in a distributive way.
Returns (1, 2, 3, 4, 5, 6, 7, 8, 9).
JSONiq specificationarrow-up-right
Fully implemented
returns
JSONiq specificationarrow-up-right
Fully implemented
returns the object {"foo" : "bar", "bar" : "foobar"}. Also works on an input sequence, in a distributive way.
JSONiq specificationarrow-up-right
Fully implemented
returns the object {"foobar" : "foo"}. Also works on an input sequence, in a distributive way.
JSONiq specificationarrow-up-right
Fully implemented
returns ("bar", "foobar"). Also works on an input sequence, in a distributive way.
Values calls are pushed down to Spark, so this works on billions of items as well:
encode-for-roundtrip
JSONiq specificationarrow-up-right
Not implemented
decode-from-roundtrip
JSONiq specificationarrow-up-right
Not implemented
returns the (unique) JSON value parsed from a local JSON (but not necessarily JSON Lines) file where this value may be spread over multiple lines.