-
Couldn't load subscription status.
- Fork 73
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 all 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; | ||
|
Comment on lines
148
to
+152
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. As is pointed out later in Data validation, the Whether this behaviour is intended or whether it is an issue with the type inference engine is beyond me! |
||
| ---- | ||
| __-> Commit__ | ||
|
|
||
|
|
@@ -210,10 +211,12 @@ put $book isa book, has isbn "0195153448"; | |
| ---- | ||
|
|
||
| A put is equivalent to doing: | ||
|
|
||
| [,typeql] | ||
| ---- | ||
| match not { <pattern> }; | ||
| insert <pattern>; | ||
| ---- | ||
|
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
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. | ||
|
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] | ||
| ---- | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,10 +45,12 @@ Learn about how types and functions are validated against the schema. | |
|
|
||
| == Running examples | ||
|
|
||
| // TODO: Add the database manager icon file. | ||
| The sample database already has the complete bookstore schema defined and data inserted. If you would like to try running the Define queries featured in the examples and exercises in this section, then you should do so using another database. To create a new database, use the *database manager* image:{page-version}@home::studio-icons/svg/studio_dbs.svg[width=24]. After creation, make sure to switch over to it using the *database selector*. For more information on how to manage databases using TypeDB Studio, refer back to xref:{page-version}@academy::2-environment-setup/2.2-using-typedb-studio.adoc[Lesson 2.2] | ||
|
|
||
| To run a Define query, make sure to use a *schema* session and *write* transaction. After running a Define query, you should see any committed changes to the schema reflected in the *type browser*. The examples and exercises featured in this lesson are annotated with one of the following instructions to indicate how they should be run. | ||
|
|
||
| // TODO: Fix the formatting here to follow the index of Chapter 4. | ||
|
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. See these TODOs |
||
| :: *Run* this query without committing the transaction afterward. Write transactions will remain open for further queries, and changes will not be persisted until a commit. | ||
| _-> Commit_:: *Run* this query and then *commit* the transaction, persisting the changes to the database. | ||
| image:{page-version}@home::studio-icons/svg/studio_fail.svg[width=24] *_Do not run_*:: Do not run this query, which is shown for information only. To rollback an open transaction, *close* it without committing. | ||
|
|
||
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.
Maybe this one is unfounded, but this is the first step in the Academy. In the chapter index, it says the first step will be setting up a TypeDB server, but we don't actually do that here.
Is there a step missing? Even pointing back to the installation instructions might be helpful.