aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries
diff options
context:
space:
mode:
authorLibravatar OszkarSemerath <oszka@152.66.252.189>2017-06-10 19:05:05 +0200
committerLibravatar OszkarSemerath <oszka@152.66.252.189>2017-06-10 19:05:05 +0200
commit60f01f46ba232ed6416054f0a6115cb2a9b70b4e (patch)
tree5edf8aeb07abc51f3fec63bbd15c926e1de09552 /Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries
parentInitial commit, migrating from SVN (diff)
downloadVIATRA-Generator-60f01f46ba232ed6416054f0a6115cb2a9b70b4e.tar.gz
VIATRA-Generator-60f01f46ba232ed6416054f0a6115cb2a9b70b4e.tar.zst
VIATRA-Generator-60f01f46ba232ed6416054f0a6115cb2a9b70b4e.zip
Migrating Additional projects
Diffstat (limited to 'Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries')
-rw-r--r--Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/signatureQueries.vql17
-rw-r--r--Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/typeQueries.vql85
2 files changed, 102 insertions, 0 deletions
diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/signatureQueries.vql b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/signatureQueries.vql
new file mode 100644
index 00000000..a020953c
--- /dev/null
+++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/signatureQueries.vql
@@ -0,0 +1,17 @@
1package hu.bme.mit.inf.dlsreasoner.alloy.reasoner.queries
2
3import epackage "http://www.bme.hu/mit/inf/dslreasoner/AlloyLanguage"
4
5pattern directSubset(x: ALSSignatureDeclaration, y: ALSSignatureDeclaration) {
6 ALSSignatureBody.declarations(b,y);
7 ALSSignatureBody.supertype(b,x);
8} or {
9 ALSSignatureBody.declarations(b,y);
10 ALSSignatureBody.superset(b,x);
11}
12
13pattern subset(x: ALSSignatureDeclaration, y: ALSSignatureDeclaration) {
14 x == y;
15} or {
16 find directSubset+(x,y);
17}
diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/typeQueries.vql b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/typeQueries.vql
new file mode 100644
index 00000000..8d93cafb
--- /dev/null
+++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/typeQueries.vql
@@ -0,0 +1,85 @@
1package hu.bme.mit.inf.dlsreasoner.alloy.reasoner.queries
2
3import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language"
4
5private pattern supertypeEdge(type1: Type, type2: Type) {
6 Type.supertypes(type1,type2);
7}
8
9pattern supertype(type1: Type, type2: Type) {
10 type1 == type2;
11} or {
12 find supertypeEdge+(type1,type2);
13}
14
15private pattern commonSubtype(type1: Type, type2: Type, common: Type) {
16 find supertype(common,type1);
17 find supertype(common,type2);
18}
19
20private pattern commonSupertype(type1: Type, type2: Type, common: Type) {
21 find supertype(common,type1);
22 find supertype(common,type2);
23}
24
25private pattern hasHigherCommonSubtype(type1: Type, type2: Type, common: Type, higher: Type) {
26 find supertype(higher,type1);
27 find supertype(higher,type2);
28 Type.supertypes(common,higher);
29 higher != common;
30}
31
32private pattern hasLowerCommonSupertype(type1: Type, type2: Type, common: Type, lower: Type) {
33 find supertype(type1,lower);
34 find supertype(type2,lower);
35 Type.supertypes(lower,common);
36 lower != common;
37}
38
39pattern topmostCommonSubtypes(type1: Type, type2: Type, common: Type) {
40 find commonSubtype(type1, type2, common);
41 neg find hasHigherCommonSubtype(type1, type2, common, _);
42}
43
44pattern lowermostCommonSupertype(type1: Type, type2: Type, common: Type) {
45 find commonSupertype(type1, type2, common);
46 neg find hasLowerCommonSupertype(type1, type2, common, _);
47}
48/*pattern topmostCommonSubtypesInObject(type1: Type, type2: Type, common: Type) {
49 find commonSubtype(type1, type2, common);
50 neg find supertypeEdge(type1,_);
51 neg find supertypeEdge(type2,_);
52 neg find hasHigherCommonSubtype(type1, type2, common, _);
53}
54pattern topmostCommonSubtypesInType(in: Type, type1: Type, type2: Type, common: Type) {
55 find commonSubtype(type1, type2, common);
56 find supertypeEdge(type1,in);
57 find supertypeEdge(type2,in);
58 neg find hasHigherCommonSubtype(type1, type2, common, _);
59}
60 */
61
62pattern lowestCommonSupertypeOfAllOccuranceOfElement(element: DefinedElement, type: Type) {
63 find typeContainsAllOccuranceOfElement(element,type);
64 neg find hasLowerCommonSupertypeOfAllOccuranceOfElement(element, type, _);
65}
66
67private pattern hasLowerCommonSupertypeOfAllOccuranceOfElement(element: DefinedElement, type: Type, lower: Type) {
68 find typeContainsAllOccuranceOfElement(element, type);
69 find typeContainsAllOccuranceOfElement(element, lower);
70 find supertype(lower, type);
71 type != lower;
72}
73
74private pattern typeContainsAllOccuranceOfElement(element: DefinedElement, type: Type) {
75 find supertype(containerType,type);
76 TypeDefinition.elements(containerType,element);
77 neg find typeDoesNotCoverElementOccurance(element,type,_);
78}
79
80private pattern typeDoesNotCoverElementOccurance(element: DefinedElement, type: Type, uncoveredOccurance: TypeDefinition) {
81 find supertype(containerType,type);
82 TypeDefinition.elements(containerType,element);
83 TypeDefinition.elements(uncoveredOccurance,element);
84 neg find supertype(uncoveredOccurance,type);
85} \ No newline at end of file