Exhibit/API/2.2.0/Expression Language

From SIMILE Widgets
Jump to: navigation, search

Contents

Expression Language

It would be helpful to augment the controls and functions sections with examples.

Path Construction

Use a . to indicate a forward path, use a ! to indicate a backward path.

Controls

  • if - given a condition argument evaluates to true, execute the next argument, otherwise execute the last argument.
  • foreach - for each matching path in the first argument, execute the next argument.
  • default - loop through each path argument until one evaluates to a non-empty set, discarding the rest.
  • filter - evaluate the first argument and keep as results only those that are also results of evaluating the second argument.

See API documentation for expression controls.

Functions

  • union - build a set-wise union from evaluating all arguments, returning an expression collection
  • contains - true if the first argument contains each member of the second argument
  • exists - true if the first argument evaluates to something that exists in the graph
  • count - return the number of members in evaluating the first argument
  • not - boolean opposite of the first argument
  • and - for each argument, do a boolean and, true if all arguments are true
  • or - for each argument, do a boolean or, true if one argument is true
  • add - for each argument, sum all members, and sum the result for all arguments, returning the ultimate sum
  • concat - for each argument, string concatenate values in the order given, returning the ultimate string
  • multiply - like add, with multiplication
  • date-range - calculate the difference between the first and second date arguments in the units provided by the third argument, returning the numeric difference
  • distance - depends on Google Maps. compute the distance between two GPoints, with arguments being the origin, the latitude of the other point, its longitude, the units to use, and the rounding precision to return, returning the numeric distance.
  • min - return the minimum of all the arguments
  • max - return the maximum of all the arguments
  • remove - remove all subsequent arguments from the set of evaluating the first argument
  • now - return the current date

See API documentation for native expression functions.

Operators

  • + - add two numbers to result in a number
  • - - subtract second number from first to result in a number
  • * - multiply two numbers to result in a number
  • / - divide first number by second to result in a number
  • = - test equality of two numbers to result in a boolean
  • <> - test inequality of two numbers to result in a boolean
  • >< - same as above
  • < - test if first number is less than second to result in a boolean
  • > - test if first number is greater than second to result in a boolean
  • <= - test if first number is less than or equal to second to result in a boolean
  • >= - test if first number is greater than or equal to second to result in a boolean
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox