T
TypeDB2mo ago
kenho811

< Why cannot I update a value directly

< Why cannot I update a value directly? >
2 Replies
kenho811
kenho811OP2mo ago
Got this typeQL to update the ipo-date of a company
match $n isa company, has ipo-date $p;
$p == 2025-01-01;
update $p == 2000-01-01;
match $n isa company, has ipo-date $p;
$p == 2025-01-01;
update $p == 2000-01-01;
But got error.
[TQL0] [TQL03] TypeQL Error: There is a syntax error

parsing error: expected thing_constraint or relation

Near 3:10:

match $n isa company, has ipo-date $p;

$p == 2025-01-01;

--> update $p == 2000-01-01;

^

Caused: Error in usage of TypeQL.

[TSV7] Query parsing failed.

[HSR16] Transaction error.
[TQL0] [TQL03] TypeQL Error: There is a syntax error

parsing error: expected thing_constraint or relation

Near 3:10:

match $n isa company, has ipo-date $p;

$p == 2025-01-01;

--> update $p == 2000-01-01;

^

Caused: Error in usage of TypeQL.

[TSV7] Query parsing failed.

[HSR16] Transaction error.
================ But then this works.
match $n isa company, has ipo-date 2025-01-01;
update $n has ipo-date 2000-01-01;
match $n isa company, has ipo-date 2025-01-01;
update $n has ipo-date 2000-01-01;
Why cannot I use the $p to denote the value and update $p ?
No description
krishnan
krishnan2mo ago
Put simply: Attributes are immutable The way you did it at the end is the right way

Did you find this page helpful?