-
Notifications
You must be signed in to change notification settings - Fork 72
Fix Academy errors #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 3.x-development
Are you sure you want to change the base?
Fix Academy errors #999
Changes from 2 commits
618b866
0f30133
e31c773
de40801
552d97d
68c1584
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,9 +146,10 @@ So far, the Insert queries we've seen have only created entirely new entities, r | |
| [,typeql] | ||
| ---- | ||
| match | ||
| $book isa book, has isbn-13 "9780486282114"; | ||
| $stock isa stock; | ||
| $frankenstein isa book, has $stock, has isbn "9780486282114"; | ||
| insert | ||
| $book has stock 20; | ||
| $frankenstein has stock 20; | ||
| ---- | ||
| __-> Commit__ | ||
|
|
||
|
|
@@ -210,10 +211,12 @@ put $book isa book, has isbn "0195153448"; | |
| ---- | ||
|
|
||
| A put is equivalent to doing: | ||
|
|
||
| [,typeql] | ||
| ---- | ||
| match not { <pattern> }; | ||
| insert <pattern>; | ||
| ---- | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This missing delimiter is causing quite a considerable rendering problem on the site. |
||
|
|
||
| **It's highly recommended use `put` with a `key`-ed attributes**. This will prevent duplicates from emerging during concurrent transactions, as one will be forced to fail. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ In addition to being more efficient and easier for readers to interpret, these q | |
| ---- | ||
| match | ||
| $book isa book, has $art; | ||
| $art "art" isa genre; | ||
| $art isa genre "art"; | ||
| delete | ||
| has $art of $book; | ||
| insert | ||
|
|
@@ -59,7 +59,7 @@ When updating an attribute ownership (or indeed, a role player in an existing re | |
| ---- | ||
| match | ||
| $book isa paperback, has isbn-10 "0060929790"; | ||
| update $book has stock 20; | ||
| update $book has stock 25; | ||
| ---- | ||
|
|
||
| The `update` clause will, for each statement written, set the new attribute to be the only attribute owned by the owner. In this example, for the specific paperback book, it sets the stock to 25, replacing any existing stock value. | ||
|
Comment on lines
+62
to
65
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dealer's choice whether to change the block or the descriptor, but they should match. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ insert | |
| locating ($us, $ga); | ||
| ---- | ||
|
|
||
| In this case, the query was invalid because TypeDB cannot infer the roles that `$us` and `$ga` should play, but there are many reasons a query can be invalid. Try running each of the following ones to see what happens. | ||
| In this case, the query was invalid because TypeDB cannot infer the roles that `$us` and `$ga` should play, but there are many reasons a query can be invalid. Try running (and committing) each of the following ones to see what happens. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The second query runs and only raises an error when you try to commit it. |
||
|
|
||
| [,typeql] | ||
| ---- | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is pointed out later in Data validation, the
ebookentity does not ownstock. Running this example as-is raises an error for this reason. So, I offer up this workaround; it's a little ugly but it runs.Whether this behaviour is intended or whether it is an issue with the type inference engine is beyond me!