diff options
author | 2020-04-26 18:23:13 -0400 | |
---|---|---|
committer | 2020-04-26 18:23:13 -0400 | |
commit | c0a758eedd457a5d8eb9f1a6c17fc24143aabb3e (patch) | |
tree | 0c2e212e4e95c1d2311629128641d5cd561210f3 /Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/Constraints/CaseA_1.ocl | |
parent | Merge branch 'Attribute-Solver' (diff) | |
download | VIATRA-Generator-c0a758eedd457a5d8eb9f1a6c17fc24143aabb3e.tar.gz VIATRA-Generator-c0a758eedd457a5d8eb9f1a6c17fc24143aabb3e.tar.zst VIATRA-Generator-c0a758eedd457a5d8eb9f1a6c17fc24143aabb3e.zip |
Add PLEDGE case study files
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/Constraints/CaseA_1.ocl')
-rw-r--r-- | Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/Constraints/CaseA_1.ocl | 281 |
1 files changed, 281 insertions, 0 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/Constraints/CaseA_1.ocl b/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/Constraints/CaseA_1.ocl new file mode 100644 index 00000000..0dd083b5 --- /dev/null +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/Constraints/CaseA_1.ocl | |||
@@ -0,0 +1,281 @@ | |||
1 | import 'file:/Users/Aren Babikian/git/VIATRA-Attributes/original.PLEDGE.case.studies/model/CD_Case_A.uml' | ||
2 | --e.g., import 'file:/Users/User_X/CD_Case_A.uml' | ||
3 | |||
4 | package Taxation | ||
5 | |||
6 | |||
7 | context External_Allowance inv inv1: | ||
8 | let currentYear: Integer = 2018 in | ||
9 | let origin: Physical_Person = self.reciver in | ||
10 | let union:Legal_Union_Record=origin.getLegalUnionRecord(currentYear) in | ||
11 | let house: Household = if(not union.oclIsUndefined()) then union.household else invalid endif in | ||
12 | let children:Set(Dependent)= house.children->select(d:Dependent| d.allowances->select(ext| ext.reciver=origin)->size()>0) in | ||
13 | let eligible_children:Set(Dependent) = children->select( birth_year >=currentYear - 6) in | ||
14 | let is_disabled:Boolean = self.person.disability_type<>Disability_Types::NONE and self.person.disability_percentage>0.5 in | ||
15 | let age5:Integer = currentYear - self.person.birth_year in | ||
16 | let base:Real = if(age5>6 and eligible_children->size()<=1) then 185.60 else if(age5>6 and eligible_children->size()=2) then 220.36 else if(age5>6 and eligible_children->size()=2) then 267.59 else 361.83 endif endif endif in | ||
17 | |||
18 | if(age5<=6) then self.amount = 580 | ||
19 | else | ||
20 | if(age5>=6 and age5<=11)then | ||
21 | self.amount = ((base.toString().toReal() + 16.17).round()) | ||
22 | else | ||
23 | self.amount = base.round() | ||
24 | endif endif | ||
25 | |||
26 | context Tax_Card inv inv2: | ||
27 | let classe: Tax_Class_Category = self.income.taxPayer.getTaxClass(2018) in | ||
28 | let amount:Real = self.income.income_per_year() in | ||
29 | |||
30 | if(income.income_type.oclIsTypeOf(Employment_Income)) then | ||
31 | let a:Real = if(classe=Tax_Class_Category::One_A) then self.income.taxPayer.from_law.get_A_for_salary_class_1A(amount) else if(classe=Tax_Class_Category::Two) then self.income.taxPayer.from_law.get_A_for_salary_class_2(amount) else self.income.taxPayer.from_law.get_A_for_salary_class_1(amount) endif endif in | ||
32 | let b:Real = if(classe=Tax_Class_Category::One_A) then self.income.taxPayer.from_law.get_B_for_salary_class_1A(amount) else if(classe=Tax_Class_Category::Two) then self.income.taxPayer.from_law.get_B_for_salary_class_2(amount) else self.income.taxPayer.from_law.get_B_for_salary_class_1(amount) endif endif in | ||
33 | let res:Real = self.income.taxPayer.from_law.round_ten_cent(a * amount - b) in | ||
34 | let max:Real = if(classe=Tax_Class_Category::Two) then 25085 else 12585 endif in | ||
35 | |||
36 | if(amount<max) then | ||
37 | let final_res:Real= self.income.taxPayer.from_law.round_ten_cent(res*1.07) in | ||
38 | self.income.taxPayer.taxesDue = final_res.max(100000) | ||
39 | else | ||
40 | let adjustement:Real= if(classe=Tax_Class_Category::One_A) then 81.906 else if(classe=Tax_Class_Category::Two) then 165.74 else 82.87 endif endif in | ||
41 | let final_res:Real= self.income.taxPayer.from_law.round_ten_cent(res + (res*0.09-adjustement)) in | ||
42 | self.income.taxPayer.taxesDue = final_res.max(100000) | ||
43 | endif | ||
44 | |||
45 | else | ||
46 | if(income.income_type.oclIsTypeOf(Pensions_and_Annuities_Income)) then | ||
47 | let a:Real = if(classe=Tax_Class_Category::One_A) then self.income.taxPayer.from_law.get_A_for_pension_class_1A(amount) else if(classe=Tax_Class_Category::Two) then self.income.taxPayer.from_law.get_A_for_pension_class_2(amount) else self.income.taxPayer.from_law.get_A_for_pension_class_1(amount) endif endif in | ||
48 | let b:Real = if(classe=Tax_Class_Category::One_A) then self.income.taxPayer.from_law.get_B_for_pension_class_1A(amount) else if(classe=Tax_Class_Category::Two) then self.income.taxPayer.from_law.get_B_for_pension_class_2(amount) else self.income.taxPayer.from_law.get_B_for_pension_class_1(amount) endif endif in | ||
49 | let res:Real = self.income.taxPayer.from_law.round_ten_cent(a * amount - b) in | ||
50 | let max:Real = if(classe=Tax_Class_Category::Two) then 25065 else 12565 endif in | ||
51 | |||
52 | if(amount<max) then | ||
53 | let final_res:Real= self.income.taxPayer.from_law.round_ten_cent(res*1.07) in | ||
54 | self.income.taxPayer.taxesDue = final_res.max(100000) | ||
55 | else | ||
56 | let adjustement:Real= if(classe=Tax_Class_Category::One_A) then 81.906 else if(classe=Tax_Class_Category::Two) then 165.74 else 82.87 endif endif in | ||
57 | let final_res:Real= self.income.taxPayer.from_law.round_ten_cent(res + (res*0.09-adjustement)) in | ||
58 | self.income.taxPayer.taxesDue = final_res.max(100000) | ||
59 | endif | ||
60 | else | ||
61 | self.income.taxPayer.taxesDue = -1 | ||
62 | endif | ||
63 | endif | ||
64 | |||
65 | |||
66 | context Dependent inv inv3: | ||
67 | if((self.getAge(2018) <=21) or (self.continued_studies = true)) then | ||
68 | self.allowances->size()=1 | ||
69 | else | ||
70 | self.allowances->size()=0 | ||
71 | endif | ||
72 | |||
73 | context Income inv inv5: | ||
74 | if(not self.income_type.oclIsTypeOf(Employment_Income)) then | ||
75 | self.details->forAll(d|d.worked_days = 0) | ||
76 | else | ||
77 | self.details->forAll(d|d.worked_days >= 1 and d.worked_days<=25) | ||
78 | endif | ||
79 | |||
80 | context Tax_Payer inv inv6: | ||
81 | let val:Integer = self.getAge(2018) - 16 in | ||
82 | self.dependents->forAll( d:Dependent| d.getAge(2018) > val) | ||
83 | |||
84 | context Income inv inv7: | ||
85 | let val:Real =self.details->asOrderedSet()->first().distance in | ||
86 | self.details->forAll(d: Income_Detail|d.distance = val) | ||
87 | |||
88 | --context Income inv user_complete_details: | ||
89 | --self.details->forAll(d: Income_Detail|d.month = self.details->asOrderedSet()->indexOf(d)) | ||
90 | |||
91 | context Income inv inv8: | ||
92 | if(not self.income_type.oclIsTypeOf(Employment_Income)) then | ||
93 | self.details->forAll(d| d.distance = 0) | ||
94 | else | ||
95 | self.details->forAll(d| d.distance >= 0.0 and d.distance <= 100) | ||
96 | endif | ||
97 | |||
98 | --context Income inv inv9: | ||
99 | --if(self.income_type.oclIsTypeOf(Pensions_and_Annuities_Income)) then | ||
100 | --self.details->forAll(d| not d.is_contributing_pension) | ||
101 | --else | ||
102 | --self.details->forAll(d| d.is_contributing_pension) | ||
103 | --endif | ||
104 | |||
105 | context Income inv inv10: | ||
106 | let val:Real =self.details->asOrderedSet()->first().amount in | ||
107 | self.details->forAll(d: Income_Detail|d.amount = val) | ||
108 | |||
109 | |||
110 | |||
111 | context Expense inv inv11: | ||
112 | let max:Real = if((self.income.income_amount / 2)>50) then self.income.income_amount / 2 else 50 endif in | ||
113 | self.declared_amount >= 50 and self.declared_amount <= max | ||
114 | |||
115 | context Tax_Payer inv inv12: | ||
116 | self.addresses->exists( hab_add:Address | hab_add.oclIsTypeOf(Habitual_Address) = true and hab_add.country<>Country::ZZ) and | ||
117 | self.incomes->exists(inc | inc.oclIsTypeOf(Local_Income) = true) | ||
118 | implies | ||
119 | self.oclIsTypeOf(Non_Resident_Tax_Payer) | ||
120 | |||
121 | context Tax_Payer inv inv13: | ||
122 | self.addresses->exists( hab_add:Address | hab_add.oclIsTypeOf(Habitual_Address) = true and hab_add.country=Country::ZZ) | ||
123 | implies | ||
124 | self.oclIsTypeOf(Resident_Tax_Payer) | ||
125 | |||
126 | --context Tax_Payer inv inv14: | ||
127 | --self.dependents->size() >= 0 and self.dependents->size()<= 6 | ||
128 | |||
129 | context External_Allowance inv inv15: | ||
130 | let child:Dependent = self.person in | ||
131 | let h:Household = Household.allInstances()->select(children->includes(child))->asOrderedSet()->first() in | ||
132 | let t1:Set(Physical_Person) = Set{h.parents.individual_A,h.parents.individual_B}->select(oclIsKindOf(Tax_Payer)) in | ||
133 | if(t1->size()=1) then | ||
134 | self.reciver = t1->asOrderedSet()->first() | ||
135 | else | ||
136 | self.reciver = t1->asOrderedSet()->at(2) or self.reciver = t1->asOrderedSet()->at(1) | ||
137 | endif | ||
138 | |||
139 | context Tax_Card inv inv16: | ||
140 | if(self.income.taxPayer.incomes->size()=1) then | ||
141 | self.tax_card_type=Tax_Card_Type::Principal | ||
142 | else | ||
143 | let all_incomes:OrderedSet(Income)=self.income.taxPayer.incomes->select(inc:Income| inc.income_amount= self.income.taxPayer.incomes.income_amount->max())->asOrderedSet() in | ||
144 | let bigest_income:Income= all_incomes->first() in | ||
145 | if(bigest_income=self.income) then | ||
146 | self.tax_card_type=Tax_Card_Type::Principal | ||
147 | else | ||
148 | self.tax_card_type=Tax_Card_Type::Additional | ||
149 | endif | ||
150 | endif | ||
151 | |||
152 | |||
153 | context Legal_Union_Record inv inv17: | ||
154 | self.start_year <=2018 and self.start_year >=1950 | ||
155 | |||
156 | |||
157 | --context Household inv inv18: | ||
158 | --not self.parents.oclIsUndefined() | ||
159 | |||
160 | --context Legal_Union_Record inv inv19: | ||
161 | --not self.household.oclIsUndefined() | ||
162 | |||
163 | context Legal_Union_Record inv inv20: | ||
164 | self.individual_B <> self.individual_A | ||
165 | and | ||
166 | not self.individual_A.oclIsUndefined() | ||
167 | and | ||
168 | not self.individual_B.oclIsUndefined() | ||
169 | |||
170 | --context Legal_Union_Record inv inv21: | ||
171 | --self.properties->size() >= 1 | ||
172 | |||
173 | --context Tax_Payer inv inv22: | ||
174 | --self.incomes->size() >= 1 | ||
175 | |||
176 | --context Tax_Payer inv inv23: | ||
177 | --not self.from_law.oclIsUndefined() | ||
178 | |||
179 | --context Tax_Payer inv inv24: | ||
180 | --not self.from_agent.oclIsUndefined() | ||
181 | |||
182 | --context Income inv inv25: | ||
183 | --not self.income_type.oclIsUndefined() | ||
184 | |||
185 | --context Income inv inv26: | ||
186 | --self.details->size() = 12 | ||
187 | |||
188 | |||
189 | --context Tax_Payer inv inv27: | ||
190 | --not self.from_agent.oclIsUndefined() | ||
191 | |||
192 | |||
193 | --context Tax_Payer inv inv28: | ||
194 | --not self.from_law.oclIsUndefined() | ||
195 | |||
196 | --context Legal_Union_Record inv inv29: | ||
197 | --self.properties->size()=1 | ||
198 | |||
199 | --context Tax_Payer inv inv30: | ||
200 | --self.AEP_deduction = 0 | ||
201 | |||
202 | --context Physical_Person inv inv31: | ||
203 | --self.last_start_year_widower = -1 | ||
204 | |||
205 | --context Physical_Person inv inv32: | ||
206 | --self.name = 'Not important' | ||
207 | |||
208 | context Physical_Person inv inv33: | ||
209 | self.getAge(2018) >= 0 and self.getAge(2018) <= 100 | ||
210 | |||
211 | context Physical_Person inv inv34: | ||
212 | self.birth_month >= 1 and self.birth_month <= 12 | ||
213 | |||
214 | context Physical_Person inv inv35: | ||
215 | self.birth_day >= 1 and self.birth_day <= 28 | ||
216 | |||
217 | --context FromAgent inv inv36: | ||
218 | --self.taxation_year = 2018 | ||
219 | |||
220 | --context Income inv inv37: | ||
221 | --self.year = 2018 | ||
222 | |||
223 | --context Income inv inv38: | ||
224 | --self.start_year = 2018 | ||
225 | |||
226 | --context Tax_Card inv inv39: | ||
227 | --self.deduction_FD_yearly = 0 | ||
228 | |||
229 | --context Tax_Card inv inv40: | ||
230 | --self.credit_CIS_yearly = 0 | ||
231 | |||
232 | --context Tax_Card inv inv40: | ||
233 | --self.credit_CIS_monthly = 0 | ||
234 | |||
235 | --context Tax_Card inv inv41: | ||
236 | --self.credit_CIP_yearly = 0 | ||
237 | |||
238 | --context Tax_Card inv inv42: | ||
239 | --self.credit_CIP_monthly = 0 | ||
240 | |||
241 | --context Tax_Card inv inv43: | ||
242 | --self.deduction_CE_invalidity_yearly = 0 | ||
243 | |||
244 | --context Tax_Card inv inv44: | ||
245 | --self.deduction_DS_Debt_yearly = 0 | ||
246 | |||
247 | |||
248 | --context Expense inv inv45: | ||
249 | --self.year_expense_was_incurred_in = 2018 | ||
250 | |||
251 | --context Tax_Property inv inv46: | ||
252 | --self.taxed_jointly = true | ||
253 | |||
254 | context Legal_Union_Record inv inv47: | ||
255 | (self.separation_cause=Separation_Causes::NONE and self.end_year = -1) | ||
256 | or(self.end_year>self.start_year) | ||
257 | |||
258 | |||
259 | context Physical_Person inv inv48: | ||
260 | (self.disability_type = Disability_Types::NONE and self.disability_percentage = 0) or | ||
261 | (self.disability_type <> Disability_Types::NONE and self.disability_percentage > 0 and self.disability_percentage <= 1) | ||
262 | |||
263 | context Legal_Union_Record inv inv49: | ||
264 | self.individual_A.oclIsKindOf(Tax_Payer) and | ||
265 | self.individual_B.oclIsKindOf(Physical_Person) and | ||
266 | not self.individual_B.oclIsTypeOf(Dependent) and | ||
267 | self.individual_A <> self.individual_B | ||
268 | |||
269 | --context Income inv inv50: | ||
270 | --not self.income_type.oclIsUndefined() | ||
271 | |||
272 | --context Income inv inv51: | ||
273 | --not self.taxPayer.oclIsUndefined() | ||
274 | |||
275 | --context Tax_Card inv inv52: | ||
276 | --not self.income.oclIsUndefined() | ||
277 | |||
278 | --context Legal_Union_Record inv inv53: | ||
279 | --not self.household.oclIsUndefined() | ||
280 | |||
281 | endpackage \ No newline at end of file | ||