diff options
author | 20001LastOrder <boqi.chen@mail.mcgill.ca> | 2020-11-15 21:56:45 -0500 |
---|---|---|
committer | 20001LastOrder <boqi.chen@mail.mcgill.ca> | 2020-11-15 21:56:45 -0500 |
commit | 1cfc2e98ffbba1dc2a489ad415c81264b76d8c14 (patch) | |
tree | b342c3541a5728b775564d8a0f5c6e6d93784694 /Metrics/Metrics-Calculation/RealisticRunner/queries | |
parent | fix node type distance measure (diff) | |
download | VIATRA-Generator-1cfc2e98ffbba1dc2a489ad415c81264b76d8c14.tar.gz VIATRA-Generator-1cfc2e98ffbba1dc2a489ad415c81264b76d8c14.tar.zst VIATRA-Generator-1cfc2e98ffbba1dc2a489ad415c81264b76d8c14.zip |
code for paperRealistic-Generation-SURE
Diffstat (limited to 'Metrics/Metrics-Calculation/RealisticRunner/queries')
3 files changed, 380 insertions, 0 deletions
diff --git a/Metrics/Metrics-Calculation/RealisticRunner/queries/ecore.vql b/Metrics/Metrics-Calculation/RealisticRunner/queries/ecore.vql new file mode 100644 index 00000000..9ddb64c9 --- /dev/null +++ b/Metrics/Metrics-Calculation/RealisticRunner/queries/ecore.vql | |||
@@ -0,0 +1,33 @@ | |||
1 | package queries | ||
2 | |||
3 | import epackage "http://www.eclipse.org/emf/2002/Ecore" | ||
4 | |||
5 | pattern directSupertype(a: EClass, b:EClass) { | ||
6 | EClass.eSuperTypes(a,b); | ||
7 | } | ||
8 | |||
9 | @Constraint(key={a}, severity="error", message="error") | ||
10 | pattern loopInInheritence(a: EClass) { | ||
11 | find directSupertype+(a,a); | ||
12 | } | ||
13 | |||
14 | pattern opposite(a:EReference, b: EReference) { | ||
15 | EReference.eOpposite(a,b); | ||
16 | } | ||
17 | @Constraint(key={a}, severity="error", message="error") | ||
18 | pattern oppositeDifferentClass(a:EReference) { | ||
19 | EReference.eOpposite(a,b); | ||
20 | EReference.eContainingClass(a,aContaining); | ||
21 | EReference.eType(b,bTarget); | ||
22 | aContaining != bTarget; | ||
23 | } | ||
24 | |||
25 | @Constraint(key={a}, severity="error", message="error") | ||
26 | pattern nonSymmetricOpposite(a:EReference, b:EReference) { | ||
27 | find opposite(a,b); | ||
28 | neg find opposite(b,a); | ||
29 | } | ||
30 | |||
31 | pattern superTypes(c1:EClass, c2:EClass){ | ||
32 | EClass.eSuperTypes(c1,c2); | ||
33 | } | ||
diff --git a/Metrics/Metrics-Calculation/RealisticRunner/queries/github.vql b/Metrics/Metrics-Calculation/RealisticRunner/queries/github.vql new file mode 100644 index 00000000..eda5f0f1 --- /dev/null +++ b/Metrics/Metrics-Calculation/RealisticRunner/queries/github.vql | |||
@@ -0,0 +1,121 @@ | |||
1 | package queries | ||
2 | import epackage "sure.ghtorrent.github" | ||
3 | |||
4 | pattern directParent(a : Commit, b: Commit) { | ||
5 | Commit.parents(a,b); | ||
6 | } | ||
7 | |||
8 | @Constraint(key={a}, severity="error", message="error") | ||
9 | pattern loopInParent(a: Commit){ | ||
10 | find directParent+(a,a); | ||
11 | } | ||
12 | |||
13 | pattern checkAction(i: Issue, e: IssueEvent, t: Action) { | ||
14 | Issue.issueevent(i, e); | ||
15 | IssueEvent.action(e, a); | ||
16 | a == t; | ||
17 | } | ||
18 | |||
19 | pattern checkUserAction(i: Issue, u: User, e: IssueEvent, t: Action) { | ||
20 | Issue.issueevent(i, e); | ||
21 | IssueEvent.user(e, u); | ||
22 | IssueEvent.action(e, a); | ||
23 | a == t; | ||
24 | } | ||
25 | |||
26 | pattern isReopen(i: Issue, e: IssueEvent) { | ||
27 | Issue.issueevent(i, e); | ||
28 | IssueEvent.action(e, a); | ||
29 | a == Action::REOPENED; | ||
30 | } | ||
31 | |||
32 | pattern isClose(i: Issue, e: IssueEvent) { | ||
33 | Issue.issueevent(i, e); | ||
34 | IssueEvent.action(e, a); | ||
35 | a == Action::CLOSED; | ||
36 | } | ||
37 | |||
38 | pattern isUnSubscribe(i: Issue, u: User, e: IssueEvent) { | ||
39 | Issue.issueevent(i, e); | ||
40 | IssueEvent.user(e, u); | ||
41 | IssueEvent.action(e, a); | ||
42 | a == Action::UNSUBSCRIBED; | ||
43 | } | ||
44 | |||
45 | pattern isSubscribe(i: Issue, u: User, e: IssueEvent) { | ||
46 | Issue.issueevent(i, e); | ||
47 | IssueEvent.user(e, u); | ||
48 | IssueEvent.action(e, a); | ||
49 | a == Action::SUBSCRIBED; | ||
50 | } | ||
51 | |||
52 | |||
53 | pattern pullRequestOfIssue(i: Issue, pr: PullRequest) { | ||
54 | Issue.pullrequest(i, pr); | ||
55 | } | ||
56 | |||
57 | //@Constraint(key={i}, severity="error", message="error") | ||
58 | //pattern mergedIssueWithoutPr(i: Issue){ | ||
59 | // find checkAction(i, _, Action::MERGED); | ||
60 | // neg find pullRequestOfIssue(i, _); | ||
61 | //} | ||
62 | |||
63 | @Constraint(key={i}, severity="error", message="error") | ||
64 | pattern consecutiveClosesWithoutReopen(i: Issue) { | ||
65 | find checkAction(i, a1, Action::CLOSED); | ||
66 | find checkAction(i, a2, Action::CLOSED); | ||
67 | a1 != a2; | ||
68 | neg find isReopen(i, _); | ||
69 | } | ||
70 | |||
71 | |||
72 | @Constraint(key={i}, severity="error", message="error") | ||
73 | pattern consecutiveReopensWithoutClose(i: Issue) { | ||
74 | find checkAction(i, a1, Action::REOPENED); | ||
75 | find checkAction(i, a2, Action::REOPENED); | ||
76 | a1 != a2; | ||
77 | neg find isClose(i, _); | ||
78 | } | ||
79 | |||
80 | //@Constraint(key={i, u}, severity="error", message="error") | ||
81 | //pattern consecutiveSubWithoutUnSub(i: Issue, u: User) { | ||
82 | // find checkUserAction(i, u, a1, Action::SUBSCRIBED); | ||
83 | // find checkUserAction(i, u, a2, Action::SUBSCRIBED); | ||
84 | // a1 != a2; | ||
85 | // neg find isUnSubscribe(i, u, _); | ||
86 | //} | ||
87 | |||
88 | @Constraint(key={i, u}, severity="error", message="error") | ||
89 | pattern consecutiveUnSubWithoutSub(i: Issue, u: User) { | ||
90 | find checkUserAction(i, u, a1, Action::UNSUBSCRIBED); | ||
91 | find checkUserAction(i, u, a2, Action::UNSUBSCRIBED); | ||
92 | a1 != a2; | ||
93 | neg find isSubscribe(i, u, _); | ||
94 | } | ||
95 | |||
96 | //pattern committer(c: Commit, u:User) { | ||
97 | // Commit.committer(c, u); | ||
98 | //} | ||
99 | // | ||
100 | //pattern eventUser(e: IssueEvent, u:User){ | ||
101 | // IssueEvent.user(e, u); | ||
102 | //} | ||
103 | // | ||
104 | //@Constraint(key={c}, severity="error", message="error") | ||
105 | //pattern noCommitter(c: Commit) { | ||
106 | // neg find committer(c, _); | ||
107 | //} | ||
108 | // | ||
109 | //@Constraint(key={e}, severity="error", message="error") | ||
110 | //pattern noUser(e: IssueEvent) { | ||
111 | // neg find eventUser(e, _); | ||
112 | //} | ||
113 | |||
114 | |||
115 | |||
116 | //1. issue with MERGED but no PullRequest | ||
117 | //2. issue with 2 CLOSED events without a REOPENED event | ||
118 | //3. issue with 2 REOPENED events without a CLOSED event | ||
119 | //4. user-issue pair with 2 SUBSCRIBED events without an UNSUBSCRIBED event | ||
120 | //5. user-issue pair with 2 UNSUBSCRIBED events without a SUBSCRIBED event | ||
121 | //6. User MERGED/CLOSED/REOPENED issue without being a projectMember of the Project (Not possible under this condition) \ No newline at end of file | ||
diff --git a/Metrics/Metrics-Calculation/RealisticRunner/queries/yakindu.vql b/Metrics/Metrics-Calculation/RealisticRunner/queries/yakindu.vql new file mode 100644 index 00000000..0d863ed2 --- /dev/null +++ b/Metrics/Metrics-Calculation/RealisticRunner/queries/yakindu.vql | |||
@@ -0,0 +1,226 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu | ||
2 | import epackage "hu.bme.mit.inf.yakindumm" | ||
3 | |||
4 | ///////// | ||
5 | // Entry | ||
6 | ///////// | ||
7 | |||
8 | pattern entryInRegion(r1 : Region, e1 : Entry) { | ||
9 | Region.vertices(r1, e1); | ||
10 | } | ||
11 | |||
12 | @Constraint(severity="error", message="error", key = {r1}) | ||
13 | pattern noEntryInRegion(r1 : Region) { | ||
14 | neg find entryInRegion(r1, _); | ||
15 | } | ||
16 | |||
17 | @Constraint(severity="error", message="error", key = {r}) | ||
18 | pattern multipleEntryInRegion(r : Region) { | ||
19 | find entryInRegion(r, e1); | ||
20 | find entryInRegion(r, e2); | ||
21 | e1 != e2; | ||
22 | } | ||
23 | |||
24 | pattern transition(t : Transition, src : Vertex, trg : Vertex) { | ||
25 | Transition.source(t, src); | ||
26 | Transition.target(t, trg); | ||
27 | } | ||
28 | |||
29 | @Constraint(severity="error", message="error", key = {e}) | ||
30 | pattern incomingToEntry(t : Transition, e : Entry) { | ||
31 | find transition(t, _, e); | ||
32 | } | ||
33 | |||
34 | @Constraint(severity="error", message="error", key = {e}) | ||
35 | pattern noOutgoingTransitionFromEntry(e : Entry) { | ||
36 | neg find transition(_, e, _); | ||
37 | } | ||
38 | |||
39 | @Constraint(severity="error", message="error", key = {e}) | ||
40 | pattern multipleTransitionFromEntry(e : Entry, t1 : Transition, t2: Transition) { | ||
41 | Entry.outgoingTransitions(e,t1); | ||
42 | Entry.outgoingTransitions(e,t2); | ||
43 | t1!=t2; | ||
44 | } | ||
45 | |||
46 | ///////// | ||
47 | // Exit | ||
48 | ///////// | ||
49 | |||
50 | @Constraint(severity="error", message="error", key = {e}) | ||
51 | pattern outgoingFromExit(t : Transition, e : Exit) { | ||
52 | Exit.outgoingTransitions(e,t); | ||
53 | } | ||
54 | |||
55 | ///////// | ||
56 | // Final | ||
57 | ///////// | ||
58 | |||
59 | @Constraint(severity="error", message="error", key = {f}) | ||
60 | pattern outgoingFromFinal(t : Transition, f : FinalState) { | ||
61 | FinalState.outgoingTransitions(f,t); | ||
62 | } | ||
63 | |||
64 | ///////// | ||
65 | // State vs Region | ||
66 | ///////// | ||
67 | |||
68 | @Constraint(severity="error", message="error", key = {region}) | ||
69 | pattern noStateInRegion(region: Region) { | ||
70 | neg find StateInRegion(region,_); | ||
71 | } | ||
72 | pattern StateInRegion(region: Region, state: State) { | ||
73 | Region.vertices(region,state); | ||
74 | } | ||
75 | |||
76 | ///////// | ||
77 | // Choice | ||
78 | ///////// | ||
79 | |||
80 | @Constraint(severity="error", message="error", key = {c}) | ||
81 | pattern choiceHasNoOutgoing(c : Choice) { | ||
82 | neg find transition(_, c, _); | ||
83 | } | ||
84 | |||
85 | @Constraint(severity="error", message="error", key = {c}) | ||
86 | pattern choiceHasNoIncoming(c: Choice) { | ||
87 | neg find transition(_, _, c); | ||
88 | } | ||
89 | |||
90 | ///////// | ||
91 | // Synchronization | ||
92 | ///////// | ||
93 | |||
94 | //@Constraint(severity="error", message="error", key = {s}) | ||
95 | //pattern synchHasNoOutgoing(s : Synchronization) { | ||
96 | // neg find transition(_, s, _); | ||
97 | //} | ||
98 | // | ||
99 | //@Constraint(severity="error", message="error", key = {s}) | ||
100 | //pattern synchHasNoIncoming(s : Synchronization) { | ||
101 | // neg find transition(_, _, s); | ||
102 | //} | ||
103 | // | ||
104 | //@Constraint(severity="error", message="error", key = {s}) | ||
105 | //pattern SynchronizedIncomingInSameRegion(s : Synchronization, v1 : Vertex, v2 : Vertex) { | ||
106 | // find transition(t1, v1, s); | ||
107 | // find transition(t2, v2, s); | ||
108 | // t1!=t2; | ||
109 | // Region.vertices(r, v1); | ||
110 | // Region.vertices(r, v2); | ||
111 | //} or { | ||
112 | // find transition(t1, s, v1); | ||
113 | // find transition(t2, s, v2); | ||
114 | // t1!=t2; | ||
115 | // Region.vertices(r, v1); | ||
116 | // Region.vertices(r, v2); | ||
117 | //} | ||
118 | // | ||
119 | //@Constraint(severity="error", message="error", key = {s}) | ||
120 | //pattern notSynchronizingStates(s : Synchronization) { | ||
121 | // neg find hasMultipleOutgoingTrainsition(s); | ||
122 | // neg find hasMultipleIncomingTrainsition(s); | ||
123 | //} | ||
124 | |||
125 | //pattern hasMultipleOutgoingTrainsition(v : Synchronization) { | ||
126 | // find transition(_, v, trg1); | ||
127 | // find transition(_, v, trg2); | ||
128 | // trg1 != trg2; | ||
129 | //} | ||
130 | // | ||
131 | //pattern hasMultipleIncomingTrainsition(v : Synchronization) { | ||
132 | // find transition(_, src1, v); | ||
133 | // find transition(_, src2, v); | ||
134 | // src1 != src2; | ||
135 | //} | ||
136 | // | ||
137 | //@Constraint(severity="error", message="error", key = {s}) | ||
138 | //pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) { | ||
139 | // find transition(_, v1, s); | ||
140 | // find transition(_, v2, s); | ||
141 | // CompositeElement.regions.vertices(r1, v1); | ||
142 | // CompositeElement.regions.vertices(r2, v2); | ||
143 | // r1 != r2; | ||
144 | //} or { | ||
145 | // find transition(_, s, v1); | ||
146 | // find transition(_, s, v2); | ||
147 | // CompositeElement.regions.vertices(r1, v1); | ||
148 | // CompositeElement.regions.vertices(r2, v2); | ||
149 | // r1 != r2; | ||
150 | //} | ||
151 | |||
152 | /////////////////////////////// | ||
153 | // Extra | ||
154 | // | ||
155 | //@Constraint(severity="error", message="error", key = {s}) | ||
156 | //pattern SynchronizedRegionDoesNotHaveParent(s : Synchronization, v : Vertex) { | ||
157 | // find transition(_, v, s); | ||
158 | // neg find child(_,v); | ||
159 | //} or { | ||
160 | // find transition(_, s, v); | ||
161 | // neg find child(_,v); | ||
162 | //} | ||
163 | |||
164 | pattern child(parent: CompositeElement, child: Vertex) { | ||
165 | CompositeElement.regions.vertices(parent, child); | ||
166 | } | ||
167 | |||
168 | //@Constraint(severity="error", message="error", key = {s}) | ||
169 | //pattern SynchronizedRegionDoesNotHaveMultipleRegions(s : Synchronization, v : Vertex) { | ||
170 | // find transition(_, v, s); | ||
171 | // find child(c,v); | ||
172 | // neg find hasMultipleRegions(c); | ||
173 | //} or { | ||
174 | // find transition(_, s, v); | ||
175 | // find child(c,v); | ||
176 | // neg find hasMultipleRegions(c); | ||
177 | //} | ||
178 | |||
179 | |||
180 | pattern hasMultipleRegions(composite: CompositeElement) { | ||
181 | CompositeElement.regions(composite,region1); | ||
182 | CompositeElement.regions(composite,region2); | ||
183 | region1 != region2; | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * Simplifying model generation | ||
188 | */ | ||
189 | //@Constraint(severity="error", message="error", key = {s}) | ||
190 | //pattern synchThree(s: Synchronization) { | ||
191 | // Transition.target(t1,s); | ||
192 | // Transition.target(t2,s); | ||
193 | // Transition.target(t3,s); | ||
194 | // t1!=t2; | ||
195 | // t2!=t3; | ||
196 | // t1!=t3; | ||
197 | //} or { | ||
198 | // Transition.source(t1,s); | ||
199 | // Transition.source(t2,s); | ||
200 | // Transition.source(t3,s); | ||
201 | // t1!=t2; | ||
202 | // t2!=t3; | ||
203 | // t1!=t3; | ||
204 | //} | ||
205 | |||
206 | /** | ||
207 | * Simplifying model generation | ||
208 | */ | ||
209 | //@Constraint(severity="error", message="error", key = {s1,s2}) | ||
210 | //pattern twoSynch(s1 : Synchronization, s2 : Synchronization) { | ||
211 | // Synchronization(s1); | ||
212 | // Synchronization(s2); | ||
213 | // s1 != s2; | ||
214 | //} | ||
215 | |||
216 | /** | ||
217 | * Model generation task: at least one synch | ||
218 | */ | ||
219 | //@Constraint(severity="error", message="error", key = {s}) | ||
220 | //pattern noSynch(s:Statechart) { | ||
221 | // Statechart(s); | ||
222 | // neg find synch(_); | ||
223 | //} | ||
224 | //pattern synch(s:Synchronization) { | ||
225 | // Synchronization(s); | ||
226 | //} \ No newline at end of file | ||