Views, Packages, and Tables

Views

Views are created in RAW using one of the available client APIs. For instance, to create a view using the command-line tool:

$ rawcli views-create view1 "1+2"

Once the view is created, it can be referenced by name.

Example:

view1 * 2 // Result is 6

Packages

Packages are created in RAW using one of the available client APIs. For instance, to create a package using the command-line tool:

$ rawcli packages-create package1
f(v: int) := "v times two is " + (v * 2);

Once the package is created, it can be imported and used in a query.

Example:

from package1 import f;
f(1) // Result is: "v times two is 2"

Packages can contain multiple top-level function definitions, and, optionally, a top-level expression.

$ rawcli packages-create package2
times2(v: int) := v * 2;
times4(v: int) := v * 4;
"hello!"

This package contains two top-level functions (times2 and times4) and a top-level expression (the string “hello!”). To import one of the functions in the package use the from <package name> import <function name> and then refer to <function name> in the query. To import the top-level expression, use import <package name> and then refer to <package name> in the query.

Example:

from package2 import times2, times4;
import package2;
(package2, times2(2), times4(2)) // Result is: ("hello!", 4, 8)

Tables

Attention

Tables are an evolving feature in RAW. Contact us for early access documentation.