value assignment
Value assignment doesn’t use any specific keyword, but it assigns a value to a concept variable that represents an attribute.
Syntax
The syntax of a value assignment statement includes:
-
concept variable
-
value
<concept-variable> <value>;
Behavior
TypeQL value assignment statements can be used only in a match clause or rule condition.
Since only attributes can have a value,
value assignment syntax implicitly bounds the concept variable to the attribute
type.
You can specify the type of the concept variable by bounding it explicitly with an
isa statement.
Usage in a match pattern
For this example, use a database with the IAM schema and sample data loaded.
For example, let’s find all attributes of any type in a database with the value equal to the Kevin Morrison
string:
match
$a "Kevin Morrison";
fetch $a;
See example output
{ "a": { "value": "Kevin Morrison", "type": { "label": "full-name", "root": "attribute", "value_type": "string" } } }
Usage in an insert pattern
For this example, use a database with the IAM schema and sample data loaded.
To explicitly insert an attribute, use a value assignment to set its value, and an isa statement to set its type:
insert
$a "Bob" isa full-name;