diff --git a/academy/modules/ROOT/pages/2-environment-setup/2.1-sample-deployment.adoc b/academy/modules/ROOT/pages/2-environment-setup/2.1-sample-deployment.adoc index b7bceb28b..20cfd330b 100644 --- a/academy/modules/ROOT/pages/2-environment-setup/2.1-sample-deployment.adoc +++ b/academy/modules/ROOT/pages/2-environment-setup/2.1-sample-deployment.adoc @@ -10,6 +10,7 @@ TypeDB Cloud deployments let you deploy the latest version of the bookstore samp === Using TypeDB Console You can use xref:{page-version}@home::install/console-cli.adoc[TypeDB Console] (minimum version 3.5.0) to load the bookstore dataset from the `typedb-example` repository, published at https://github.com/typedb/typedb-examples/releases. +// TODO: Make this clearer. What address should one use? Is there a default username? How do you set these things up via the CLI? TypeDB Console ships with a 1-liner to create a database, and load a schema and data file from URL. To create and initialize a new database with the latest bookstore dataset, you can use: [,bash] diff --git a/academy/modules/ROOT/pages/2-environment-setup/index.adoc b/academy/modules/ROOT/pages/2-environment-setup/index.adoc index 284e2b87e..26ea2d951 100644 --- a/academy/modules/ROOT/pages/2-environment-setup/index.adoc +++ b/academy/modules/ROOT/pages/2-environment-setup/index.adoc @@ -10,6 +10,7 @@ In this lesson, we'll set up the environment needed to work through this course. == Lesson contents +// TODO: Add reference to Lesson 2.2 when it is written. [cols-2] -- .xref:{page-version}@academy::2-environment-setup/2.1-sample-deployment.adoc[] @@ -17,3 +18,4 @@ In this lesson, we'll set up the environment needed to work through this course. **** Deploy the sample database and install TypeDB Studio. **** +-- diff --git a/academy/modules/ROOT/pages/3-reading-data/3.1-fetching-simple-data.adoc b/academy/modules/ROOT/pages/3-reading-data/3.1-fetching-simple-data.adoc index eabfa1b91..0b6a3e09b 100644 --- a/academy/modules/ROOT/pages/3-reading-data/3.1-fetching-simple-data.adoc +++ b/academy/modules/ROOT/pages/3-reading-data/3.1-fetching-simple-data.adoc @@ -279,8 +279,8 @@ match $book isa paperback, has isbn-13 "9780446310789"; $line isa order-line (order: $order, item: $book); fetch { - "id": $order.id; - "quantity": $line.quantity; + "id": $order.id, + "quantity": $line.quantity }; ---- @@ -352,7 +352,7 @@ $book isa paperback, has isbn-13 "9780446310789"; $line isa order-line (order: $order, item: $book); delivery (deliverer: $courier, delivered: $order, destination: $address); fetch { - "id": $order.id; + "id": $order.id, "quantity": $line.quantity, "name": $courier.name, "street": $address.street diff --git a/academy/modules/ROOT/pages/3-reading-data/3.2-fetching-polymorphic-data.adoc b/academy/modules/ROOT/pages/3-reading-data/3.2-fetching-polymorphic-data.adoc index f64a6679a..ff33e4878 100644 --- a/academy/modules/ROOT/pages/3-reading-data/3.2-fetching-polymorphic-data.adoc +++ b/academy/modules/ROOT/pages/3-reading-data/3.2-fetching-polymorphic-data.adoc @@ -121,7 +121,7 @@ Write a query to retrieve _all_ ISBNs of _all_ books in the database. match $book isa book; fetch { - "isbn": $book.isbn + "isbn": [ $book.isbn ] }; ---- diff --git a/academy/modules/ROOT/pages/4-writing-data/4.1-inserting-simple-data.adoc b/academy/modules/ROOT/pages/4-writing-data/4.1-inserting-simple-data.adoc index b4c42c912..da56a174e 100644 --- a/academy/modules/ROOT/pages/4-writing-data/4.1-inserting-simple-data.adoc +++ b/academy/modules/ROOT/pages/4-writing-data/4.1-inserting-simple-data.adoc @@ -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 { }; insert ; +---- **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. diff --git a/academy/modules/ROOT/pages/4-writing-data/4.4-updating-data.adoc b/academy/modules/ROOT/pages/4-writing-data/4.4-updating-data.adoc index ad9801b4c..8c416c3c3 100644 --- a/academy/modules/ROOT/pages/4-writing-data/4.4-updating-data.adoc +++ b/academy/modules/ROOT/pages/4-writing-data/4.4-updating-data.adoc @@ -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. diff --git a/academy/modules/ROOT/pages/4-writing-data/4.5-data-validation.adoc b/academy/modules/ROOT/pages/4-writing-data/4.5-data-validation.adoc index 6c4136b86..177d532d2 100644 --- a/academy/modules/ROOT/pages/4-writing-data/4.5-data-validation.adoc +++ b/academy/modules/ROOT/pages/4-writing-data/4.5-data-validation.adoc @@ -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. [,typeql] ---- diff --git a/academy/modules/ROOT/pages/4-writing-data/index.adoc b/academy/modules/ROOT/pages/4-writing-data/index.adoc index dd6235c4a..2e185024b 100644 --- a/academy/modules/ROOT/pages/4-writing-data/index.adoc +++ b/academy/modules/ROOT/pages/4-writing-data/index.adoc @@ -45,13 +45,17 @@ Learn about how new data is validated against the schema. == Running examples +// TODO: Either remove the part about tagging or tag all the examples in this chapter. To run an Insert, Delete, or Update query, make sure to use a *data* session and *write* transaction. The examples and exercises featured in this lesson are annotated with one of the following instructions to indicate how they should be run. Each write query should only be run once. Running write queries more than once may have unintended effects, such as inserting duplicate data. +// TODO: Fix the formatting of this block. Should it be paragraphs or a listing? +// TODO: Add the images referred to in this block. :: *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. image:{page-version}@home::studio-icons/svg/studio_run.svg[width=24]image:{page-version}@home::studio-icons/svg/studio_check.svg[width=24] *_Run and 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. image:{page-version}@home::studio-icons/svg/studio_run.svg[width=24] *_Try running_*:: *Run* this query to see the error generated. +// TODO: Write this tutorial For information on how to control sessions, transactions, and queries using TypeDB Studio, refer back to xref:{page-version}@academy::2-environment-setup/2.2-using-typedb-studio.adoc[Lesson 2.2]. == TypeQL keywords introduced diff --git a/academy/modules/ROOT/pages/5-defining-schemas/5.4-defining-functions.adoc b/academy/modules/ROOT/pages/5-defining-schemas/5.4-defining-functions.adoc index a2ede6d1d..3ec7bc15a 100644 --- a/academy/modules/ROOT/pages/5-defining-schemas/5.4-defining-functions.adoc +++ b/academy/modules/ROOT/pages/5-defining-schemas/5.4-defining-functions.adoc @@ -29,7 +29,7 @@ fun transitive_places_new($place: place) -> { place }: return { $parent }; ---- -This function is a recursive function, returning a stream of places (as indicated in the function signature with `{}` and in the return with `{}) based on a match query. +This function is a recursive function, returning a stream of places (as indicated in the function signature with `{}` and in the return with `{}`) based on a match query. == Function return types diff --git a/academy/modules/ROOT/pages/5-defining-schemas/index.adoc b/academy/modules/ROOT/pages/5-defining-schemas/index.adoc index 7685d1721..50de13469 100644 --- a/academy/modules/ROOT/pages/5-defining-schemas/index.adoc +++ b/academy/modules/ROOT/pages/5-defining-schemas/index.adoc @@ -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. :: *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.