New ACM paper, free-tier cloud, and open-source license

Value variables


Value variables are used in patterns with arithmetics or built-in functions to represent values in statements. Value variables are never persisted into a database and can be used only within the scope of a query or a rule.

To persist a value of a value variable, you can save it into a database by using an attribute type with a matching value type. Value variables can store a value of any value type supported by attributes.

Labels used for value variables can’t intersect with variables from concept variables To address a value variable in a query, use the variable’s label with a question mark as a prefix.


For this example, use a database with the IAM schema and sample data loaded.

To assign a value for a value variable, use the equal sign (=) operator:

Value variable example
?summ = ?a + $b + 5;

Value variables can be used in a data query to represent a value without a type bound.

Query example
$f isa file, has size-kb $kb;
?mb = $kb / 1024;
insert $f has size-mb ?mb;

For more examples, see the Arithmetic page.

Provide Feedback