diff options
Diffstat (limited to 'Tests/ca.mcgill.ecse.dslreasoner.yakindu.test/input/yakinduPatterns.vql_')
-rw-r--r-- | Tests/ca.mcgill.ecse.dslreasoner.yakindu.test/input/yakinduPatterns.vql_ | 227 |
1 files changed, 227 insertions, 0 deletions
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.yakindu.test/input/yakinduPatterns.vql_ b/Tests/ca.mcgill.ecse.dslreasoner.yakindu.test/input/yakinduPatterns.vql_ new file mode 100644 index 00000000..f52113ca --- /dev/null +++ b/Tests/ca.mcgill.ecse.dslreasoner.yakindu.test/input/yakinduPatterns.vql_ | |||
@@ -0,0 +1,227 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.yakindu.queries | ||
2 | |||
3 | import epackage "hu.bme.mit.inf.yakindumm" | ||
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 | ||