diff options
Diffstat (limited to 'subprojects/frontend/src/index.tsx')
-rw-r--r-- | subprojects/frontend/src/index.tsx | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/subprojects/frontend/src/index.tsx b/subprojects/frontend/src/index.tsx index 3e56d941..29b2b196 100644 --- a/subprojects/frontend/src/index.tsx +++ b/subprojects/frontend/src/index.tsx | |||
@@ -4,46 +4,40 @@ import { type Root, createRoot } from 'react-dom/client'; | |||
4 | import App from './App'; | 4 | import App from './App'; |
5 | import RootStore from './RootStore'; | 5 | import RootStore from './RootStore'; |
6 | 6 | ||
7 | const initialValue = `class Family { | 7 | const initialValue = `// Metamodel |
8 | contains Person[] members | ||
9 | } | ||
10 | |||
11 | class Person { | 8 | class Person { |
12 | Person[] children opposite parent | 9 | Person[] friend opposite friend |
13 | Person[0..1] parent opposite children | ||
14 | int age | ||
15 | TaxStatus taxStatus | ||
16 | } | 10 | } |
17 | 11 | ||
18 | enum TaxStatus { | 12 | class Post { |
19 | CHILD, STUDENT, ADULT, RETIRED | 13 | Person author |
14 | Post[0..1] replyTo | ||
20 | } | 15 | } |
21 | 16 | ||
22 | % A child cannot have any dependents. | 17 | // Constraints |
23 | pred invalidTaxStatus(Person p) <-> | 18 | error replyToNotFriend(Post x, Post y) <-> |
24 | taxStatus(p, CHILD), | 19 | replyTo(x, y), |
25 | children(p, _q) | 20 | author(x, xAuthor), |
26 | ; | 21 | author(y, yAuthor), |
27 | parent(p, q), | 22 | !friend(xAuthor, yAuthor). |
28 | age(q) < age(p) | 23 | |
29 | ; | 24 | error replyToCycle(Post x) <-> replyTo+(x,x). |
30 | taxStatus(p, RETIRED), | 25 | |
31 | parent(p, q), | 26 | // Instance model |
32 | !taxStatus(q, RETIRED). | 27 | Person(a). |
33 | 28 | Person(b). | |
34 | indiv family. | 29 | friend(a, b). |
35 | Family(family). | 30 | friend(b, a). |
36 | members(family, anne). | 31 | Post(p1). |
37 | members(family, bob). | 32 | author(p1, a). |
38 | members(family, ciri). | 33 | Post(p2). |
39 | children(anne, ciri). | 34 | author(p2, b). |
40 | ?children(bob, ciri). | 35 | replyTo(p2, p1). |
41 | default children(ciri, *): false. | 36 | |
42 | taxStatus(anne, ADULT). | 37 | !author(Post::new, a). // Automatically inferred: author(Post::new, b). |
43 | age(bob): 21..35. | 38 | |
44 | age(ciri): 10. | 39 | // Scope |
45 | 40 | scope Post = 10..15, Person += 0. | |
46 | scope Family = 1, Person += 5..10. | ||
47 | `; | 41 | `; |
48 | 42 | ||
49 | configure({ | 43 | configure({ |