Skip to content

Conversation

@dmitrii-ubskii
Copy link
Member

@dmitrii-ubskii dmitrii-ubskii commented Dec 4, 2025

What is the goal of this PR?

We add two more attributes to the bookstore schema to accommodate the new TypeDB tutorials.

What are the changes implemented in this PR?

  • Two new attributes on user: total-spending and loyalty-tier (limited to 0..5),
  • two new possible order states: invalid and pending,
  • use put queries in data loading where possible to improve readability,
  • formatting fixes.

relates order,
relates item,
owns quantity,
owns price;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these are shortening by combining multiple constraints on the same variable into one statement and replacing match not { ... }; insert ... with put.

Comment on lines 204 to +205
# user
match $city isa city; $city has name "San Francisco"; insert $user isa user; $user has id "u0001"; $user has name "Kevin Morrison"; $user has birth-date 1995-10-29; (location: $city, located: $user) isa locating;end;
match $city isa city, has name "San Francisco"; insert $user isa user, has id "u0001", has name "Kevin Morrison", has birth-date 1995-10-29, has total-spending 263.08, has loyalty-tier 1; (location: $city, located: $user) isa locating;end;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users gained two new attributes, total-spending and loyalty-tier.

attribute start-timestamp, value datetime;
attribute end-timestamp, value datetime;
attribute status, value string @regex("^(paid|dispatched|delivered|returned|canceled)$");
attribute status, value string @regex("^(invalid|pending|paid|dispatched|delivered|returned|canceled)$");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you wanna swap this to @values(...) for proper 3.x usage?

@dmitrii-ubskii dmitrii-ubskii merged commit aea225f into typedb:master Dec 5, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants