diff options
author | 2020-05-11 04:19:04 +0200 | |
---|---|---|
committer | 2020-05-11 04:19:04 +0200 | |
commit | 194220061c9e84fe8dd7328374b18b647bf4d886 (patch) | |
tree | fffd4b51fa535af7e2179715350313953bbb5718 /Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries | |
parent | Instead of Bigdecimals doubleValue are used in check (diff) | |
parent | Fix PLEDGE Case Study File (diff) | |
download | VIATRA-Generator-194220061c9e84fe8dd7328374b18b647bf4d886.tar.gz VIATRA-Generator-194220061c9e84fe8dd7328374b18b647bf4d886.tar.zst VIATRA-Generator-194220061c9e84fe8dd7328374b18b647bf4d886.zip |
Merge branch 'master' of https://github.com/viatra/VIATRA-Generator
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries')
3 files changed, 111 insertions, 14 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql index f736ec58..01cdf372 100644 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql | |||
@@ -285,29 +285,34 @@ pattern inv47(lur : Legal_Union_Record) { | |||
285 | Legal_Union_Record.start_year(lur, startY); | 285 | Legal_Union_Record.start_year(lur, startY); |
286 | neg find x_inv47(lur); | 286 | neg find x_inv47(lur); |
287 | check(startY >= endY); | 287 | check(startY >= endY); |
288 | } or { | ||
289 | Legal_Union_Record.end_year(lur, endY); | ||
290 | Legal_Union_Record.start_year(lur, startY); | ||
291 | check(endY!= -1); | ||
292 | check(startY >= endY); | ||
288 | } | 293 | } |
289 | pattern x_inv47(lur : Legal_Union_Record) { | 294 | pattern x_inv47(lur : Legal_Union_Record) { |
290 | Legal_Union_Record.separation_cause(lur, ::NONE); | 295 | Legal_Union_Record.separation_cause(lur, ::NONE); |
291 | Legal_Union_Record.end_year(lur, -1); | ||
292 | } | 296 | } |
293 | 297 | ||
294 | //inv48-attributes-handled by multiplicity | 298 | //inv48-attributes-handled by multiplicity |
295 | @Constraint(message = "inv48", severity = "error", key = {p}) | 299 | @Constraint(message = "inv48", severity = "error", key = {p}) |
296 | pattern inv48(p : Physical_Person) { | 300 | pattern inv48(p : Physical_Person) { |
297 | neg find x_inv48_notDis(p); | 301 | Physical_Person.disability_percentage(p, disPer); |
298 | neg find x_inv48_Dis(p); | 302 | check(disPer > 1.0); |
299 | } | 303 | } or { |
300 | pattern x_inv48_notDis(p : Physical_Person) { | 304 | Physical_Person.disability_percentage(p, disPer); |
301 | Physical_Person.disability_type(p, ::NONE); | 305 | check(disPer < 0.0); |
302 | Physical_Person.disability_percentage(p, 0.0); | 306 | } or { |
303 | } | 307 | Physical_Person.disability_type(p, ::NONE); |
304 | pattern x_inv48_Dis(p : Physical_Person) { | 308 | Physical_Person.disability_percentage(p, disPer); |
305 | neg find x_inv48_3(p); | 309 | check(disPer != 0.0); |
306 | Physical_Person.disability_percentage(p, disPer); | 310 | } or { |
307 | check(disPer > 0.0); | 311 | neg find x_inv48(p); |
308 | check(disPer <= 1.0); | 312 | Physical_Person.disability_percentage(p, disPer); |
313 | check(disPer == 0.0); | ||
309 | } | 314 | } |
310 | pattern x_inv48_3(p : Physical_Person) { | 315 | pattern x_inv48(p : Physical_Person) { |
311 | Physical_Person.disability_type(p, ::NONE); | 316 | Physical_Person.disability_type(p, ::NONE); |
312 | } | 317 | } |
313 | 318 | ||
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_short.vql b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_short.vql new file mode 100644 index 00000000..f11ef7b7 --- /dev/null +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_short.vql | |||
@@ -0,0 +1,51 @@ | |||
1 | package queries | ||
2 | |||
3 | import "http:///TaxCard.ecore" | ||
4 | |||
5 | //inv47-attributes-handled by multiplicity | ||
6 | //@Constraint(message = "inv47", severity = "error", key = {lur}) | ||
7 | //pattern inv47(lur : Legal_Union_Record) { | ||
8 | // Legal_Union_Record.end_year(lur, endY); | ||
9 | // Legal_Union_Record.start_year(lur, startY); | ||
10 | // neg find x_inv47(lur); | ||
11 | // check(startY >= endY); | ||
12 | //} or { | ||
13 | // Legal_Union_Record.end_year(lur, endY); | ||
14 | // Legal_Union_Record.start_year(lur, startY); | ||
15 | // check(endY!= -1); | ||
16 | // check(startY >= endY); | ||
17 | //} | ||
18 | //pattern x_inv47(lur : Legal_Union_Record) { | ||
19 | // Legal_Union_Record.separation_cause(lur, ::NONE); | ||
20 | //} | ||
21 | // | ||
22 | ////inv17-attribute-handled by multiplicity | ||
23 | //@Constraint(message = "inv17", severity = "error", key = {lur}) | ||
24 | //pattern inv17(lur : Legal_Union_Record) { | ||
25 | // Legal_Union_Record.start_year(lur, sy); | ||
26 | // check(sy < 1950); | ||
27 | //} or { | ||
28 | // Legal_Union_Record.start_year(lur, sy); | ||
29 | // check(sy > 2018); | ||
30 | //} | ||
31 | |||
32 | ////inv48-attributes-handled by multiplicity | ||
33 | @Constraint(message = "inv48", severity = "error", key = {p}) | ||
34 | pattern inv48(p : Physical_Person) { | ||
35 | Physical_Person.disability_percentage(p, disPer); | ||
36 | check(disPer > 1.0); | ||
37 | } or { | ||
38 | Physical_Person.disability_percentage(p, disPer); | ||
39 | check(disPer < 0.0); | ||
40 | } or { | ||
41 | Physical_Person.disability_type(p, ::NONE); | ||
42 | Physical_Person.disability_percentage(p, disPer); | ||
43 | check(disPer != 0.0); | ||
44 | } or { | ||
45 | neg find x_inv48(p); | ||
46 | Physical_Person.disability_percentage(p, disPer); | ||
47 | check(disPer == 0.0); | ||
48 | } | ||
49 | pattern x_inv48(p : Physical_Person) { | ||
50 | Physical_Person.disability_type(p, ::NONE); | ||
51 | } \ No newline at end of file | ||
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/familyTreeConstraints.vql b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/familyTreeConstraints.vql new file mode 100644 index 00000000..fdbac640 --- /dev/null +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/familyTreeConstraints.vql | |||
@@ -0,0 +1,41 @@ | |||
1 | package queries | ||
2 | |||
3 | import "http://www.example.org/familytree" | ||
4 | |||
5 | @Constraint(message="memberIsItsOwnParent", severity="error", key={m}) | ||
6 | pattern memberIsItsOwnParent(m: Member) = { | ||
7 | FamilyTree.members(_, m); | ||
8 | Member.parents(m, p); | ||
9 | m == p; | ||
10 | } | ||
11 | |||
12 | @Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2}) | ||
13 | pattern twoMembersHaveNoParent(m1:Member, m2:Member) = { | ||
14 | neg find memberHasParent(m1); | ||
15 | neg find memberHasParent(m2); | ||
16 | m1 != m2; | ||
17 | } | ||
18 | |||
19 | pattern memberHasParent(m: Member) = { | ||
20 | Member.parents(m, _); | ||
21 | } | ||
22 | |||
23 | @Constraint(message="negativeAge", severity="error",key={m}) | ||
24 | pattern negativeAge(m: Member) { | ||
25 | Member.age(m,mage); | ||
26 | check(mage<0); | ||
27 | } | ||
28 | |||
29 | @Constraint(message="parentTooYoung", severity="error", key={c, p}) | ||
30 | pattern parentTooYoung(c: Member, p: Member) = { | ||
31 | FamilyTree.members(_, c); | ||
32 | Member.parents(c, p); | ||
33 | Member.age(c, cAge); | ||
34 | Member.age(p, pAge); | ||
35 | check (pAge <= (cAge + 12)); | ||
36 | } | ||
37 | |||
38 | |||
39 | |||
40 | |||
41 | |||