diff options
Diffstat (limited to 'Domains/crossingScenario/queries')
-rw-r--r-- | Domains/crossingScenario/queries/crossingScenarioQueries.vql | 167 |
1 files changed, 115 insertions, 52 deletions
diff --git a/Domains/crossingScenario/queries/crossingScenarioQueries.vql b/Domains/crossingScenario/queries/crossingScenarioQueries.vql index 7089d0da..ee7c0b34 100644 --- a/Domains/crossingScenario/queries/crossingScenarioQueries.vql +++ b/Domains/crossingScenario/queries/crossingScenarioQueries.vql | |||
@@ -3,26 +3,18 @@ package queries | |||
3 | import "http://www.example.com/crossingScenario" | 3 | import "http://www.example.com/crossingScenario" |
4 | import "http://www.eclipse.org/emf/2002/Ecore" | 4 | import "http://www.eclipse.org/emf/2002/Ecore" |
5 | 5 | ||
6 | ////Minimal Failing Example | 6 | //////Minimal Failing Example |
7 | @Constraint(severity = "error", key = {l}, message = "this defines the placedOn relation") | 7 | //@Constraint(severity = "error", key = {l}, message = "this defines the placedOn relation") |
8 | pattern patterThatOnlyWorksWithInt(l : Lane) { | 8 | //pattern patterThatOnlyWorksWithInt(l : Lane) { |
9 | Lane.referenceCoord(l, w); | 9 | // Lane.referenceCoord(l, w); |
10 | check(w <= 0-10.0); | 10 | // check(w <= 0-10.0); |
11 | } | 11 | //} |
12 | 12 | ||
13 | ////////////// | 13 | ////////////// |
14 | //Lane | 14 | //Lane |
15 | ////////////// | 15 | ////////////// |
16 | 16 | ||
17 | /////////width, numWidth | 17 | @Constraint(severity="error", key={l}, message="1 Lane") |
18 | //@Constraint(severity="error", key={l}, message="x") | ||
19 | //pattern define_numWidth_small1(l : Lane) { | ||
20 | // Lane.width(l, Size::S_Small); | ||
21 | // Lane.numWidth(l, nw); | ||
22 | // check(nw >= 5.0); | ||
23 | //} | ||
24 | |||
25 | @Constraint(severity="error", key={l}, message="x") | ||
26 | pattern define_numWidth_small(l : Lane) { | 18 | pattern define_numWidth_small(l : Lane) { |
27 | Lane.width(l, Size::S_Small); | 19 | Lane.width(l, Size::S_Small); |
28 | Lane.numWidth(l, nw); | 20 | Lane.numWidth(l, nw); |
@@ -33,7 +25,7 @@ pattern define_numWidth_small(l : Lane) { | |||
33 | check(nw >= 10.0); | 25 | check(nw >= 10.0); |
34 | } | 26 | } |
35 | 27 | ||
36 | @Constraint(severity="error", key={l}, message="x") | 28 | @Constraint(severity="error", key={l}, message="2 Lane") |
37 | pattern define_numWidth_medium(l : Lane) { | 29 | pattern define_numWidth_medium(l : Lane) { |
38 | Lane.width(l, ::S_Med); | 30 | Lane.width(l, ::S_Med); |
39 | Lane.numWidth(l, nw); | 31 | Lane.numWidth(l, nw); |
@@ -45,7 +37,7 @@ or { | |||
45 | check(nw >= 15.0); | 37 | check(nw >= 15.0); |
46 | } | 38 | } |
47 | 39 | ||
48 | @Constraint(severity="error", key={l}, message="x") | 40 | @Constraint(severity="error", key={l}, message="3 Lane") |
49 | pattern define_numWidth_large(l : Lane) { | 41 | pattern define_numWidth_large(l : Lane) { |
50 | Lane.width(l, Size::S_Large); | 42 | Lane.width(l, Size::S_Large); |
51 | Lane.numWidth(l, nw); | 43 | Lane.numWidth(l, nw); |
@@ -57,41 +49,112 @@ or { | |||
57 | check(nw >= 20.0); | 49 | check(nw >= 20.0); |
58 | } | 50 | } |
59 | 51 | ||
60 | ///////////referenceCoord | 52 | /////////////Prevlane |
61 | //@Constraint(severity="error", key={l}, message="x") | 53 | |
62 | //pattern define_referenceCoord_horizontalAtOrigin(l:Lane) { | 54 | ////////head lanes do not have prevLane |
63 | // 1 == count find find_horizontalLaneAtOrigin(l); | 55 | @Constraint(severity="error", key={l}, message="6.1 Lane") |
64 | //} | 56 | pattern define_prevLane_headVertLaneDoesNotHavePrevLane(cs:CrossingScenario, l:Lane_Vertical) { |
65 | // | 57 | CrossingScenario.vertical_head(cs, l); |
66 | //private pattern find_horizontalLaneAtOrigin(l:Lane){ | 58 | Lane.prevLane(l, _); |
67 | // Lane.orientation(l, Orientation::Horizontal); | 59 | } |
68 | // Lane.referenceCoord(l, rc); | 60 | |
69 | // Lane.prevLane(l, _); | 61 | @Constraint(severity="error", key={l}, message="6.2 Lane") |
70 | // rc != 0.0; | 62 | pattern define_prevLane_headHoriLaneDoesNotHavePrevLane(cs:CrossingScenario, l:Lane_Horizontal) { |
71 | //} | 63 | CrossingScenario.horizontal_head(cs, l); |
72 | // | 64 | Lane.prevLane(l, _); |
73 | //@Constraint(severity="error", key={l}, message="x") | 65 | } |
74 | //pattern define_referenceCoord_verticalAtOrigin(l:Lane) { | 66 | |
75 | // 1 == count find find_verticalLaneAtOrigin(l); | 67 | ////////Non-head lanes must have prevLane |
76 | //} | 68 | @Constraint(severity="error", key={l}, message="6.1 Lane") |
77 | // | 69 | pattern define_prevLane_nonheadVertLaneHasPrevLane(l:Lane_Vertical) { |
78 | //private pattern find_verticalLaneAtOrigin(l:Lane){ | 70 | neg find find_headVertLane(l); |
79 | // Lane.orientation(l, Orientation::Vertical); | 71 | neg find find_laneWithPrevLane(l); |
80 | // Lane.referenceCoord(l, rc); | 72 | } |
81 | // rc == 0.0; | 73 | |
82 | //} | 74 | @Constraint(severity="error", key={l}, message="6.1 Lane") |
83 | // | 75 | pattern define_prevLane_nonheadHoriLaneHasPrevLane(l:Lane_Horizontal) { |
84 | //pattern define_referenceCoord_VerticalifMultipleLanes(l1:Lane, l2:Lane) { | 76 | neg find find_headHoriLane(l); |
85 | // //calculated risk??? | 77 | neg find find_laneWithPrevLane(l); |
86 | // Lane.orientation(l1, Orientation::Vertical); | 78 | } |
87 | // Lane.orientation(l2, Orientation::Vertical); | 79 | |
88 | // Lane.referenceCoord(l1, rc1); | 80 | private pattern find_headVertLane(l:Lane_Vertical) { |
89 | // Lane.numWidth(l1, nw1); | 81 | CrossingScenario.vertical_head(_, l); |
90 | // Lane.referenceCoord(l2, rc2); | 82 | } |
91 | // check(rc2 == rc1 + nw1); | 83 | private pattern find_headHoriLane(l:Lane_Horizontal) { |
92 | //} | 84 | CrossingScenario.horizontal_head(_, l); |
93 | // | 85 | } |
94 | // | 86 | private pattern find_laneWithPrevLane(l:Lane) { |
87 | Lane.prevLane(l, _); | ||
88 | } | ||
89 | |||
90 | /////////Lane cannot be its own recursive prevLane | ||
91 | @Constraint(severity="error", key={l}, message="6.1 Lane") | ||
92 | pattern define_prevLane_lanecannotBeItsOwnPrevLane(l:Lane) { | ||
93 | Lane.prevLane(l, l); | ||
94 | } | ||
95 | |||
96 | @Constraint(severity="error", key={l}, message="6.2 Lane") | ||
97 | pattern define_prevLane_lanecannotBeItsOwnRecursivePrevLane(l:Lane) { | ||
98 | find find_prevLane+(l, l); | ||
99 | } | ||
100 | private pattern find_prevLane(l1:Lane, l2:Lane) { | ||
101 | Lane.prevLane(l1, l2); | ||
102 | } | ||
103 | |||
104 | //////Lane cannot be prevLane of >1 other lane | ||
105 | @Constraint(severity="error", key={l1, l2}, message="7 Lane") | ||
106 | pattern define_prevLane_lanecannotbeprevLaneof2lanes(l1:Lane, l2:Lane) { | ||
107 | Lane.prevLane(l1, l); | ||
108 | Lane.prevLane(l2, l); | ||
109 | l1 != l2; | ||
110 | } | ||
111 | |||
112 | //////consecutive lanes must have same orientation | ||
113 | @Constraint(severity="error", key={l1, l2}, message="8 Lane") | ||
114 | pattern define_prevLane_consecutiveLanesMustHaveSameOrientation1(l1:Lane_Horizontal, l2:Lane_Vertical) { | ||
115 | Lane.prevLane(l1, l2); | ||
116 | } | ||
117 | |||
118 | @Constraint(severity="error", key={l1, l2}, message="8 Lane") | ||
119 | pattern define_prevLane_consecutiveLanesMustHaveSameOrientation2(l1:Lane_Vertical, l2:Lane_Horizontal) { | ||
120 | Lane.prevLane(l1, l2); | ||
121 | } | ||
122 | |||
123 | /////////////ReferenceCoord | ||
124 | |||
125 | /////refCoord of head lanes must be 0 | ||
126 | @Constraint(severity="error", key={l}, message="6.2 Lane") | ||
127 | pattern define_prevLane_headHoriLaneHas0RefCoord(cs:CrossingScenario, l:Lane_Horizontal) { | ||
128 | CrossingScenario.horizontal_head(cs, l); | ||
129 | Lane.referenceCoord(l, rc); | ||
130 | check(rc != 0.0); | ||
131 | } | ||
132 | |||
133 | @Constraint(severity="error", key={l}, message="6.2 Lane") | ||
134 | pattern define_prevLane_headVertLaneHas0RefCoord(cs:CrossingScenario, l:Lane_Vertical) { | ||
135 | CrossingScenario.vertical_head(cs, l); | ||
136 | Lane.referenceCoord(l, rc); | ||
137 | check(rc != 0.0); | ||
138 | } | ||
139 | |||
140 | //////refCoord of a lane is prevLane.rc + curLane.numWidth | ||
141 | |||
142 | @Constraint(severity="error", key={l}, message="6.2 Lane") | ||
143 | pattern define_referenceCoord_laneWithPrevHasCorrectRefCoord(l:Lane) { | ||
144 | Lane.prevLane(l, prev); | ||
145 | Lane.referenceCoord(l, rcCur); | ||
146 | |||
147 | Lane.numWidth(prev, wPrev); | ||
148 | Lane.referenceCoord(prev, rcPrev); | ||
149 | check(rcCur != rcPrev + wPrev); | ||
150 | } | ||
151 | |||
152 | |||
153 | ////////////// | ||
154 | //Lane+Actor | ||
155 | ////////////// | ||
156 | |||
157 | |||
95 | ////@Constraint(severity = "error", key = {a}, message = "this defines the placedOn relation for vertical lanes") | 158 | ////@Constraint(severity = "error", key = {a}, message = "this defines the placedOn relation for vertical lanes") |
96 | ////pattern actorOnVerticalLane(a : Actor) { | 159 | ////pattern actorOnVerticalLane(a : Actor) { |
97 | //// Actor.placedOn(a, l); | 160 | //// Actor.placedOn(a, l); |