Skip to content

Commit 0833519

Browse files
Update TypeDB IAM to 3.x syntax & functions (#8)
## What is the goal of this PR? Updates the TypeDB IAM example to use the TypeDB 3.x syntax & functions. ## What are the changes implemented in this PR? * Updates schema * Updates functions * Updates data with the `end` keyword. * Updates comments & sample queries. --------- Co-authored-by: joshua <joshua@typedb.com>
1 parent f89a3fa commit 0833519

13 files changed

+747
-711
lines changed
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
# Identity and access management
22

3-
## Compatibility note
4-
5-
**This demo has not yet been updated to be compatible with TypeDB 3.0**
6-
73
## Introduction
84

95
In this demo, you'll learn how to use TypeDB as the database for an identity and access management system. We'll cover
106
some basic operations like listing the users in the system and see how queries can be simplified by taking advantage of
117
TypeDB's in-built type-inference and polymorphism, then move on to some more advanced examples that take advantage of
12-
rule-inference. We'll see how we can automate permission inheritance and enforce a dynamic segregation-of-duty policy at
8+
TypeQL functions. We'll see how we can automate permission inheritance and enforce a dynamic segregation-of-duty policy at
139
the schema level.
1410

1511
![Screenshot 2023-06-16 at 13 02 19](https://github.com/james-whiteside/typedb-examples/assets/117453030/f601ae73-1e43-455e-b7c1-226ce453967d)
@@ -19,36 +15,36 @@ the schema level.
1915
This demo assumes knowledge of:
2016

2117
- [General identity and access management concepts](https://en.wikipedia.org/wiki/Identity_management).
22-
- [TypeDB's transaction system](https://typedb.com/docs/typedb/2.x/development/connect.html).
23-
- [All basic TypeQL syntax elements](https://typedb.com/docs/typedb/2.x/dev/match.html).
24-
- [TypeDB Studio's interface](https://typedb.com/docs/clients/2.x/studio.html).
18+
- [TypeDB's transaction system](https://typedb.com/docs/manual/queries/transactions).
19+
- [All basic TypeQL syntax elements](https://typedb.com/docs/typeql/pipelines/).
20+
- [TypeDB Studio](https://studio.typedb.com).
2521

2622
## Getting started
2723

28-
Start your TypeDB server and open TypeDB Studio. Make sure you are on a `schema-write` transaction and run the following
24+
Start your TypeDB server and open TypeDB Studio. Make sure you are on a `schema` transaction and run the following
2925
TypeQL file:
3026

31-
```define-schema.tql```
27+
```schema.tql```
3228

33-
Then switch to a `data-write` transaction and run the following:
29+
Then switch to a `write` transaction and run the following:
3430

35-
```insert-data.tql```
31+
```data.tql```
3632

3733
Remember to click on the green tick after running each of these scripts to commit the changes to the database.
3834

3935
## Running the examples
4036

4137
To get started, try running the examples. They are intended to be run once each and in order, so be aware that running
42-
them more than once or out of order might generate data errors. If anything goes wrong, you can run the
43-
`insert-data.tql` script again to reset everything. All the examples use `data` sessions, but you'll have to switch
44-
between `read` and `write` transactions depending on the queries in the example, and remember to commit after writes.
38+
them more than once or out of order might generate data errors. If anything goes wrong, you can delete the dataabase &
39+
run the `setup-script.tqls` script again to reset everything. For the examples, you'll have to switch between
40+
`read` and `write` transactions depending on the queries in the example, and remember to commit after writes.
4541
Each example has an accompanying exercise. You can skip them out and all the examples will still run fine. Some are
46-
much harder than others! All the solutions are in the `solutions.tql` file.
42+
much harder than others! All the solutions are in the `exercise-solutions.tql` file.
4743

4844
## Next steps
4945

5046
Once you've tried the pre-written examples out, have a go at editing them or writing something yourself. The schema also
5147
has a lot of types that are not used in the example dataset, so try experimenting with those. Remember you can view the
5248
list of types in the Type Browser, or view the schema in the graph visualizer by running the query:
5349

54-
```match $t sub thing;```
50+
```match $t sub $s;```

use-cases/identity-and-access-management/insert-data.tql renamed to use-cases/identity-and-access-management/data.tql

Lines changed: 226 additions & 225 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)