diff options
author | Aren Babikian <aren.babikian@mail.mcgill.ca> | 2021-01-06 00:01:51 +0100 |
---|---|---|
committer | Aren Babikian <aren.babikian@mail.mcgill.ca> | 2021-01-06 00:01:51 +0100 |
commit | 7dcbe0bc5a9cac09de030b5f328f2e4d575f4ab5 (patch) | |
tree | d90109608b1f4871f3aef9c873cb80262a4154a1 /Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated | |
parent | merge models20 measurements (diff) | |
download | VIATRA-Generator-7dcbe0bc5a9cac09de030b5f328f2e4d575f4ab5.tar.gz VIATRA-Generator-7dcbe0bc5a9cac09de030b5f328f2e4d575f4ab5.tar.zst VIATRA-Generator-7dcbe0bc5a9cac09de030b5f328f2e4d575f4ab5.zip |
rebase dreal-integ on models20-measurements
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated')
-rw-r--r-- | Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated | 792 |
1 files changed, 0 insertions, 792 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated deleted file mode 100644 index 315a1e15..00000000 --- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated +++ /dev/null | |||
@@ -1,792 +0,0 @@ | |||
1 | import epackage "http://www.bme.hu/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage" | ||
2 | import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/problem" | ||
3 | import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" | ||
4 | |||
5 | ////////// | ||
6 | // 0. Util | ||
7 | ////////// | ||
8 | private pattern interpretation(problem:LogicProblem, interpretation:PartialInterpretation) { | ||
9 | PartialInterpretation.problem(interpretation,problem); | ||
10 | } | ||
11 | |||
12 | ///////////////////////// | ||
13 | // 0.1 Existence | ||
14 | ///////////////////////// | ||
15 | /** [[exist(element)]]=1 */ | ||
16 | private pattern mustExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | ||
17 | find interpretation(problem,interpretation); | ||
18 | LogicProblem.elements(problem,element); | ||
19 | } or { | ||
20 | find interpretation(problem,interpretation); | ||
21 | PartialInterpretation.newElements(interpretation,element); | ||
22 | } | ||
23 | |||
24 | /** [[exist(element)]]>=1/2 */ | ||
25 | private pattern mayExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | ||
26 | find mustExist(problem,interpretation,element); | ||
27 | } or { | ||
28 | find interpretation(problem,interpretation); | ||
29 | neg find elementCloseWorld(element); | ||
30 | PartialInterpretation.openWorldElements(interpretation,element); | ||
31 | } | ||
32 | |||
33 | private pattern elementCloseWorld(element:DefinedElement) { | ||
34 | PartialInterpretation.openWorldElements(i,element); | ||
35 | PartialInterpretation.maxNewElements(i,0); | ||
36 | } or { | ||
37 | Scope.targetTypeInterpretation(scope,interpretation); | ||
38 | PartialTypeInterpratation.elements(interpretation,element); | ||
39 | Scope.maxNewElements(scope,0); | ||
40 | } | ||
41 | |||
42 | //////////////////////// | ||
43 | // 0.2 Equivalence | ||
44 | //////////////////////// | ||
45 | pattern mayEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) | ||
46 | // For non-primitive type. Boolean types always must equivalent or cannot equivalent | ||
47 | { | ||
48 | find mayExist(problem,interpretation,a); | ||
49 | find mayExist(problem,interpretation,b); | ||
50 | a == b; | ||
51 | } or { | ||
52 | find mayExist(problem,interpretation,a); | ||
53 | find mayExist(problem,interpretation,b); | ||
54 | IntegerElement(a); | ||
55 | IntegerElement(b); | ||
56 | PrimitiveElement.valueSet(a,false); | ||
57 | } or { | ||
58 | find mayExist(problem,interpretation,a); | ||
59 | find mayExist(problem,interpretation,b); | ||
60 | IntegerElement(a); | ||
61 | IntegerElement(b); | ||
62 | PrimitiveElement.valueSet(b,false); | ||
63 | } or { | ||
64 | find mayExist(problem,interpretation,a); | ||
65 | find mayExist(problem,interpretation,b); | ||
66 | RealElement(a); | ||
67 | RealElement(b); | ||
68 | PrimitiveElement.valueSet(a,false); | ||
69 | } or { | ||
70 | find mayExist(problem,interpretation,a); | ||
71 | find mayExist(problem,interpretation,b); | ||
72 | RealElement(a); | ||
73 | RealElement(b); | ||
74 | PrimitiveElement.valueSet(b,false); | ||
75 | } or { | ||
76 | find mayExist(problem,interpretation,a); | ||
77 | find mayExist(problem,interpretation,b); | ||
78 | RealElement(a); | ||
79 | IntegerElement(b); | ||
80 | PrimitiveElement.valueSet(a,false); | ||
81 | } or { | ||
82 | find mayExist(problem,interpretation,a); | ||
83 | find mayExist(problem,interpretation,b); | ||
84 | RealElement(a); | ||
85 | IntegerElement(b); | ||
86 | PrimitiveElement.valueSet(b,false); | ||
87 | } or { | ||
88 | find mayExist(problem,interpretation,a); | ||
89 | find mayExist(problem,interpretation,b); | ||
90 | IntegerElement(a); | ||
91 | RealElement(b); | ||
92 | PrimitiveElement.valueSet(a,false); | ||
93 | } or { | ||
94 | find mayExist(problem,interpretation,a); | ||
95 | find mayExist(problem,interpretation,b); | ||
96 | IntegerElement(a); | ||
97 | RealElement(b); | ||
98 | PrimitiveElement.valueSet(b,false); | ||
99 | } or { | ||
100 | find mayExist(problem,interpretation,a); | ||
101 | find mayExist(problem,interpretation,b); | ||
102 | StringElement(a); | ||
103 | StringElement(b); | ||
104 | PrimitiveElement.valueSet(a,false); | ||
105 | } or { | ||
106 | find mayExist(problem,interpretation,a); | ||
107 | find mayExist(problem,interpretation,b); | ||
108 | StringElement(a); | ||
109 | StringElement(b); | ||
110 | PrimitiveElement.valueSet(b,false); | ||
111 | } | ||
112 | |||
113 | pattern mustEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) { | ||
114 | // For non-primitive and Boolean primitive type | ||
115 | find mustExist(problem,interpretation,a); | ||
116 | find mustExist(problem,interpretation,b); | ||
117 | a == b; | ||
118 | } or { | ||
119 | find mustExist(problem,interpretation,a); | ||
120 | find mustExist(problem,interpretation,b); | ||
121 | PrimitiveElement.valueSet(a,true); | ||
122 | PrimitiveElement.valueSet(b,true); | ||
123 | IntegerElement.value(a,value); | ||
124 | IntegerElement.value(b,value); | ||
125 | } or { | ||
126 | find mustExist(problem,interpretation,a); | ||
127 | find mustExist(problem,interpretation,b); | ||
128 | PrimitiveElement.valueSet(a,true); | ||
129 | PrimitiveElement.valueSet(b,true); | ||
130 | RealElement.value(a,value); | ||
131 | RealElement.value(b,value); | ||
132 | } or { | ||
133 | find mustExist(problem,interpretation,a); | ||
134 | find mustExist(problem,interpretation,b); | ||
135 | PrimitiveElement.valueSet(a,true); | ||
136 | PrimitiveElement.valueSet(b,true); | ||
137 | RealElement.value(a,value); | ||
138 | IntegerElement.value(b,value); | ||
139 | } or { | ||
140 | find mustExist(problem,interpretation,a); | ||
141 | find mustExist(problem,interpretation,b); | ||
142 | PrimitiveElement.valueSet(a,true); | ||
143 | PrimitiveElement.valueSet(b,true); | ||
144 | IntegerElement.value(a,value); | ||
145 | RealElement.value(b,value); | ||
146 | } or { | ||
147 | find mustExist(problem,interpretation,a); | ||
148 | find mustExist(problem,interpretation,b); | ||
149 | PrimitiveElement.valueSet(a,true); | ||
150 | PrimitiveElement.valueSet(b,true); | ||
151 | StringElement.value(a,value); | ||
152 | StringElement.value(b,value); | ||
153 | } | ||
154 | |||
155 | ////////// | ||
156 | // 1. Problem-Specific Base Indexers | ||
157 | ////////// | ||
158 | // 1.1 Type Indexers | ||
159 | ////////// | ||
160 | // 1.1.1 Required Patterns by TypeIndexer | ||
161 | ////////// | ||
162 | private pattern typeInterpretation(problem:LogicProblem, interpretation:PartialInterpretation, type:TypeDeclaration, typeInterpretation:PartialComplexTypeInterpretation) { | ||
163 | find interpretation(problem,interpretation); | ||
164 | LogicProblem.types(problem,type); | ||
165 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); | ||
166 | PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type); | ||
167 | } | ||
168 | |||
169 | private pattern directInstanceOf(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement, type:Type) { | ||
170 | find interpretation(problem,interpretation); | ||
171 | LogicProblem.types(problem,type); | ||
172 | TypeDefinition.elements(type,element); | ||
173 | } or { | ||
174 | find interpretation(problem,interpretation); | ||
175 | find typeInterpretation(problem,interpretation,type,typeInterpretation); | ||
176 | PartialComplexTypeInterpretation.elements(typeInterpretation,element); | ||
177 | } | ||
178 | |||
179 | private pattern isPrimitive(element: PrimitiveElement) { | ||
180 | PrimitiveElement(element); | ||
181 | } | ||
182 | ////////// | ||
183 | // 1.1.2 primitive Type Indexers | ||
184 | ////////// | ||
185 | // Currently unused. Refer primitive types as: | ||
186 | // > PrimitiveElement(element) | ||
187 | // specific types are referred as: | ||
188 | // > BooleanElement(variableName) | ||
189 | // > IntegerElement(variableName) | ||
190 | // > RealElement(variableName) | ||
191 | // > StringElement(variableName) | ||
192 | // And their value as | ||
193 | // > BooleanElement.value(variableName,value) | ||
194 | // > IntegerElement.value(variableName,value) | ||
195 | // > RealElement.value(variableName,value) | ||
196 | // > StringElement.value(variableName,value) | ||
197 | // Whether a value is set is defined by: | ||
198 | // > PrimitiveElement.valueSet(variableName,isFilled); | ||
199 | ////////// | ||
200 | // 1.1.3 domain-specific Type Indexers | ||
201 | ////////// | ||
202 | /** | ||
203 | * An element must be an instance of type "FamilyTree class". | ||
204 | */ | ||
205 | private pattern mustInstanceOfFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | ||
206 | Type.name(type,"FamilyTree class"); | ||
207 | find directInstanceOf(problem,interpretation,element,type); | ||
208 | } | ||
209 | private pattern scopeDisallowsNewFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation) { | ||
210 | find interpretation(problem,interpretation); | ||
211 | PartialInterpretation.scopes(interpretation,scope); | ||
212 | Scope.targetTypeInterpretation(scope,typeInterpretation); | ||
213 | Scope.maxNewElements(scope,0); | ||
214 | PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type); | ||
215 | Type.name(type,"FamilyTree class"); | ||
216 | } | ||
217 | |||
218 | /** | ||
219 | * An element may be an instance of type "FamilyTree class". | ||
220 | */ | ||
221 | private pattern mayInstanceOfFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) | ||
222 | { | ||
223 | find interpretation(problem,interpretation); | ||
224 | PartialInterpretation.newElements(interpretation,element); | ||
225 | neg find mustInstanceOfMember_class(problem,interpretation,element); | ||
226 | neg find scopeDisallowsNewFamilyTree_class(problem, interpretation); | ||
227 | neg find isPrimitive(element); | ||
228 | } or { | ||
229 | find interpretation(problem,interpretation); | ||
230 | PartialInterpretation.openWorldElements(interpretation,element); | ||
231 | neg find mustInstanceOfMember_class(problem,interpretation,element); | ||
232 | neg find scopeDisallowsNewFamilyTree_class(problem, interpretation); | ||
233 | neg find isPrimitive(element); | ||
234 | } or | ||
235 | { find mustInstanceOfFamilyTree_class(problem,interpretation,element); } | ||
236 | /** | ||
237 | * An element must be an instance of type "Member class". | ||
238 | */ | ||
239 | private pattern mustInstanceOfMember_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | ||
240 | Type.name(type,"Member class"); | ||
241 | find directInstanceOf(problem,interpretation,element,type); | ||
242 | } | ||
243 | private pattern scopeDisallowsNewMember_class(problem:LogicProblem, interpretation:PartialInterpretation) { | ||
244 | find interpretation(problem,interpretation); | ||
245 | PartialInterpretation.scopes(interpretation,scope); | ||
246 | Scope.targetTypeInterpretation(scope,typeInterpretation); | ||
247 | Scope.maxNewElements(scope,0); | ||
248 | PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type); | ||
249 | Type.name(type,"Member class"); | ||
250 | } | ||
251 | |||
252 | /** | ||
253 | * An element may be an instance of type "Member class". | ||
254 | */ | ||
255 | private pattern mayInstanceOfMember_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) | ||
256 | { | ||
257 | find interpretation(problem,interpretation); | ||
258 | PartialInterpretation.newElements(interpretation,element); | ||
259 | neg find mustInstanceOfFamilyTree_class(problem,interpretation,element); | ||
260 | neg find scopeDisallowsNewMember_class(problem, interpretation); | ||
261 | neg find isPrimitive(element); | ||
262 | } or { | ||
263 | find interpretation(problem,interpretation); | ||
264 | PartialInterpretation.openWorldElements(interpretation,element); | ||
265 | neg find mustInstanceOfFamilyTree_class(problem,interpretation,element); | ||
266 | neg find scopeDisallowsNewMember_class(problem, interpretation); | ||
267 | neg find isPrimitive(element); | ||
268 | } or | ||
269 | { find mustInstanceOfMember_class(problem,interpretation,element); } | ||
270 | |||
271 | ////////// | ||
272 | // 1.2 Relation Declaration Indexers | ||
273 | ////////// | ||
274 | /** | ||
275 | * Matcher for detecting tuples t where []members reference FamilyTree(source,target) | ||
276 | */ | ||
277 | private pattern mustInRelationmembers_reference_FamilyTree( | ||
278 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
279 | source: DefinedElement, target:DefinedElement) | ||
280 | { | ||
281 | find interpretation(problem,interpretation); | ||
282 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
283 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"members reference FamilyTree"); | ||
284 | PartialRelationInterpretation.relationlinks(relationIterpretation,link); | ||
285 | BinaryElementRelationLink.param1(link,source); | ||
286 | BinaryElementRelationLink.param2(link,target); | ||
287 | } | ||
288 | /** | ||
289 | * Matcher for detecting tuples t where <>members reference FamilyTree(source,target) | ||
290 | */ | ||
291 | private pattern mayInRelationmembers_reference_FamilyTree( | ||
292 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
293 | source: DefinedElement, target:DefinedElement) | ||
294 | { | ||
295 | find interpretation(problem,interpretation); | ||
296 | // The two endpoint of the link have to exist | ||
297 | find mayExist(problem, interpretation, source); | ||
298 | find mayExist(problem, interpretation, target); | ||
299 | // Type consistency | ||
300 | find mayInstanceOfFamilyTree_class(problem,interpretation,source); | ||
301 | find mayInstanceOfMember_class(problem,interpretation,target); | ||
302 | // The reference is containment, then a new reference cannot be create if: | ||
303 | // 1. Multiple parents | ||
304 | neg find mustContains4(problem,interpretation,_,target); | ||
305 | // 2. Circle in the containment hierarchy | ||
306 | neg find mustTransitiveContains(source,target); | ||
307 | } or { | ||
308 | find mustInRelationmembers_reference_FamilyTree(problem,interpretation,source,target); | ||
309 | } | ||
310 | /** | ||
311 | * Matcher for detecting tuples t where []children reference Member(source,target) | ||
312 | */ | ||
313 | private pattern mustInRelationchildren_reference_Member( | ||
314 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
315 | source: DefinedElement, target:DefinedElement) | ||
316 | { | ||
317 | find interpretation(problem,interpretation); | ||
318 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
319 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"children reference Member"); | ||
320 | PartialRelationInterpretation.relationlinks(relationIterpretation,link); | ||
321 | BinaryElementRelationLink.param1(link,source); | ||
322 | BinaryElementRelationLink.param2(link,target); | ||
323 | } | ||
324 | /** | ||
325 | * Matcher for detecting tuples t where <>children reference Member(source,target) | ||
326 | */ | ||
327 | private pattern mayInRelationchildren_reference_Member( | ||
328 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
329 | source: DefinedElement, target:DefinedElement) | ||
330 | { | ||
331 | find interpretation(problem,interpretation); | ||
332 | // The two endpoint of the link have to exist | ||
333 | find mayExist(problem, interpretation, source); | ||
334 | find mayExist(problem, interpretation, target); | ||
335 | // Type consistency | ||
336 | find mayInstanceOfMember_class(problem,interpretation,source); | ||
337 | find mayInstanceOfMember_class(problem,interpretation,target); | ||
338 | // There are "numberOfExistingReferences" currently existing instances of the reference to the target, | ||
339 | // the upper bound of the opposite reference multiplicity should be considered. | ||
340 | numberOfExistingOppositeReferences == count find mustInRelationparents_reference_Member(problem,interpretation,target,_); | ||
341 | check(numberOfExistingOppositeReferences < 2); | ||
342 | } or { | ||
343 | find mustInRelationchildren_reference_Member(problem,interpretation,source,target); | ||
344 | } | ||
345 | /** | ||
346 | * Matcher for detecting tuples t where []parents reference Member(source,target) | ||
347 | */ | ||
348 | private pattern mustInRelationparents_reference_Member( | ||
349 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
350 | source: DefinedElement, target:DefinedElement) | ||
351 | { | ||
352 | find interpretation(problem,interpretation); | ||
353 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
354 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"parents reference Member"); | ||
355 | PartialRelationInterpretation.relationlinks(relationIterpretation,link); | ||
356 | BinaryElementRelationLink.param1(link,source); | ||
357 | BinaryElementRelationLink.param2(link,target); | ||
358 | } | ||
359 | /** | ||
360 | * Matcher for detecting tuples t where <>parents reference Member(source,target) | ||
361 | */ | ||
362 | private pattern mayInRelationparents_reference_Member( | ||
363 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
364 | source: DefinedElement, target:DefinedElement) | ||
365 | { | ||
366 | find interpretation(problem,interpretation); | ||
367 | // The two endpoint of the link have to exist | ||
368 | find mayExist(problem, interpretation, source); | ||
369 | find mayExist(problem, interpretation, target); | ||
370 | // Type consistency | ||
371 | find mayInstanceOfMember_class(problem,interpretation,source); | ||
372 | find mayInstanceOfMember_class(problem,interpretation,target); | ||
373 | // There are "numberOfExistingReferences" currently existing instances of the reference from the source, | ||
374 | // the upper bound of the multiplicity should be considered. | ||
375 | numberOfExistingReferences == count find mustInRelationparents_reference_Member(problem,interpretation,source,_); | ||
376 | check(numberOfExistingReferences < 2); | ||
377 | } or { | ||
378 | find mustInRelationparents_reference_Member(problem,interpretation,source,target); | ||
379 | } | ||
380 | /** | ||
381 | * Matcher for detecting tuples t where []name attribute Member(source,target) | ||
382 | */ | ||
383 | private pattern mustInRelationname_attribute_Member( | ||
384 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
385 | source: DefinedElement, target:DefinedElement) | ||
386 | { | ||
387 | find interpretation(problem,interpretation); | ||
388 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
389 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"name attribute Member"); | ||
390 | PartialRelationInterpretation.relationlinks(relationIterpretation,link); | ||
391 | BinaryElementRelationLink.param1(link,source); | ||
392 | BinaryElementRelationLink.param2(link,target); | ||
393 | } | ||
394 | /** | ||
395 | * Matcher for detecting tuples t where <>name attribute Member(source,target) | ||
396 | */ | ||
397 | private pattern mayInRelationname_attribute_Member( | ||
398 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
399 | source: DefinedElement, target:DefinedElement) | ||
400 | { | ||
401 | find interpretation(problem,interpretation); | ||
402 | // The two endpoint of the link have to exist | ||
403 | find mayExist(problem, interpretation, source); | ||
404 | find mayExist(problem, interpretation, target); | ||
405 | // Type consistency | ||
406 | find mayInstanceOfMember_class(problem,interpretation,source); | ||
407 | StringElement(target); | ||
408 | // There are "numberOfExistingReferences" currently existing instances of the reference from the source, | ||
409 | // the upper bound of the multiplicity should be considered. | ||
410 | numberOfExistingReferences == count find mustInRelationname_attribute_Member(problem,interpretation,source,_); | ||
411 | check(numberOfExistingReferences < 1); | ||
412 | } or { | ||
413 | find mustInRelationname_attribute_Member(problem,interpretation,source,target); | ||
414 | } | ||
415 | /** | ||
416 | * Matcher for detecting tuples t where []age attribute Member(source,target) | ||
417 | */ | ||
418 | private pattern mustInRelationage_attribute_Member( | ||
419 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
420 | source: DefinedElement, target:DefinedElement) | ||
421 | { | ||
422 | find interpretation(problem,interpretation); | ||
423 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
424 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"age attribute Member"); | ||
425 | PartialRelationInterpretation.relationlinks(relationIterpretation,link); | ||
426 | BinaryElementRelationLink.param1(link,source); | ||
427 | BinaryElementRelationLink.param2(link,target); | ||
428 | } | ||
429 | /** | ||
430 | * Matcher for detecting tuples t where <>age attribute Member(source,target) | ||
431 | */ | ||
432 | private pattern mayInRelationage_attribute_Member( | ||
433 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
434 | source: DefinedElement, target:DefinedElement) | ||
435 | { | ||
436 | find interpretation(problem,interpretation); | ||
437 | // The two endpoint of the link have to exist | ||
438 | find mayExist(problem, interpretation, source); | ||
439 | find mayExist(problem, interpretation, target); | ||
440 | // Type consistency | ||
441 | find mayInstanceOfMember_class(problem,interpretation,source); | ||
442 | IntegerElement(target); | ||
443 | // There are "numberOfExistingReferences" currently existing instances of the reference from the source, | ||
444 | // the upper bound of the multiplicity should be considered. | ||
445 | numberOfExistingReferences == count find mustInRelationage_attribute_Member(problem,interpretation,source,_); | ||
446 | check(numberOfExistingReferences < 1); | ||
447 | } or { | ||
448 | find mustInRelationage_attribute_Member(problem,interpretation,source,target); | ||
449 | } | ||
450 | |||
451 | ////////// | ||
452 | // 1.3 Relation Definition Indexers | ||
453 | ////////// | ||
454 | // Must, May and Current queries for pattern queries memberIsItsOwnParent | ||
455 | private pattern mustInRelation_pattern_queries_memberIsItsOwnParent( | ||
456 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
457 | var_m) | ||
458 | { | ||
459 | find interpretation(problem,interpretation); | ||
460 | var_m == var_p; | ||
461 | find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p); | ||
462 | find mustInRelationparents_reference_Member(problem,interpretation,var_p,var_p); | ||
463 | } | ||
464 | private pattern mayInRelation_pattern_queries_memberIsItsOwnParent( | ||
465 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
466 | var_m) | ||
467 | { | ||
468 | find interpretation(problem,interpretation); | ||
469 | var_m == var_p; | ||
470 | find mayInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p); | ||
471 | find mayInRelationparents_reference_Member(problem,interpretation,var_p,var_p); | ||
472 | } | ||
473 | private pattern currentInRelation_pattern_queries_memberIsItsOwnParent( | ||
474 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
475 | var_m) | ||
476 | { | ||
477 | find interpretation(problem,interpretation); | ||
478 | var_m == var_p; | ||
479 | find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p); | ||
480 | find mustInRelationparents_reference_Member(problem,interpretation,var_p,var_p); | ||
481 | } | ||
482 | // Must, May and Current queries for pattern queries twoMembersHaveNoParent | ||
483 | private pattern mustInRelation_pattern_queries_twoMembersHaveNoParent( | ||
484 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
485 | var_m1, var_m2) | ||
486 | { | ||
487 | find interpretation(problem,interpretation); | ||
488 | // var_m1 exported | ||
489 | // var_m2 exported | ||
490 | find mustInstanceOfMember_class(problem,interpretation,var_m1); | ||
491 | find mustInstanceOfMember_class(problem,interpretation,var_m2); | ||
492 | neg find mayInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1); | ||
493 | neg find mayInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2); | ||
494 | neg find mayEquivalent(problem, interpretation, var_m1, var_m2); | ||
495 | } | ||
496 | private pattern mayInRelation_pattern_queries_twoMembersHaveNoParent( | ||
497 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
498 | var_m1, var_m2) | ||
499 | { | ||
500 | find interpretation(problem,interpretation); | ||
501 | // var_m1 exported | ||
502 | // var_m2 exported | ||
503 | find mayInstanceOfMember_class(problem,interpretation,var_m1); | ||
504 | find mayInstanceOfMember_class(problem,interpretation,var_m2); | ||
505 | neg find mustInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1); | ||
506 | neg find mustInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2); | ||
507 | neg find mustEquivalent(problem, interpretation, var_m1, var_m2); | ||
508 | } | ||
509 | private pattern currentInRelation_pattern_queries_twoMembersHaveNoParent( | ||
510 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
511 | var_m1, var_m2) | ||
512 | { | ||
513 | find interpretation(problem,interpretation); | ||
514 | // var_m1 exported | ||
515 | // var_m2 exported | ||
516 | find mustInstanceOfMember_class(problem,interpretation,var_m1); | ||
517 | find mustInstanceOfMember_class(problem,interpretation,var_m2); | ||
518 | neg find currentInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1); | ||
519 | neg find currentInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2); | ||
520 | neg find mustEquivalent(problem, interpretation, var_m1, var_m2); | ||
521 | } | ||
522 | // Must, May and Current queries for pattern queries memberHasParent | ||
523 | private pattern mustInRelation_pattern_queries_memberHasParent( | ||
524 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
525 | var_m) | ||
526 | { | ||
527 | find interpretation(problem,interpretation); | ||
528 | // var_m exported | ||
529 | find mustInRelationparents_reference_Member(problem,interpretation,var_m,var__0); | ||
530 | find mustInstanceOfMember_class(problem,interpretation,var__0); | ||
531 | } | ||
532 | private pattern mayInRelation_pattern_queries_memberHasParent( | ||
533 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
534 | var_m) | ||
535 | { | ||
536 | find interpretation(problem,interpretation); | ||
537 | // var_m exported | ||
538 | find mayInRelationparents_reference_Member(problem,interpretation,var_m,var__0); | ||
539 | find mayInstanceOfMember_class(problem,interpretation,var__0); | ||
540 | } | ||
541 | private pattern currentInRelation_pattern_queries_memberHasParent( | ||
542 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
543 | var_m) | ||
544 | { | ||
545 | find interpretation(problem,interpretation); | ||
546 | // var_m exported | ||
547 | find mustInRelationparents_reference_Member(problem,interpretation,var_m,var__0); | ||
548 | find mustInstanceOfMember_class(problem,interpretation,var__0); | ||
549 | } | ||
550 | // Must, May and Current queries for pattern queries parentTooYoung | ||
551 | private pattern mustInRelation_pattern_queries_parentTooYoung( | ||
552 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
553 | var_m, var_p) | ||
554 | { | ||
555 | find interpretation(problem,interpretation); | ||
556 | // var_m exported | ||
557 | // var_p exported | ||
558 | find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m); | ||
559 | find mustInRelationparents_reference_Member(problem,interpretation,var_m,var_p); | ||
560 | find mustInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge); | ||
561 | find mustInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge); | ||
562 | PrimitiveElement.valueSet(var_mAge,true); IntegerElement.value(var_mAge,value_var_mAge); | ||
563 | PrimitiveElement.valueSet(var_pAge,true); IntegerElement.value(var_pAge,value_var_pAge); | ||
564 | check((value_var_mAge<=(value_var_pAge+12))); | ||
565 | } | ||
566 | private pattern mayInRelation_pattern_queries_parentTooYoung( | ||
567 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
568 | var_m, var_p) | ||
569 | { | ||
570 | find interpretation(problem,interpretation); | ||
571 | // var_m exported | ||
572 | // var_p exported | ||
573 | find mayInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m); | ||
574 | find mayInRelationparents_reference_Member(problem,interpretation,var_m,var_p); | ||
575 | find mayInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge); | ||
576 | find mayInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge); | ||
577 | PrimitiveElement.valueSet(var_mAge,setted_var_mAge); IntegerElement.value(var_mAge,value_var_mAge); | ||
578 | PrimitiveElement.valueSet(var_pAge,setted_var_pAge); IntegerElement.value(var_pAge,value_var_pAge); | ||
579 | check( | ||
580 | !setted_var_mAge || !setted_var_pAge | ||
581 | || | ||
582 | ((value_var_mAge<=(value_var_pAge+12))) | ||
583 | ); | ||
584 | } | ||
585 | private pattern currentInRelation_pattern_queries_parentTooYoung( | ||
586 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
587 | var_m, var_p) | ||
588 | { | ||
589 | find interpretation(problem,interpretation); | ||
590 | // var_m exported | ||
591 | // var_p exported | ||
592 | find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m); | ||
593 | find mustInRelationparents_reference_Member(problem,interpretation,var_m,var_p); | ||
594 | find mustInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge); | ||
595 | find mustInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge); | ||
596 | PrimitiveElement.valueSet(var_mAge,true); IntegerElement.value(var_mAge,value_var_mAge); | ||
597 | PrimitiveElement.valueSet(var_pAge,true); IntegerElement.value(var_pAge,value_var_pAge); | ||
598 | check((value_var_mAge<=(value_var_pAge+12))); | ||
599 | } | ||
600 | |||
601 | ////////// | ||
602 | // 1.4 Containment Indexer | ||
603 | ////////// | ||
604 | private pattern mustContains2(source: DefinedElement, target: DefinedElement) { | ||
605 | find mustContains4(_,_,source,target); | ||
606 | } | ||
607 | |||
608 | private pattern mustContains4(problem:LogicProblem, interpretation:PartialInterpretation, | ||
609 | source: DefinedElement, target: DefinedElement) | ||
610 | { find mustInRelationmembers_reference_FamilyTree(problem,interpretation,source,target); } | ||
611 | |||
612 | private pattern mustTransitiveContains(source,target) { | ||
613 | find mustContains2+(source,target); | ||
614 | } | ||
615 | |||
616 | ////////// | ||
617 | // 2. Invalidation Indexers | ||
618 | ////////// | ||
619 | // 2.1 Invalidated by WF Queries | ||
620 | ////////// | ||
621 | pattern invalidatedBy_pattern_queries_memberIsItsOwnParent(problem:LogicProblem, interpretation:PartialInterpretation, | ||
622 | var_m) | ||
623 | { | ||
624 | find mustInRelation_pattern_queries_memberIsItsOwnParent(problem,interpretation,var_m); | ||
625 | } | ||
626 | pattern invalidatedBy_pattern_queries_twoMembersHaveNoParent(problem:LogicProblem, interpretation:PartialInterpretation, | ||
627 | var_m1, var_m2) | ||
628 | { | ||
629 | find mustInRelation_pattern_queries_twoMembersHaveNoParent(problem,interpretation,var_m1,var_m2); | ||
630 | } | ||
631 | pattern invalidatedBy_pattern_queries_parentTooYoung(problem:LogicProblem, interpretation:PartialInterpretation, | ||
632 | var_m, var_p) | ||
633 | { | ||
634 | find mustInRelation_pattern_queries_parentTooYoung(problem,interpretation,var_m,var_p); | ||
635 | } | ||
636 | |||
637 | ////////// | ||
638 | // 3. Unfinishedness Indexers | ||
639 | ////////// | ||
640 | // 3.1 Unfinishedness Measured by Multiplicity | ||
641 | ////////// | ||
642 | |||
643 | ////////// | ||
644 | // 3.2 Unfinishedness Measured by WF Queries | ||
645 | ////////// | ||
646 | pattern unfinishedBy_pattern_queries_memberIsItsOwnParent(problem:LogicProblem, interpretation:PartialInterpretation, | ||
647 | var_m) | ||
648 | { | ||
649 | find currentInRelation_pattern_queries_memberIsItsOwnParent(problem,interpretation,var_m); | ||
650 | } | ||
651 | pattern unfinishedBy_pattern_queries_twoMembersHaveNoParent(problem:LogicProblem, interpretation:PartialInterpretation, | ||
652 | var_m1, var_m2) | ||
653 | { | ||
654 | find currentInRelation_pattern_queries_twoMembersHaveNoParent(problem,interpretation,var_m1,var_m2); | ||
655 | } | ||
656 | pattern unfinishedBy_pattern_queries_parentTooYoung(problem:LogicProblem, interpretation:PartialInterpretation, | ||
657 | var_m, var_p) | ||
658 | { | ||
659 | find currentInRelation_pattern_queries_parentTooYoung(problem,interpretation,var_m,var_p); | ||
660 | } | ||
661 | |||
662 | ////////// | ||
663 | // 4. Refinement Indexers | ||
664 | ////////// | ||
665 | // 4.1 Object constructors | ||
666 | ////////// | ||
667 | private pattern hasElementInContainment(problem:LogicProblem, interpretation:PartialInterpretation) | ||
668 | { | ||
669 | find interpretation(problem,interpretation); | ||
670 | find mustInstanceOfFamilyTree_class(problem,interpretation,root); | ||
671 | find mustExist(problem, interpretation, root); | ||
672 | }or{ | ||
673 | find interpretation(problem,interpretation); | ||
674 | find mustInstanceOfMember_class(problem,interpretation,root); | ||
675 | find mustExist(problem, interpretation, root); | ||
676 | } | ||
677 | pattern createObject_Member_class_by_members_reference_FamilyTree( | ||
678 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
679 | relationInterpretation:PartialRelationInterpretation, typeInterpretation:PartialComplexTypeInterpretation, | ||
680 | container:DefinedElement) | ||
681 | { | ||
682 | find interpretation(problem,interpretation); | ||
683 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); | ||
684 | PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"Member class"); | ||
685 | PartialInterpretation.partialrelationinterpretation(interpretation,relationInterpretation); | ||
686 | PartialRelationInterpretation.interpretationOf.name(relationInterpretation,"members reference FamilyTree"); | ||
687 | find mustInstanceOfFamilyTree_class(problem,interpretation,container); | ||
688 | find mayInstanceOfMember_class(problem,interpretation,newObject); | ||
689 | find mayInRelationmembers_reference_FamilyTree(problem,interpretation,container,newObject); | ||
690 | find mustExist(problem, interpretation, container); | ||
691 | neg find mustExist(problem, interpretation, newObject); | ||
692 | } | ||
693 | pattern createObject_Member_class( | ||
694 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
695 | typeInterpretation:PartialComplexTypeInterpretation) | ||
696 | { | ||
697 | find interpretation(problem,interpretation); | ||
698 | neg find hasElementInContainment(problem,interpretation); | ||
699 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); | ||
700 | PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"Member class"); | ||
701 | find mayInstanceOfMember_class(problem,interpretation,newObject); | ||
702 | find mayExist(problem, interpretation, newObject); | ||
703 | neg find mustExist(problem, interpretation, newObject); | ||
704 | } | ||
705 | pattern createObject_FamilyTree_class( | ||
706 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
707 | typeInterpretation:PartialComplexTypeInterpretation) | ||
708 | { | ||
709 | find interpretation(problem,interpretation); | ||
710 | neg find hasElementInContainment(problem,interpretation); | ||
711 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); | ||
712 | PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"FamilyTree class"); | ||
713 | find mayInstanceOfFamilyTree_class(problem,interpretation,newObject); | ||
714 | find mayExist(problem, interpretation, newObject); | ||
715 | neg find mustExist(problem, interpretation, newObject); | ||
716 | } | ||
717 | |||
718 | ////////// | ||
719 | // 4.2 Type refinement | ||
720 | ////////// | ||
721 | pattern refineTypeTo_Member_class(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) { | ||
722 | find interpretation(problem,interpretation); | ||
723 | PartialInterpretation.newElements(interpretation,element); | ||
724 | find mayInstanceOfMember_class(problem,interpretation,element); | ||
725 | neg find mustInstanceOfMember_class(problem,interpretation,element); | ||
726 | neg find mustInstanceOfFamilyTree_class(problem,interpretation,element); | ||
727 | } | ||
728 | pattern refineTypeTo_FamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) { | ||
729 | find interpretation(problem,interpretation); | ||
730 | PartialInterpretation.newElements(interpretation,element); | ||
731 | find mayInstanceOfFamilyTree_class(problem,interpretation,element); | ||
732 | neg find mustInstanceOfMember_class(problem,interpretation,element); | ||
733 | neg find mustInstanceOfFamilyTree_class(problem,interpretation,element); | ||
734 | } | ||
735 | |||
736 | ////////// | ||
737 | // 4.3 Relation refinement | ||
738 | ////////// | ||
739 | pattern refineRelation_children_reference_Member_and_parents_reference_Member( | ||
740 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
741 | relationIterpretation:PartialRelationInterpretation, oppositeInterpretation:PartialRelationInterpretation, | ||
742 | from: DefinedElement, to: DefinedElement) | ||
743 | { | ||
744 | find interpretation(problem,interpretation); | ||
745 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
746 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"children reference Member"); | ||
747 | PartialInterpretation.partialrelationinterpretation(interpretation,oppositeInterpretation); | ||
748 | PartialRelationInterpretation.interpretationOf.name(oppositeInterpretation,"parents reference Member"); | ||
749 | find mustExist(problem, interpretation, from); | ||
750 | find mustExist(problem, interpretation, to); | ||
751 | find mustInstanceOfMember_class(problem,interpretation,from); | ||
752 | find mustInstanceOfMember_class(problem,interpretation,to); | ||
753 | find mayInRelationchildren_reference_Member(problem,interpretation,from,to); | ||
754 | neg find mustInRelationchildren_reference_Member(problem,interpretation,from,to); | ||
755 | } | ||
756 | pattern refineRelation_name_attribute_Member( | ||
757 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
758 | relationIterpretation:PartialRelationInterpretation, | ||
759 | from: DefinedElement, to: DefinedElement) | ||
760 | { | ||
761 | find interpretation(problem,interpretation); | ||
762 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
763 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"name attribute Member"); | ||
764 | find mustExist(problem, interpretation, from); | ||
765 | find mustExist(problem, interpretation, to); | ||
766 | find mustInstanceOfMember_class(problem,interpretation,from); | ||
767 | StringElement(to); | ||
768 | find mayInRelationname_attribute_Member(problem,interpretation,from,to); | ||
769 | neg find mustInRelationname_attribute_Member(problem,interpretation,from,to); | ||
770 | } | ||
771 | pattern refineRelation_age_attribute_Member( | ||
772 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
773 | relationIterpretation:PartialRelationInterpretation, | ||
774 | from: DefinedElement, to: DefinedElement) | ||
775 | { | ||
776 | find interpretation(problem,interpretation); | ||
777 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
778 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"age attribute Member"); | ||
779 | find mustExist(problem, interpretation, from); | ||
780 | find mustExist(problem, interpretation, to); | ||
781 | find mustInstanceOfMember_class(problem,interpretation,from); | ||
782 | IntegerElement(to); | ||
783 | find mayInRelationage_attribute_Member(problem,interpretation,from,to); | ||
784 | neg find mustInRelationage_attribute_Member(problem,interpretation,from,to); | ||
785 | } | ||
786 | |||
787 | ////////// | ||
788 | // 5 Unit Propagations | ||
789 | ////////// | ||
790 | |||
791 | // Main propagations: | ||
792 | |||