Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Commands are normally those statements that are send to Odysseus, e.g. to install a query or to configure a setting. Each command in Odysseus Script begins with a hash/number sign (#) followed by its name and by some parameters (if the command needs some parameters).

Code Block
language
languagejavascript
themeEclipse
javascriptlinenumberstrue
#COMMAND parameter1 parameter2

Normally, one command is executed for its own and has no impact to other commands. However, the #QUERY command needs current settings like the parser, which is set by the command #PARSERor the transformation configuration, which is set by the command #TRANSCFG. Thus, you should normally always begin with the follwing stub (assuming that you use PQL and the standard transformation configuration): Remark: #TRANSCFG is no longer needed for standard processing.

Code Block
Code Block
languagejavascript
themeEclipse
languagejavascript
linenumberstrue
#PARSER PQL
...

...

Comments mark lines that should be ignored by the parser. Useful for additional information for the reader. Comments are defined  by using three slashes per line. Currently, there is no way to comment multiple lines at once.

Code Block
languagejavascript
themeEclipse
languagejavascript
linenumberstrue
///this is ignored by the parser

...

Variables can be used to reuse certain values. Mostly, they are moved to the top of a file so that they become more clearly. A variable can be created by using #DEFINE and be removed by using #UNDEF. If a variable should be calculated out of other variables (or constants), #EVAL can be used. To access a varibale, the user has to write  ${....}. The existence of a variable (if it is created or not) can be checked with #IFDEF. The value of a variable can be printed by using #PRINT (into the console). The following example shows three variables: an integer called "currentid" that has the value "50", a variable named "path", which has the value "F:/odysseus/example/" and a calculated variable "maxid".

Code Block
languagecql
themeEclipselanguagecql
linenumberstrue
#DEFINE currentid 50
#DEFINE path F:/odysseus/example/
#EVAL maxid = currentid + 100
#RUNQUERY
SELECT * FROM example WHERE id >= ${currentid} AND id <= ${maxid}
#RUNQUERY
CREATE STREAM source (id Double, data STRING)
    WRAPPER 'GenericPush'
    PROTOCOL 'CSV'
    TRANSPORT 'File'
    DATAHANDLER 'Tuple'
    OPTIONS ( 'filename' '${path}input.csv')

...

Constants are special varibales that exists without defining them explicitly. For example, a default variable is NOW so that ${NOW} can be used to get the current time in milliseconds. This is might be useful if the time of the script execution is needed (e.g. for filenames). The following table shows an excerpt of currently available constants. Developers can add application-specific constants, if needed (see Additional constant variables).

SymbolValue
NOW

Current timestamp

WORKSPACE*The absolute path to the workspace
PROJECT*The project name
PROJECTPATH*The absolute path to the project
WORKSPACEPROJECT*The absolute path to the workspace extended by the project name
ROOT*The absolute path to the current file
OS.ARCHThe operating system architecture
OS.VERSIONThe operating system version
OS.NAMEThe operating system name
CPUThe amount of available processors
MEMThe total amount of memory
VM.NAMEThe name of the Java VM
VM.VENDORThe vendor of the Java VM
VM.VERSIONThe version of the Java VM

*Only available in Odysseus Studio

...