diff options
author | 2021-01-15 04:40:17 -0500 | |
---|---|---|
committer | 2021-01-15 04:40:17 -0500 | |
commit | 2492b5f012b045917e7261bd5c78b432ec4d3dc6 (patch) | |
tree | a75d37badab96eb6c417955bc4e5488055335fcf /Domains/crossingScenario/queries | |
parent | some cleanup (diff) | |
download | VIATRA-Generator-2492b5f012b045917e7261bd5c78b432ec4d3dc6.tar.gz VIATRA-Generator-2492b5f012b045917e7261bd5c78b432ec4d3dc6.tar.zst VIATRA-Generator-2492b5f012b045917e7261bd5c78b432ec4d3dc6.zip |
Begin vql implementation + fix enums bug
Diffstat (limited to 'Domains/crossingScenario/queries')
-rw-r--r-- | Domains/crossingScenario/queries/crossingScenarioQueries.vql | 83 | ||||
-rw-r--r-- | Domains/crossingScenario/queries/logProb2._vql | 55 |
2 files changed, 101 insertions, 37 deletions
diff --git a/Domains/crossingScenario/queries/crossingScenarioQueries.vql b/Domains/crossingScenario/queries/crossingScenarioQueries.vql index fbd68472..7089d0da 100644 --- a/Domains/crossingScenario/queries/crossingScenarioQueries.vql +++ b/Domains/crossingScenario/queries/crossingScenarioQueries.vql | |||
@@ -3,51 +3,60 @@ 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 <= 2.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 | /////////width, numWidth |
18 | //@Constraint(severity="error", key={l}, message="x") | ||
19 | //pattern define_numWidth_small(l : Lane) { | ||
20 | // Lane.width(l, Size::Small); | ||
21 | // Lane.numWidth(l, nw); | ||
22 | // check(nw <= 5); | ||
23 | //} or { | ||
24 | // Lane.width(l, Size::Small); | ||
25 | // Lane.numWidth(l, nw); | ||
26 | // check(nw >= 10); | ||
27 | //} | ||
28 | // | ||
29 | //@Constraint(severity="error", key={l}, message="x") | ||
30 | //pattern define_numWidth_medium(l : Lane) { | ||
31 | // Lane.width(l, Size::Medium); | ||
32 | // Lane.numWidth(l, nw); | ||
33 | // check(nw <= 10); | ||
34 | //} or { | ||
35 | // Lane.width(l, Size::Medium); | ||
36 | // Lane.numWidth(l, nw); | ||
37 | // check(nw >= 15); | ||
38 | //} | ||
39 | // | ||
40 | //@Constraint(severity="error", key={l}, message="x") | 18 | //@Constraint(severity="error", key={l}, message="x") |
41 | //pattern define_numWidth_large(l : Lane) { | 19 | //pattern define_numWidth_small1(l : Lane) { |
42 | // Lane.width(l, Size::Large); | 20 | // Lane.width(l, Size::S_Small); |
43 | // Lane.numWidth(l, nw); | ||
44 | // check(nw <= 15); | ||
45 | //} or { | ||
46 | // Lane.width(l, Size::Large); | ||
47 | // Lane.numWidth(l, nw); | 21 | // Lane.numWidth(l, nw); |
48 | // check(nw >= 20); | 22 | // check(nw >= 5.0); |
49 | //} | 23 | //} |
50 | // | 24 | |
25 | @Constraint(severity="error", key={l}, message="x") | ||
26 | pattern define_numWidth_small(l : Lane) { | ||
27 | Lane.width(l, Size::S_Small); | ||
28 | Lane.numWidth(l, nw); | ||
29 | check(nw <= 5.0); | ||
30 | } or { | ||
31 | Lane.width(l, Size::S_Small); | ||
32 | Lane.numWidth(l, nw); | ||
33 | check(nw >= 10.0); | ||
34 | } | ||
35 | |||
36 | @Constraint(severity="error", key={l}, message="x") | ||
37 | pattern define_numWidth_medium(l : Lane) { | ||
38 | Lane.width(l, ::S_Med); | ||
39 | Lane.numWidth(l, nw); | ||
40 | check(nw <= 10.0); | ||
41 | } | ||
42 | or { | ||
43 | Lane.width(l, Size::S_Med); | ||
44 | Lane.numWidth(l, nw); | ||
45 | check(nw >= 15.0); | ||
46 | } | ||
47 | |||
48 | @Constraint(severity="error", key={l}, message="x") | ||
49 | pattern define_numWidth_large(l : Lane) { | ||
50 | Lane.width(l, Size::S_Large); | ||
51 | Lane.numWidth(l, nw); | ||
52 | check(nw <= 15.0); | ||
53 | } | ||
54 | or { | ||
55 | Lane.width(l, Size::S_Large); | ||
56 | Lane.numWidth(l, nw); | ||
57 | check(nw >= 20.0); | ||
58 | } | ||
59 | |||
51 | ///////////referenceCoord | 60 | ///////////referenceCoord |
52 | //@Constraint(severity="error", key={l}, message="x") | 61 | //@Constraint(severity="error", key={l}, message="x") |
53 | //pattern define_referenceCoord_horizontalAtOrigin(l:Lane) { | 62 | //pattern define_referenceCoord_horizontalAtOrigin(l:Lane) { |
diff --git a/Domains/crossingScenario/queries/logProb2._vql b/Domains/crossingScenario/queries/logProb2._vql new file mode 100644 index 00000000..284af8cb --- /dev/null +++ b/Domains/crossingScenario/queries/logProb2._vql | |||
@@ -0,0 +1,55 @@ | |||
1 | package queries | ||
2 | |||
3 | import epackage "http://www.bme.hu/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage" | ||
4 | import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/problem" | ||
5 | import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" | ||
6 | |||
7 | pattern UPMUSTPropagateConstraint1_pattern_queries_define_numWidth_small1( | ||
8 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
9 | var_l, | ||
10 | up_1) | ||
11 | { | ||
12 | // Original Constraints | ||
13 | // var_l exported | ||
14 | find mustInRelationnumWidth_attribute_Lane(problem,interpretation,var_l,var_nw); | ||
15 | var_virtual1 == const_S_Small_Size; | ||
16 | DefinedElement.name(const_S_Small_Size,"S_Small literal Size"); //LogicProblem.elements(problem,const_S_Small_Size); | ||
17 | find mustInRelationwidth_attribute_Lane(problem,interpretation,var_l,var_virtual1); | ||
18 | // Propagation for constraint | ||
19 | PrimitiveElement.valueSet(var_nw,setted_var_nw); RealElement.value(var_nw,value_var_nw); | ||
20 | // Matching variables | ||
21 | var_nw==up_1; | ||
22 | } | ||
23 | |||
24 | /** | ||
25 | * Matcher for detecting tuples t where []referenceCoord attribute Lane(source,target) | ||
26 | */pattern mustInRelationwidth_attribute_Lane( | ||
27 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
28 | source: DefinedElement, target:DefinedElement) | ||
29 | { | ||
30 | find interpretation(problem,interpretation); | ||
31 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
32 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"width attribute Lane"); | ||
33 | PartialRelationInterpretation.relationlinks(relationIterpretation,link); | ||
34 | BinaryElementRelationLink.param1(link,source); | ||
35 | BinaryElementRelationLink.param2(link,target); | ||
36 | } | ||
37 | pattern mustInRelationnumWidth_attribute_Lane( | ||
38 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
39 | source: DefinedElement, target:DefinedElement) | ||
40 | { | ||
41 | find interpretation(problem,interpretation); | ||
42 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | ||
43 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"numWidth attribute Lane"); | ||
44 | PartialRelationInterpretation.relationlinks(relationIterpretation,link); | ||
45 | BinaryElementRelationLink.param1(link,source); | ||
46 | BinaryElementRelationLink.param2(link,target); | ||
47 | } | ||
48 | |||
49 | ////////// | ||
50 | // 0. Util | ||
51 | ////////// | ||
52 | pattern interpretation(problem:LogicProblem, interpretation:PartialInterpretation) { | ||
53 | PartialInterpretation.problem(interpretation,problem); | ||
54 | } | ||
55 | |||