diff options
author | ArenBabikian <aren.babikian@mail.mcgill.ca> | 2019-02-15 12:42:15 -0500 |
---|---|---|
committer | ArenBabikian <aren.babikian@mail.mcgill.ca> | 2020-06-07 19:06:30 -0400 |
commit | cd87de919c733033557401e011102edc67c5f169 (patch) | |
tree | c19225558d63945cf7afea5e0dc92c738788d71a /Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries | |
parent | Fix FAM Test. Begin Grammar Fix. (diff) | |
download | VIATRA-Generator-cd87de919c733033557401e011102edc67c5f169.tar.gz VIATRA-Generator-cd87de919c733033557401e011102edc67c5f169.tar.zst VIATRA-Generator-cd87de919c733033557401e011102edc67c5f169.zip |
Set up #19
Diffstat (limited to 'Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries')
2 files changed, 497 insertions, 0 deletions
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduMutatedPatterns.vql b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduMutatedPatterns.vql new file mode 100644 index 00000000..2e498670 --- /dev/null +++ b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduMutatedPatterns.vql | |||
@@ -0,0 +1,270 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries | ||
2 | |||
3 | import epackage "YakinduMetamodel" | ||
4 | |||
5 | ///////// | ||
6 | // Entry | ||
7 | ///////// | ||
8 | |||
9 | pattern entryInRegion_M0(r1 : Region, e1 : Entry) { | ||
10 | Region.vertices(r1, e1); | ||
11 | } | ||
12 | pattern entryInRegion_M1(r1 : Region, e1) { | ||
13 | Region.vertices(r1, e1); | ||
14 | } | ||
15 | pattern entryInRegion_M2(r1 : Region, e1: Entry) { | ||
16 | // For positive constraint | ||
17 | Region(r1);Entry(e1); | ||
18 | } | ||
19 | |||
20 | |||
21 | //@Constraint(severity="error", message="error", key = {r1}) | ||
22 | pattern noEntryInRegion_M0(r1 : Region) { | ||
23 | neg find entryInRegion_M0(r1, _); | ||
24 | } | ||
25 | pattern noEntryInRegion_M1(r1 : Region) { | ||
26 | neg find entryInRegion_M1(r1, _); | ||
27 | } | ||
28 | pattern noEntryInRegion_M2(r1 : Region) { | ||
29 | neg find entryInRegion_M2(r1, _); | ||
30 | } | ||
31 | pattern noEntryInRegion_M3(r1 : Region) { | ||
32 | find entryInRegion_M0(r1, _); | ||
33 | } | ||
34 | pattern noEntryInRegion_M4(r1 : Region) { | ||
35 | find entryInRegion_M1(r1, _); | ||
36 | } | ||
37 | pattern noEntryInRegion_M5(r1 : Region) { | ||
38 | find entryInRegion_M2(r1, _); | ||
39 | } | ||
40 | |||
41 | //@Constraint(severity="error", message="error", key = {r}) | ||
42 | pattern multipleEntryInRegion_M0(r : Region) { | ||
43 | find entryInRegion_M0(r, e1); | ||
44 | find entryInRegion_M0(r, e2); | ||
45 | e1 != e2; | ||
46 | } | ||
47 | pattern multipleEntryInRegion_M1(r : Region) { | ||
48 | find entryInRegion_M1(r, e1); | ||
49 | find entryInRegion_M0(r, e2); | ||
50 | e1 != e2; | ||
51 | } | ||
52 | pattern multipleEntryInRegion_M2(r : Region) { | ||
53 | find entryInRegion_M2(r, e1); | ||
54 | find entryInRegion_M0(r, e2); | ||
55 | e1 != e2; | ||
56 | } | ||
57 | pattern multipleEntryInRegion_M3(r : Region) { | ||
58 | find entryInRegion_M0(r, e1); | ||
59 | find entryInRegion_M1(r, e2); | ||
60 | e1 != e2; | ||
61 | } | ||
62 | pattern multipleEntryInRegion_M4(r : Region) { | ||
63 | find entryInRegion_M2(r, e1); | ||
64 | find entryInRegion_M2(r, e2); | ||
65 | e1 != e2; | ||
66 | } | ||
67 | pattern multipleEntryInRegion_M5(r : Region) { | ||
68 | find entryInRegion_M0(r, e1); | ||
69 | find entryInRegion_M0(r, e2); | ||
70 | } | ||
71 | |||
72 | |||
73 | pattern transition_M0(t : Transition, src : Vertex, trg : Vertex) { | ||
74 | Transition.source(t, src); | ||
75 | Transition.target(t, trg); | ||
76 | } | ||
77 | pattern transition_M1(t : Transition, src : Vertex, trg : Vertex) { | ||
78 | Transition.source(t, src); | ||
79 | Vertex(trg); | ||
80 | } | ||
81 | pattern transition_M2(t : Transition, src : Vertex, trg : Vertex) { | ||
82 | Vertex(src); | ||
83 | Transition.target(t, trg); | ||
84 | } | ||
85 | pattern transition_M3(t : Transition, src : Vertex, trg : Vertex) { | ||
86 | Transition.source(t_x, src); | ||
87 | Transition.target(t, trg); | ||
88 | } | ||
89 | pattern transition_M4(t : Transition, src : Vertex, trg : Vertex) { | ||
90 | Transition.source(t, src); | ||
91 | Transition.target(t_x, trg); | ||
92 | } | ||
93 | |||
94 | //@Constraint(severity="error", message="error", key = {e}) | ||
95 | pattern incomingToEntry_M0(t : Transition, e : Entry) { | ||
96 | find transition_M0(t, _, e); | ||
97 | } | ||
98 | pattern incomingToEntry_1(t : Transition, e) { | ||
99 | find transition_M0(t, _, e); | ||
100 | } | ||
101 | pattern incomingToEntry_2(t : Transition, e : Entry) { | ||
102 | find transition_M1(t, _, e); | ||
103 | } | ||
104 | pattern incomingToEntry_3(t : Transition, e : Entry) { | ||
105 | find transition_M2(t, _, e); | ||
106 | } | ||
107 | pattern incomingToEntry_4(t : Transition, e : Entry) { | ||
108 | find transition_M3(t, _, e); | ||
109 | } | ||
110 | pattern incomingToEntry_5(t : Transition, e : Entry) { | ||
111 | find transition_M4(t, _, e); | ||
112 | } | ||
113 | |||
114 | pattern noOutgoingTransitionFromEntry_M0(e : Entry) { | ||
115 | neg find transition_M0(_, e, _); | ||
116 | } | ||
117 | |||
118 | pattern noOutgoingTransitionFromEntry_M1(e) { | ||
119 | Vertex(e); | ||
120 | neg find transition_M0(_, e, _); | ||
121 | } | ||
122 | pattern noOutgoingTransitionFromEntry_M2(e : Entry) { | ||
123 | neg find transition_M1(_, e, _); | ||
124 | } | ||
125 | pattern noOutgoingTransitionFromEntry_M3(e : Entry) { | ||
126 | neg find transition_M2(_, e, _); | ||
127 | } | ||
128 | pattern noOutgoingTransitionFromEntry_M4(e : Entry) { | ||
129 | neg find transition_M3(_, e, _); | ||
130 | } | ||
131 | pattern noOutgoingTransitionFromEntry_M5(e : Entry) { | ||
132 | neg find transition_M4(_, e, _); | ||
133 | } | ||
134 | |||
135 | |||
136 | //@Constraint(severity="error", message="error", key = {e}) | ||
137 | pattern multipleTransitionFromEntry_M0(e : Entry, t1 : Transition, t2: Transition) { | ||
138 | Entry.outgoingTransitions(e,t1); | ||
139 | Entry.outgoingTransitions(e,t2); | ||
140 | t1!=t2; | ||
141 | } | ||
142 | pattern multipleTransitionFromEntry_M1(e, t1 : Transition, t2: Transition) { | ||
143 | Entry.outgoingTransitions(e,t1); | ||
144 | Entry.outgoingTransitions(e,t2); | ||
145 | t1!=t2; | ||
146 | } | ||
147 | pattern multipleTransitionFromEntry_M2(e : Entry, t1 : Transition, t2: Transition) { | ||
148 | Transition(t1); | ||
149 | Entry.outgoingTransitions(e,t2); | ||
150 | t1!=t2; | ||
151 | } | ||
152 | pattern multipleTransitionFromEntry_M3(e : Entry, t1 : Transition, t2: Transition) { | ||
153 | Entry.outgoingTransitions(e,t1); | ||
154 | Transition(t2); | ||
155 | t1!=t2; | ||
156 | } | ||
157 | pattern multipleTransitionFromEntry_M4(e : Entry, t1 : Transition, t2: Transition) { | ||
158 | Entry.outgoingTransitions(e,t1); | ||
159 | Entry.outgoingTransitions(e,t2); | ||
160 | } | ||
161 | |||
162 | ///////// | ||
163 | // Exit | ||
164 | ///////// | ||
165 | |||
166 | //@Constraint(severity="error", message="error", key = {e}) | ||
167 | pattern outgoingFromExit_M0(t : Transition, e : Exit) { | ||
168 | Exit.outgoingTransitions(e,t); | ||
169 | } | ||
170 | pattern outgoingFromExit_M1(t : Transition, e) { | ||
171 | Vertex.outgoingTransitions(e,t); | ||
172 | } | ||
173 | pattern outgoingFromExit_M2(t : Transition, e : Exit) { | ||
174 | Transition(t); | ||
175 | Exit(e); | ||
176 | } | ||
177 | |||
178 | ///////// | ||
179 | // Final | ||
180 | ///////// | ||
181 | |||
182 | //@Constraint(severity="error", message="error", key = {f}) | ||
183 | pattern outgoingFromFinal_M0(t : Transition, f : FinalState) { | ||
184 | FinalState.outgoingTransitions(f,t); | ||
185 | } | ||
186 | pattern outgoingFromFinal_M1(t : Transition, f) { | ||
187 | Vertex.outgoingTransitions(f,t); | ||
188 | } | ||
189 | pattern outgoingFromFinal_M2(t : Transition, f : FinalState) { | ||
190 | Transition(t); | ||
191 | FinalState(f); | ||
192 | } | ||
193 | |||
194 | ///////// | ||
195 | // State vs Region | ||
196 | ///////// | ||
197 | |||
198 | //@Constraint(severity="error", message="error", key = {region}) | ||
199 | pattern noStateInRegion_M0(region: Region) { | ||
200 | neg find StateInRegion_M0(region,_); | ||
201 | } | ||
202 | pattern noStateInRegion_M1(region: Region) { | ||
203 | neg find StateInRegion_M1(region,_); | ||
204 | } | ||
205 | pattern noStateInRegion_M2(region: Region) { | ||
206 | neg find StateInRegion_M2(region,_); | ||
207 | } | ||
208 | pattern noStateInRegion_M3(region: Region) { | ||
209 | find StateInRegion_M0(region,_); | ||
210 | } | ||
211 | |||
212 | pattern StateInRegion_M0(region: Region, state: State) { | ||
213 | Region.vertices(region,state); | ||
214 | } | ||
215 | pattern StateInRegion_M1(region: Region, state) { | ||
216 | Region.vertices(region,state); | ||
217 | } | ||
218 | pattern StateInRegion_M2(region: Region, state:State) { | ||
219 | Region(region);State(state); | ||
220 | } | ||
221 | |||
222 | ///////// | ||
223 | // Choice | ||
224 | ///////// | ||
225 | |||
226 | @Constraint(severity="error", message="error", key = {c}) | ||
227 | pattern choiceHasNoOutgoing_M0(c : Choice) { | ||
228 | neg find transition_M0(_, c, _); | ||
229 | } | ||
230 | pattern choiceHasNoOutgoing_M1(c:Vertex) { | ||
231 | neg find transition_M0(_, c, _); | ||
232 | } | ||
233 | pattern choiceHasNoOutgoing_M2(c : Choice) { | ||
234 | neg find transition_M1(_, c, _); | ||
235 | } | ||
236 | pattern choiceHasNoOutgoing_M3(c : Choice) { | ||
237 | neg find transition_M2(_, c, _); | ||
238 | } | ||
239 | pattern choiceHasNoOutgoing_M4(c : Choice) { | ||
240 | neg find transition_M3(_, c, _); | ||
241 | } | ||
242 | pattern choiceHasNoOutgoing_M5(c : Choice) { | ||
243 | neg find transition_M4(_, c, _); | ||
244 | } | ||
245 | pattern choiceHasNoOutgoing_M6(c : Choice) { | ||
246 | find transition_M0(_, c, _); | ||
247 | } | ||
248 | |||
249 | @Constraint(severity="error", message="error", key = {c}) | ||
250 | pattern choiceHasNoIncoming_M0(c: Choice) { | ||
251 | neg find transition_M0(_, _, c); | ||
252 | } | ||
253 | pattern choiceHasNoIncoming_M1(c:Vertex) { | ||
254 | neg find transition_M0(_, _, c); | ||
255 | } | ||
256 | pattern choiceHasNoIncoming_M2(c: Choice) { | ||
257 | neg find transition_M1(_, _, c); | ||
258 | } | ||
259 | pattern choiceHasNoIncoming_M3(c: Choice) { | ||
260 | neg find transition_M2(_, _, c); | ||
261 | } | ||
262 | pattern choiceHasNoIncoming_M4(c: Choice) { | ||
263 | neg find transition_M3(_, _, c); | ||
264 | } | ||
265 | pattern choiceHasNoIncoming_M5(c: Choice) { | ||
266 | neg find transition_M4(_, _, c); | ||
267 | } | ||
268 | pattern choiceHasNoIncoming_M6(c: Choice) { | ||
269 | find transition_M0(_, _, c); | ||
270 | } | ||
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql new file mode 100644 index 00000000..597b1691 --- /dev/null +++ b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql | |||
@@ -0,0 +1,227 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries | ||
2 | |||
3 | import epackage "YakinduMetamodel" | ||
4 | |||
5 | ///////// | ||
6 | // Entry | ||
7 | ///////// | ||
8 | |||
9 | pattern entryInRegion(r1 : Region, e1 : Entry) { | ||
10 | Region.vertices(r1, e1); | ||
11 | } | ||
12 | |||
13 | @Constraint(severity="error", message="error", key = {r1}) | ||
14 | pattern noEntryInRegion(r1 : Region) { | ||
15 | neg find entryInRegion(r1, _); | ||
16 | } | ||
17 | |||
18 | @Constraint(severity="error", message="error", key = {r}) | ||
19 | pattern multipleEntryInRegion(r : Region) { | ||
20 | find entryInRegion(r, e1); | ||
21 | find entryInRegion(r, e2); | ||
22 | e1 != e2; | ||
23 | } | ||
24 | |||
25 | pattern transition(t : Transition, src : Vertex, trg : Vertex) { | ||
26 | Transition.source(t, src); | ||
27 | Transition.target(t, trg); | ||
28 | } | ||
29 | |||
30 | @Constraint(severity="error", message="error", key = {e}) | ||
31 | pattern incomingToEntry(t : Transition, e : Entry) { | ||
32 | find transition(t, _, e); | ||
33 | } | ||
34 | |||
35 | @Constraint(severity="error", message="error", key = {e}) | ||
36 | pattern noOutgoingTransitionFromEntry(e : Entry) { | ||
37 | neg find transition(_, e, _); | ||
38 | } | ||
39 | |||
40 | @Constraint(severity="error", message="error", key = {e}) | ||
41 | pattern multipleTransitionFromEntry(e : Entry, t1 : Transition, t2: Transition) { | ||
42 | Entry.outgoingTransitions(e,t1); | ||
43 | Entry.outgoingTransitions(e,t2); | ||
44 | t1!=t2; | ||
45 | } | ||
46 | |||
47 | ///////// | ||
48 | // Exit | ||
49 | ///////// | ||
50 | |||
51 | @Constraint(severity="error", message="error", key = {e}) | ||
52 | pattern outgoingFromExit(t : Transition, e : Exit) { | ||
53 | Exit.outgoingTransitions(e,t); | ||
54 | } | ||
55 | |||
56 | ///////// | ||
57 | // Final | ||
58 | ///////// | ||
59 | |||
60 | @Constraint(severity="error", message="error", key = {f}) | ||
61 | pattern outgoingFromFinal(t : Transition, f : FinalState) { | ||
62 | FinalState.outgoingTransitions(f,t); | ||
63 | } | ||
64 | |||
65 | ///////// | ||
66 | // State vs Region | ||
67 | ///////// | ||
68 | |||
69 | @Constraint(severity="error", message="error", key = {region}) | ||
70 | pattern noStateInRegion(region: Region) { | ||
71 | neg find StateInRegion(region,_); | ||
72 | } | ||
73 | pattern StateInRegion(region: Region, state: State) { | ||
74 | Region.vertices(region,state); | ||
75 | } | ||
76 | |||
77 | ///////// | ||
78 | // Choice | ||
79 | ///////// | ||
80 | |||
81 | @Constraint(severity="error", message="error", key = {c}) | ||
82 | pattern choiceHasNoOutgoing(c : Choice) { | ||
83 | neg find transition(_, c, _); | ||
84 | } | ||
85 | |||
86 | @Constraint(severity="error", message="error", key = {c}) | ||
87 | pattern choiceHasNoIncoming(c: Choice) { | ||
88 | neg find transition(_, _, c); | ||
89 | } | ||
90 | |||
91 | ///////// | ||
92 | // Synchronization | ||
93 | ///////// | ||
94 | |||
95 | @Constraint(severity="error", message="error", key = {s}) | ||
96 | pattern synchHasNoOutgoing(s : Synchronization) { | ||
97 | neg find transition(_, s, _); | ||
98 | } | ||
99 | |||
100 | @Constraint(severity="error", message="error", key = {s}) | ||
101 | pattern synchHasNoIncoming(s : Synchronization) { | ||
102 | neg find transition(_, _, s); | ||
103 | } | ||
104 | |||
105 | @Constraint(severity="error", message="error", key = {s}) | ||
106 | pattern SynchronizedIncomingInSameRegion(s : Synchronization, v1 : Vertex, v2 : Vertex) { | ||
107 | find transition(t1, v1, s); | ||
108 | find transition(t2, v2, s); | ||
109 | t1!=t2; | ||
110 | Region.vertices(r, v1); | ||
111 | Region.vertices(r, v2); | ||
112 | } or { | ||
113 | find transition(t1, s, v1); | ||
114 | find transition(t2, s, v2); | ||
115 | t1!=t2; | ||
116 | Region.vertices(r, v1); | ||
117 | Region.vertices(r, v2); | ||
118 | } | ||
119 | |||
120 | @Constraint(severity="error", message="error", key = {s}) | ||
121 | pattern notSynchronizingStates(s : Synchronization) { | ||
122 | neg find hasMultipleOutgoingTrainsition(s); | ||
123 | neg find hasMultipleIncomingTrainsition(s); | ||
124 | } | ||
125 | |||
126 | pattern hasMultipleOutgoingTrainsition(v : Synchronization) { | ||
127 | find transition(_, v, trg1); | ||
128 | find transition(_, v, trg2); | ||
129 | trg1 != trg2; | ||
130 | } | ||
131 | |||
132 | pattern hasMultipleIncomingTrainsition(v : Synchronization) { | ||
133 | find transition(_, src1, v); | ||
134 | find transition(_, src2, v); | ||
135 | src1 != src2; | ||
136 | } | ||
137 | |||
138 | @Constraint(severity="error", message="error", key = {s}) | ||
139 | pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) { | ||
140 | find transition(_, v1, s); | ||
141 | find transition(_, v2, s); | ||
142 | CompositeElement.regions.vertices(r1, v1); | ||
143 | CompositeElement.regions.vertices(r2, v2); | ||
144 | r1 != r2; | ||
145 | } or { | ||
146 | find transition(_, s, v1); | ||
147 | find transition(_, s, v2); | ||
148 | CompositeElement.regions.vertices(r1, v1); | ||
149 | CompositeElement.regions.vertices(r2, v2); | ||
150 | r1 != r2; | ||
151 | } | ||
152 | |||
153 | /////////////////////////////// | ||
154 | // Extra | ||
155 | // | ||
156 | //@Constraint(severity="error", message="error", key = {s}) | ||
157 | //pattern SynchronizedRegionDoesNotHaveParent(s : Synchronization, v : Vertex) { | ||
158 | // find transition(_, v, s); | ||
159 | // neg find child(_,v); | ||
160 | //} or { | ||
161 | // find transition(_, s, v); | ||
162 | // neg find child(_,v); | ||
163 | //} | ||
164 | |||
165 | pattern child(parent: CompositeElement, child: Vertex) { | ||
166 | CompositeElement.regions.vertices(parent, child); | ||
167 | } | ||
168 | |||
169 | @Constraint(severity="error", message="error", key = {s}) | ||
170 | pattern SynchronizedRegionDoesNotHaveMultipleRegions(s : Synchronization, v : Vertex) { | ||
171 | find transition(_, v, s); | ||
172 | find child(c,v); | ||
173 | neg find hasMultipleRegions(c); | ||
174 | } or { | ||
175 | find transition(_, s, v); | ||
176 | find child(c,v); | ||
177 | neg find hasMultipleRegions(c); | ||
178 | } | ||
179 | |||
180 | |||
181 | pattern hasMultipleRegions(composite: CompositeElement) { | ||
182 | CompositeElement.regions(composite,region1); | ||
183 | CompositeElement.regions(composite,region2); | ||
184 | region1 != region2; | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * Simplifying model generation | ||
189 | */ | ||
190 | @Constraint(severity="error", message="error", key = {s}) | ||
191 | pattern synchThree(s: Synchronization) { | ||
192 | Transition.target(t1,s); | ||
193 | Transition.target(t2,s); | ||
194 | Transition.target(t3,s); | ||
195 | t1!=t2; | ||
196 | t2!=t3; | ||
197 | t1!=t3; | ||
198 | } or { | ||
199 | Transition.source(t1,s); | ||
200 | Transition.source(t2,s); | ||
201 | Transition.source(t3,s); | ||
202 | t1!=t2; | ||
203 | t2!=t3; | ||
204 | t1!=t3; | ||
205 | } | ||
206 | |||
207 | /** | ||
208 | * Simplifying model generation | ||
209 | */ | ||
210 | @Constraint(severity="error", message="error", key = {s1,s2}) | ||
211 | pattern twoSynch(s1 : Synchronization, s2 : Synchronization) { | ||
212 | Synchronization(s1); | ||
213 | Synchronization(s2); | ||
214 | s1 != s2; | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * Model generation task: at least one synch | ||
219 | */ | ||
220 | //@Constraint(severity="error", message="error", key = {s}) | ||
221 | //pattern noSynch(s:Statechart) { | ||
222 | // Statechart(s); | ||
223 | // neg find synch(_); | ||
224 | //} | ||
225 | //pattern synch(s:Synchronization) { | ||
226 | // Synchronization(s); | ||
227 | //} \ No newline at end of file | ||