aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/index.tsx')
-rw-r--r--subprojects/frontend/src/index.tsx64
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';
4import App from './App'; 4import App from './App';
5import RootStore from './RootStore'; 5import RootStore from './RootStore';
6 6
7const initialValue = `class Family { 7const initialValue = `// Metamodel
8 contains Person[] members
9}
10
11class Person { 8class 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
18enum TaxStatus { 12class 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
23pred invalidTaxStatus(Person p) <-> 18error 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; 24error replyToCycle(Post x) <-> replyTo+(x,x).
30 taxStatus(p, RETIRED), 25
31 parent(p, q), 26// Instance model
32 !taxStatus(q, RETIRED). 27Person(a).
33 28Person(b).
34indiv family. 29friend(a, b).
35Family(family). 30friend(b, a).
36members(family, anne). 31Post(p1).
37members(family, bob). 32author(p1, a).
38members(family, ciri). 33Post(p2).
39children(anne, ciri). 34author(p2, b).
40?children(bob, ciri). 35replyTo(p2, p1).
41default children(ciri, *): false. 36
42taxStatus(anne, ADULT). 37!author(Post::new, a). // Automatically inferred: author(Post::new, b).
43age(bob): 21..35. 38
44age(ciri): 10. 39// Scope
45 40scope Post = 10..15, Person += 0.
46scope Family = 1, Person += 5..10.
47`; 41`;
48 42
49configure({ 43configure({