aboutsummaryrefslogtreecommitdiffstats
path: root/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql
diff options
context:
space:
mode:
authorLibravatar ArenBabikian <aren.babikian@mail.mcgill.ca>2020-05-17 01:58:13 -0400
committerLibravatar ArenBabikian <aren.babikian@mail.mcgill.ca>2020-05-17 01:58:13 -0400
commit48871e1be75169e4e3768a7c0c47791e02c7e634 (patch)
treecfcd4e4fdc0dea4f4b0102a610459ed7509f47f8 /Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql
parentAdjust Taxation model. (diff)
downloadVIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.tar.gz
VIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.tar.zst
VIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.zip
update measurements setup. make archives.
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql')
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql356
1 files changed, 0 insertions, 356 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
deleted file mode 100644
index 03e6847d..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/queries/case_study_A.vql
+++ /dev/null
@@ -1,356 +0,0 @@
1package queries
2
3import "http:///TaxCard.ecore"
4
5//AttributeRemoved -> DF
6
7//inv1-External_Allowance.amount is a derived feature (TODOcheck)
8//inv2-Tax_Card.income.taxPayer.taxesDue is a derived feature (TODOcheck)
9
10//inv3-multiplicity adjusted
11@Constraint(message = "inv03", severity = "error", key = {dep})
12pattern inv03(dep : Dependent) {
13 find x_inv03_eligAll(dep);
14 neg find x_inv03_hasAll(dep);
15} or {
16 Dependent.birth_year(dep, by);
17 check(2018-by > 21);
18 Dependent.continued_studies(dep, false);
19 Dependent.allowances(dep, _);
20}
21pattern x_inv03_eligAll(dep : Dependent) {
22 Dependent.birth_year(dep, by);
23 check(2018-by <= 21);
24} or {
25 Dependent.continued_studies(dep, true);
26}
27pattern x_inv03_hasAll(dep : Dependent) {
28 Dependent.allowances(dep, _);
29}
30
31//inv5 - oclIsTypeOf - handled here
32@Constraint(message = "inv05", severity = "error", key = {inc})
33pattern inv05(inc : Income) {
34 //income_type: None
35 neg find x_inv08_noType(inc);
36 Income.details.worked_days(inc, wd);
37 check(wd != 0);
38} or {
39 //income_type: Not Employment_Income
40 Income.income_type(inc, type);
41 neg find x_inv08_notEI(type);
42 Income.details.worked_days(inc, wd);
43 check(wd != 0);
44} or {
45 //income_type: Employment Income
46 Income.income_type(inc, type);
47 Employment_Income(type);
48 find x_inv05_inRange(inc);
49}
50pattern x_inv05_inRange(inc : Income) {
51 Income.details.worked_days(inc, wd);
52 check(wd < 1);
53} or {
54 Income.details.worked_days(inc, wd);
55 check(wd > 25);
56}
57
58//inv6-Does not make sens, but directly from OCL
59//first part of or from definition of getAge()
60@Constraint(message = "inv06", severity = "error", key = {tp})
61pattern inv06(tp : Tax_Payer) {
62 Tax_Payer.dependents(tp, _);
63 Tax_Payer.birth_year(tp, TPBy);
64 check(2018 - TPBy > 2018-16);
65} or {
66 Tax_Payer.birth_year(tp, TPBy);
67 Tax_Payer.dependents(tp, dep);
68 Dependent.birth_year(dep, DepBy);
69 check(2018-DepBy <= 2018-TPBy-16);
70}
71
72//inv7-OrderedSet
73@Constraint(message = "inv07", severity = "error", key = {inc})
74pattern inv07(inc : Income) {
75 Income.details.distance(inc, d1);
76 Income.details.distance(inc, d2);
77 check(d1 != d2);//compare values
78}
79
80//user_complete_details-AttributeRemoved
81
82//inv8 - oclIsTypeOf - handled here
83@Constraint(message = "inv08", severity = "error", key = {inc})
84pattern inv08(inc : Income) {
85 //income_type: None
86 neg find x_inv08_noType(inc);
87 Income.details.distance(inc, dist);
88 check(dist != 0);
89} or {
90 //income_type: Not Employment_Income
91 Income.income_type(inc, type);
92 neg find x_inv08_notEI(type);
93 Income.details.distance(inc, dist);
94 check(dist != 0);
95} or {
96 //income_type: Employment Income
97 Income.income_type(inc, type);
98 Employment_Income(type);
99 find x_inv08_inRange(inc);
100}
101pattern x_inv08_notEI(type : Employment_Income) {
102 Employment_Income(type);
103}
104pattern x_inv08_noType(inc : Income) {
105 Income.income_type(inc, _);
106}
107pattern x_inv08_inRange(inc : Income) {
108 Income.details.distance(inc, dist);
109 check(dist < 0);
110} or {
111 Income.details.distance(inc, dist);
112 check(dist > 100);
113}
114//inv9-DerivedFeature
115
116//inv10-Ordered Sets
117@Constraint(message = "inv10", severity = "error", key = {inc})
118pattern inv10(inc : Income) {
119 Income.details.amount(inc, a1);
120 Income.details.amount(inc, a2);
121 check(a1 != a2);//compare values
122}
123
124//inv11-attributes-handled by multiplicity
125@Constraint(message = "inv11", severity = "error", key = {exp})
126pattern inv11(exp : Expense) {
127 find x_inv11_incOver100(exp);
128 find x_inv11_incNotOver100(exp);
129}
130pattern x_inv11_incOver100(exp : Expense) {
131 Expense.income.income_amount(exp, incVal);
132 check(incVal / 2 > 50);
133
134} or {
135 Expense.declared_amount(exp, decl);
136 check(decl != 50);
137}
138pattern x_inv11_incNotOver100(exp : Expense) {
139 Expense.income.income_amount(exp, incVal);
140 check(incVal / 2 <= 50);
141} or {
142 Expense.declared_amount(exp, decl);
143 check(decl < 50);
144} or {
145 Expense.income.income_amount(exp, incVal);
146 Expense.declared_amount(exp, decl);
147 check(decl > incVal/2);
148}
149
150//inv12
151//exists - handled logically
152@Constraint(message = "inv12", severity = "error", key = {tp})
153pattern inv12(tp : Tax_Payer) {
154 Tax_Payer.addresses(tp, hab_add);
155 Habitual_Address(hab_add);
156 neg find x_inv12_notZZ(hab_add);
157 Tax_Payer.incomes(tp, inc);
158 Local_Income(inc);
159 neg find x_inv12_notNonRes(tp);
160}
161pattern x_inv12_notNonRes(tp : Non_Resident_Tax_Payer) {
162 Non_Resident_Tax_Payer(tp);
163}
164pattern x_inv12_notZZ(hab_add : Habitual_Address) {
165 Address.country(hab_add, ::ZZ);
166}
167
168//inv13 - Added new containment rel Phys_Pers->Address
169//exists - handled logically
170@Constraint(message = "inv13", severity = "error", key = {tp})
171pattern inv13(tp : Tax_Payer) {
172 Tax_Payer.addresses(tp, hab_add);
173 Habitual_Address(hab_add);
174 Address.country(hab_add, ::ZZ);
175 neg find x_inv13(tp);
176}
177pattern x_inv13(tp : Resident_Tax_Payer) {
178 Resident_Tax_Payer(tp);
179}
180
181//inv14-MultiplicityChanged
182
183//inv15-Ordered Sets in assignment if block
184//ERROR if no household object
185//@Constraint(message = "inv15", severity = "error", key = {ea})
186//pattern inv15(ea : External_Allowance) {
187// neg find x_inv15(ea);
188//}
189//pattern x_inv15(ea : External_Allowance) {
190// External_Allowance.person(ea, child);
191// Household.children(h, child);//only one due to multiplicity
192// Household.parents.individual_A(h, iA);
193// Tax_Payer(iA);
194// External_Allowance.reciver(ea, iA);
195//} or {
196// External_Allowance.person(ea, child);
197// Household.children(h, child);//only one due to multiplicity
198// Household.parents.individual_B(h, iB);
199// Tax_Payer(iB);
200// External_Allowance.reciver(ea, iB);
201//}
202
203@Constraint(message = "inv15", severity = "error", key = {ea})
204pattern inv15(ea : External_Allowance) {
205 External_Allowance.person(ea, child);
206 Household.children(h, child);//only one due to multiplicity
207 External_Allowance.reciver(ea, i);
208 Tax_Payer(i);
209 neg find x_inv15(h, i);
210} or {
211 External_Allowance.reciver(ea, i);
212 Dependent(i);
213}
214
215pattern x_inv15(h : Household, i : Tax_Payer) {
216 Household.parents.individual_A(h, i);
217} or {
218 Household.parents.individual_B(h, i);
219}
220
221//inv16-Tax_Card.tax_card_type is a derived feature
222
223//inv17-attribute-handled by multiplicity
224@Constraint(message = "inv17", severity = "error", key = {lur})
225pattern inv17(lur : Legal_Union_Record) {
226 Legal_Union_Record.start_year(lur, sy);
227 check(sy < 1950);
228} or {
229 Legal_Union_Record.start_year(lur, sy);
230 check(sy > 2018);
231}
232
233//inv18-MultiplicityChecked
234//inv19-MultiplicityChecked
235
236//inv20-Useless constraint since both edges are containment (TODOCheck)
237//OclIsUndefined-Handled by multiplicity
238@Constraint(message = "inv20", severity = "error", key = {lur})
239pattern inv20(lur : Legal_Union_Record) {
240 Legal_Union_Record.individual_A(lur, iA);
241 Legal_Union_Record.individual_B(lur, iB);
242 iA == iB;
243}
244//inv21-MultiplicityChecked
245//inv22-MultiplicityChecked
246//inv23-MultiplicityChecked
247//inv24-MultiplicityChecked
248//inv25-MultiplicityChecked
249//inv26-MultiplicityChanged
250//inv27-dupOfInv24
251//inv28-dubOfInv23
252//inv29-MultiplicityChanged
253//inv30-AttributeRemoved
254//inv31-AttributeRemoved
255//inv32-AttributeRemoved
256
257//inv33-attribute-handled by multiplicity
258@Constraint(message = "inv33", severity = "error", key = {p})
259pattern inv33(p : Physical_Person) {
260 Physical_Person.birth_year(p, by);
261 check(2018-by < 0);
262} or {
263 Physical_Person.birth_year(p, by);
264 check(2018-by > 100);
265}
266
267//inv34-attribute-handled by multiplicity
268@Constraint(message = "inv34", severity = "error", key = {p})
269pattern inv34(p : Physical_Person) {
270 Physical_Person.birth_month(p, birthMonth);
271 check(birthMonth < 1);
272} or {
273 Physical_Person.birth_month(p, birthMonth);
274 check(birthMonth > 12);
275}
276
277//inv35-attribute-handled by multiplicity
278@Constraint(message = "inv35", severity = "error", key = {p})
279pattern inv35(p : Physical_Person) {
280 Physical_Person.birth_day(p, birthDay);
281 check(birthDay < 1);
282} or {
283 Physical_Person.birth_day(p, birthDay);
284 check(birthDay > 28);
285}
286
287//inv36-AttributeRemoved
288//inv37-AttributeRemoved
289//inv38-AttributeRemoved
290//inv39-AttributeRemoved
291//inv40-AttributeRemoved
292//inv41-AttributeRemoved
293//inv42-AttributeRemoved
294//inv43-AttributeRemoved
295//inv44-AttributeRemoved
296//inv45-AttributeRemoved
297//inv46-AttributeRemoved
298
299//inv47-attributes-handled by multiplicity
300@Constraint(message = "inv47", severity = "error", key = {lur})
301pattern inv47(lur : Legal_Union_Record) {
302 Legal_Union_Record.end_year(lur, endY);
303 Legal_Union_Record.start_year(lur, startY);
304 neg find x_inv47(lur);
305 check(startY >= endY);
306} or {
307 Legal_Union_Record.end_year(lur, endY);
308 Legal_Union_Record.start_year(lur, startY);
309 check(endY!= -1);
310 check(startY >= endY);
311}
312pattern x_inv47(lur : Legal_Union_Record) {
313 Legal_Union_Record.separation_cause(lur, ::NONE);
314}
315
316//inv48-attributes-handled by multiplicity
317@Constraint(message = "inv48", severity = "error", key = {p})
318pattern inv48(p : Physical_Person) {
319 Physical_Person.disability_percentage(p, disPer);
320 check(disPer > 1.0);
321} or {
322 Physical_Person.disability_percentage(p, disPer);
323 check(disPer < 0.0);
324} or {
325 Physical_Person.disability_type(p, ::NONE);
326 Physical_Person.disability_percentage(p, disPer);
327 check(disPer != 0.0);
328} or {
329 neg find x_inv48(p);
330 Physical_Person.disability_percentage(p, disPer);
331 check(disPer == 0.0);
332}
333pattern x_inv48(p : Physical_Person) {
334 Physical_Person.disability_type(p, ::NONE);
335}
336
337//inv49-OclKindOf-handled by multiplicity
338@Constraint(message = "inv49", severity = "error", key = {lur})
339pattern inv49_A(lur : Legal_Union_Record) {
340 Legal_Union_Record.individual_A(lur, i);
341 Legal_Union_Record.individual_B(lur, i);
342}
343//inv49-OclKindOf-handled by multiplicity
344@Constraint(message = "inv49", severity = "error", key = {lur})
345pattern inv49_B(lur : Legal_Union_Record) {
346 Legal_Union_Record.individual_A(lur, i);
347 Dependent(i);
348} or {
349 Legal_Union_Record.individual_B(lur, i);
350 Dependent(i);
351}
352
353//inv50-MultiplicityChecked
354//inv51-MultiplicityChecked
355//inv52-MultiplicityChecked
356//inv53-MultiplicityChecked \ No newline at end of file