| bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
|||||||
| e-docs > Liquid Data for WebLogic > Building Queries and Data Views > Functions Reference |
|
Building Queries and Data Views
|
Functions Reference
The World Wide Web (W3C) specification for XQuery supports a discrete set of functions. BEA Liquid Data for WebLogicTM supports a subset of those functions as built-in functions. The Liquid Data built-in functions are accessible in the Data View Builder from Builder Toolbar—>Toolbox tab—>Functions panel. (See also Functions in Starting the Builder and Touring the GUI.)
For more information on the functions described here, see also:
This section provides a complete reference of the W3C functions supported in Liquid Data. This functions reference is organized by category as follows:
Data Types
Every data element or variable has a data type. Function parameters have data type requirements and the function result is returned as a data type. The following table describes other data types that conform to the XQuery specification. Current compliance with the W3C XQuery specification extends to XQuery 1.0 and XPath 2.0 Functions and Operators specification dated 30 April 2002. Another helpful reference is XML Schema Part 2: Datatypes.
Naming Conventions The xf: prefix is a W3C XML naming convention, also known as a namespace. Liquid Data supports extended functions that are enhancements to the XQuery specification, which you can recognize by their extended function prefix xfext:. For example, the full XQuery notation for an extended function is xfext:function_name. Extended functions accept standard input types, but they are limited to single values. Liquid Data also supports extensions to XQuery data types that are designated with xsext:datatype notation. When you encounter the xsext: prefix, it means that the data type may have Liquid Data-imposed restrictions that are necessary to interface successfully with the Liquid Data Server. The xfext: prefix identifies an extended function. The prefix identifies the type of function to you but the Data View Builder does not recognize or process the prefix.
Occurrence Indicators
An occurrence indicator indicates the number of items in a sequence. This notation usually appears on a parent node in a schema. Use these identifiers to determine the repeatability of a node.
These occurrence indicators also communicate information about the data type when they appear in a function signature. For example:
Accessor Functions
Accessor functions operate on different types of nodes. They accept single node input and return a value based on the node type.
Aggregate Functions
Aggregate functions process a sequence as argument and return a single value computed from values in the sequence. Except for the Count function, if the sequence contains nodes, the function extracts the value from the node and uses it in the computation.
Note: In the Data View Builder, you cannot drag and drop aggregate functions to the work area. You must double-click on them to open them so that you can select input parameters.
Boolean Functions
Boolean functions return true or false values.
Constructor Functions
Constructor functions process a source value as the argument. Every data element or variable has a data type. The data type determines the value that any function parameter can contain and the operations that can be performed on it. The Liquid Data supports the following type casting functions.
DateTime Functions
DateTime functions extract all or part of a dateTime expression and use it in a query.
xf:add-days
Data Types
Description
Adds the number of days specified by Parameter2 to the date specified by Parameter1. The value of Parameter2 may be negative.
Notes
If Parameter1 has a timezone, it remains unchanged. The returned value is always normalized into a correct Gregorian calendar date. If either parameter is an empty list, the function returns an empty list.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xf:current-dateTime
Data Types
No parameters required.
Returned data type: xs:dateTime
Description
Returns the current date and time.
Notes
The function returns the current date and time in the current timezone.
If the function is called multiple times during the execution of a query, it returns the same value each time.
XQuery Specification Compliance
Liquid Data returns the time zone where the Liquid Data Server is running.
Example
xf:current-dateTime() can return a dateTime value such as 2002-07-25T01:00:38.812-08:00, which represents July 25th, 2002 at 1:00:38 and 812 thousandths of a second in a time zone that is offset by -8 hours from GMT (UTC).
xf:date
Data Types
Description
Returns a date from a source value, which must contain a date in one of these formats:
where the following is true:
Notes
The representation for date is the leftmost representation for dateTime: YYYY-MM-DD+hh:mm with an optional following time zone indicator (Z).
Liquid Data supports this year range: 0000-9999.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xfext:date-from-dateTime
Data Types
Description
Returns the leftmost date portion of a dateTime value.
Notes
This is an extended function. It has an xfext: prefix identifier (namespace), which is the extension to the standard XQuery function namespace (xf:). For more information about extended functions, see Naming Conventions. For more information about valid formats for dateTime, see xf:dateTime.
XQuery Specification Compliance
Liquid Data supports date-from-dateTime as an extended function.
Examples
xfext:date-from-string-with-format
Data Types
Description
Returns the right-most date portion of a dateTime value according to the pattern specified by Parameter1. For more information, see Date and Time Patterns.
Notes
This is an extended function. It has an xfext: prefix identifier (namespace), which is the extension to the standard XQuery function namespace (xf:). For more information about extended functions, see Naming Conventions.
XQuery Specification Compliance
Liquid Data supports date-from-string-with-format as an extended function.
Examples
xf:dateTime
Data Types
Description
Returns a dateTime value from a source value, which must contain a date and time in one of these formats:
where the following is true:
Notes
Returns a date and time in YYYY-MM-DDT+hh:mm:ss format.
This expression can be preceded by an optional leading minus (-) sign to indicate a negative number. If the sign is omitted, positive (+) is assumed.
Use additional digits to increase the precision of fractional seconds if desired. The format ss.ss... with any number of digits after the decimal point is supported. Fractional seconds are optional.
Liquid Data supports this year range: 0000-9999.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xfext:dateTime-from-string-with-format
Data Types
Description
Returns a new dateTime value from a string source value according to the pattern specified by Parameter1.
Notes
This is an extended function. It has an xfext: prefix identifier (namespace), which is the extension to the standard XQuery function namespace (xf:).
For more information about extended functions, see Naming Conventions, and see Date and Time Patterns.
XQuery Specification Compliance
Liquid Data supports dateTime-from-string-with-format as an extended function.
Examples
xf:get-hours-from-dateTime
Data Types
Description
Returns an integer value representing the hour identified in dateTime.
Notes
The hour value ranges from 0 to 23.
If the source value is an empty list, the function returns an empty list.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xf:get-hours-from-time
Data Types
Description
Returns an integer representing the hour identified in time.
Notes
The hour value ranges from 0 to 23, inclusive.
If the source value is an empty list, the function returns an empty list.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xf:get-minutes-from-dateTime
Data Types
Description
Returns an integer value representing the minutes identified in dateTime.
Notes
Returns an integer value representing the minute identified in the source value. The minute value ranges from 0 to 59, inclusive.
If the source value is an empty list, the function returns the empty list.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xf:get-minutes-from-time
Data Types
Description
Returns an integer value representing the minutes identified in time.
Notes
The minute value ranges from 0 to 59.
If the source value is an empty list, the function returns an empty list.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xf:get-seconds-from-dateTime
Data Types
Description
Returns an integer value representing the seconds identified in dateTime.
Notes
The seconds value ranges from 0 to 60.999. The precision (number of digits) of fractional seconds depends on the relevant facet of the argument.
The value can be greater than 60 seconds to accommodate occasional leap seconds used to keep human time synchronized with the rotation of the planet.
If the source value is an empty list, the function returns an empty list.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xf:get-seconds-from-time
Data Types:
Description
Returns an integer value representing the seconds identified in time.
Notes
The seconds value ranges from 0 to 60.999. The precision (number of digits) of fractional seconds depends on the relevant facet of the argument.
The value can be greater than 60 seconds to accommodate occasional leap seconds used to keep human time synchronized with the rotation of the planet.
If the source value is an empty list, the function returns an empty list.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xf:time
Data Types
Description
Returns a tine from a source value, which must contain the time in one of these formats:
where the following is true:
Notes
Liquid Data generates an error if it cannot parse the string successfully.
XQuery Specification Compliance
Conforms to the current specification.
Examples
xfext:time-from-dateTime
Data Types
Description
Returns the time from dateTime.
Notes
This is an extended function. It has an xfext: prefix identifier (namespace), which is the extension to the standard XQuery function namespace (xf:). For more information about extended functions, see Naming Conventions. For more information about valid formats for dateTime, see xf:dateTime.
XQuery Specification Compliance
Liquid Data supports time-from-dateTime as an extended function.
Examples
xfext:time-from-string-with-format
Data Types
Description
Returns a new time value from a string source value according to the pattern specified by Parameter1.
Notes
This is an extended function. It has an xfext: prefix identifier (namespace), which is the extension to the standard XQuery function namespace (xf:).
For more information about extended functions, see Naming Conventions, and see Date and Time Patterns.
XQuery Specification Compliance
Liquid Data supports time-from-string-with-format as an extended function.
Examples
Date and Time Patterns
You can construct date and time patterns using standard Java class symbols. The following table shows the pattern symbols you can use.
Repeat each symbol to match the maximum number of characters required to represent the actual value. For example, to represent 4 July 2002, the pattern is d MMMM yyyy. To represent 12:43 PM, the pattern is hh:mm a.
Node Functions
Node functions are operations on nodes and node values.
Numeric Functions
Numeric functions operate on numeric data types.
Comparison and Numeric Operators
XQuery has operators that are specific to types of operations, such as comparisons or numeric operations.
Other Functions
Sequence Functions
A sequence is an ordered collection of zero or more items. An item may be a node or a simple typed value. Therefore, a sequence can be an ordered collection of nodes, a collection of simple typed values, or any mix of nodes and simple typed values. Sequences may not contain other sequences but may contain duplicate items. There is no difference between a single item, such as a node or a simple typed value, and a sequence containing that single item.
String Functions Strings from a character set may need to be sorted differently for different applications. You must consider the sort order when you invoke string comparisons. Some string functions will require understanding of the default sort order and any other special collation. For more information, see the Character Model for the World Wide Web 1.0.
Type Casting Functions
Type cast functions process a source value as the argument. Type casting will typically fail if applied to more than one element. An empty list is allowed, but the result of the type casting will consist of an empty list. Type casting functions are more likely to generate exceptions at run time if the parameter cannot be converted to the corresponding type.
The following table describes Liquid Data data types that conform to the XQuery specification that you can use in type casting functions. For more information about data types, see the XQuery 1.0 and XPath 2.0 Functions and Operators specification.
|
|
|