diff options
author | 2018-06-20 14:42:23 +0200 | |
---|---|---|
committer | 2018-06-20 14:42:23 +0200 | |
commit | 27187323b760bd7bba5e16cc75fadb041888e2c8 (patch) | |
tree | e1685c55dc7968381324d65e8ac64df079d4084a /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src | |
parent | Visualisation stub removed (diff) | |
download | VIATRA-Generator-27187323b760bd7bba5e16cc75fadb041888e2c8.tar.gz VIATRA-Generator-27187323b760bd7bba5e16cc75fadb041888e2c8.tar.zst VIATRA-Generator-27187323b760bd7bba5e16cc75fadb041888e2c8.zip |
Fixing multiple "true" and "false" objects
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src')
3 files changed, 88 insertions, 52 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend index 9a737ab9..f4fc1fce 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend | |||
@@ -54,7 +54,7 @@ class InstanceModel2PartialInterpretation { | |||
54 | val object = objects.get(objectIndex) | 54 | val object = objects.get(objectIndex) |
55 | val element = createDefinedElement => [ | 55 | val element = createDefinedElement => [ |
56 | it.name = if(withID) | 56 | it.name = if(withID) |
57 | { '''PartialObject«objectIndex»''' } else | 57 | { '''o «objectIndex»''' } else |
58 | { null } | 58 | { null } |
59 | ] | 59 | ] |
60 | 60 | ||
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/PartialInterpretation2Logic.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/PartialInterpretation2Logic.xtend index e4ad4295..5d8d9313 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/PartialInterpretation2Logic.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/PartialInterpretation2Logic.xtend | |||
@@ -23,6 +23,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil | |||
23 | import org.eclipse.xtend.lib.annotations.Data | 23 | import org.eclipse.xtend.lib.annotations.Data |
24 | 24 | ||
25 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 25 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PrimitiveElement | ||
26 | 27 | ||
27 | @Data class PartialInterpretation2Logic_Trace { | 28 | @Data class PartialInterpretation2Logic_Trace { |
28 | Map<DefinedElement,DefinedElement> new2Old = new HashMap | 29 | Map<DefinedElement,DefinedElement> new2Old = new HashMap |
@@ -66,7 +67,7 @@ class PartialInterpretation2Logic { | |||
66 | // newElement.name = '''o «newElementIndex++»''' | 67 | // newElement.name = '''o «newElementIndex++»''' |
67 | // p.elements += newElement | 68 | // p.elements += newElement |
68 | // } | 69 | // } |
69 | p.elements += i.newElements | 70 | p.elements += i.newElements.filter[!it instanceof PrimitiveElement] |
70 | } | 71 | } |
71 | 72 | ||
72 | private def splitTypeIntoTwo(LogicProblem p, PartialComplexTypeInterpretation partialTypeDeclaration,PartialInterpretation2Logic_Trace trace) { | 73 | private def splitTypeIntoTwo(LogicProblem p, PartialComplexTypeInterpretation partialTypeDeclaration,PartialInterpretation2Logic_Trace trace) { |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend index cdc79743..2a350d53 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend | |||
@@ -2,8 +2,6 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage | |||
2 | 2 | ||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput | 3 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput |
4 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes | 4 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes |
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ConstantDeclaration | ||
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.FunctionDeclaration | ||
7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory |
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration | 6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration |
9 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type | 7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type |
@@ -12,12 +10,18 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDefinition | |||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | 10 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem |
13 | import hu.bme.mit.inf.dslreasoner.logic.model.patterns.SupertypeStar | 11 | import hu.bme.mit.inf.dslreasoner.logic.model.patterns.SupertypeStar |
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion | 12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion |
13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.BooleanElement | ||
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.IntegerElement | ||
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialBooleanInterpretation | ||
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialComplexTypeInterpretation | 16 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialComplexTypeInterpretation |
16 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialConstantInterpretation | 17 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialIntegerInterpretation |
17 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialFunctionInterpretation | ||
18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRealInterpretation | ||
19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation | 20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation |
21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialStringInterpretation | ||
20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory | 22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory |
23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement | ||
24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.StringElement | ||
21 | import java.math.BigDecimal | 25 | import java.math.BigDecimal |
22 | import java.util.HashMap | 26 | import java.util.HashMap |
23 | import java.util.Map | 27 | import java.util.Map |
@@ -30,8 +34,19 @@ import org.eclipse.xtend.lib.annotations.Data | |||
30 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 34 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
31 | 35 | ||
32 | @Data class Problem2PartialInterpretationTrace { | 36 | @Data class Problem2PartialInterpretationTrace { |
33 | Map<TypeDeclaration, PartialComplexTypeInterpretation> type2Interpretation = new HashMap | 37 | Map<TypeDeclaration, PartialComplexTypeInterpretation> type2Interpretation |
34 | Map<RelationDeclaration, PartialRelationInterpretation> relation2Interpretation = new HashMap | 38 | PrimitiveValueTrace primitiveValues |
39 | Map<RelationDeclaration, PartialRelationInterpretation> relation2Interpretation | ||
40 | } | ||
41 | @Data class PrimitiveValueTrace { | ||
42 | PartialBooleanInterpretation booleanInterpretation | ||
43 | Map<Boolean,BooleanElement> booleanMap | ||
44 | PartialIntegerInterpretation integerInterpretation | ||
45 | Map<Integer,IntegerElement> integerMap | ||
46 | PartialRealInterpretation realInterpretation | ||
47 | Map<BigDecimal,RealElement> realMap | ||
48 | PartialStringInterpretation stringInterpretation | ||
49 | Map<String,StringElement> stringMap | ||
35 | } | 50 | } |
36 | 51 | ||
37 | /** | 52 | /** |
@@ -48,34 +63,49 @@ class PartialInterpretationInitialiser { | |||
48 | LogicProblem problem, | 63 | LogicProblem problem, |
49 | TypeScopes typeScopes) | 64 | TypeScopes typeScopes) |
50 | { | 65 | { |
51 | 66 | val res = createPartialInterpretation | |
52 | val trace = new Problem2PartialInterpretationTrace | 67 | res.problem = problem |
53 | |||
54 | val res = createPartialInterpretation => [ | ||
55 | it.problem = problem | ||
56 | 68 | ||
57 | // Initialise primitive elements | 69 | // Initialise primitive elements |
58 | initBooleans(it) | 70 | val booleanType = initBooleans(res) |
59 | initIntegers(it, typeScopes.knownIntegers, typeScopes.minNewIntegers, typeScopes.maxNewIntegers) | 71 | val integerType = initIntegers(res, typeScopes.knownIntegers, typeScopes.minNewIntegers, typeScopes.maxNewIntegers) |
60 | initReals(it, typeScopes.knownReals, typeScopes.minNewReals, typeScopes.maxNewReals) | 72 | val realType = initReals(res, typeScopes.knownReals, typeScopes.minNewReals, typeScopes.maxNewReals) |
61 | initStrings(it,typeScopes.knownStrings, typeScopes.minNewStrings, typeScopes.maxNewStrings) | 73 | val stringType= initStrings(res,typeScopes.knownStrings, typeScopes.minNewStrings, typeScopes.maxNewStrings) |
62 | // Initialise complex elements | 74 | val primitiveTrace = createPrimitiveTrace(booleanType, integerType, realType, stringType) |
63 | initElements(it, | 75 | // Initialise complex elements |
64 | typeScopes.minNewElementsByType, | 76 | |
65 | typeScopes.maxNewElementsByType, | 77 | val type2Interpretation = initElements(res, |
66 | typeScopes.minNewElements, | 78 | typeScopes.minNewElementsByType, |
67 | typeScopes.maxNewElements, | 79 | typeScopes.maxNewElementsByType, |
68 | trace | 80 | typeScopes.minNewElements, |
69 | ) | 81 | typeScopes.maxNewElements) |
70 | 82 | ||
71 | // Initialise relations | 83 | // Initialise relations |
72 | initRelations(it,trace) | 84 | val relation2Interpretation = initRelations(res) |
73 | ] | ||
74 | 85 | ||
86 | val trace = new Problem2PartialInterpretationTrace(type2Interpretation,primitiveTrace,relation2Interpretation) | ||
75 | return new TracedOutput(res,trace) | 87 | return new TracedOutput(res,trace) |
76 | } | 88 | } |
77 | 89 | ||
78 | def protected boolean initBooleans(PartialInterpretation partialInterpretation) { | 90 | def createPrimitiveTrace( |
91 | PartialBooleanInterpretation booleanType, | ||
92 | PartialIntegerInterpretation integerType, | ||
93 | PartialRealInterpretation realType, | ||
94 | PartialStringInterpretation stringType) | ||
95 | { | ||
96 | return new PrimitiveValueTrace( | ||
97 | booleanType, | ||
98 | booleanType.elements.filter(BooleanElement).toMap[value], | ||
99 | integerType, | ||
100 | integerType.elements.filter(IntegerElement).toMap[value], | ||
101 | realType, | ||
102 | realType.elements.filter(RealElement).toMap[value], | ||
103 | stringType, | ||
104 | stringType.elements.filter(StringElement).toMap[value] | ||
105 | ) | ||
106 | } | ||
107 | |||
108 | def protected initBooleans(PartialInterpretation partialInterpretation) { | ||
79 | val booleanInterpretation = createPartialBooleanInterpretation | 109 | val booleanInterpretation = createPartialBooleanInterpretation |
80 | partialInterpretation.partialtypeinterpratation += booleanInterpretation | 110 | partialInterpretation.partialtypeinterpratation += booleanInterpretation |
81 | 111 | ||
@@ -86,6 +116,8 @@ class PartialInterpretationInitialiser { | |||
86 | val falseElement = createBooleanElement => [it.name = "false" it.value = false it.valueSet = true] | 116 | val falseElement = createBooleanElement => [it.name = "false" it.value = false it.valueSet = true] |
87 | booleanInterpretation.elements += falseElement | 117 | booleanInterpretation.elements += falseElement |
88 | partialInterpretation.newElements+=falseElement | 118 | partialInterpretation.newElements+=falseElement |
119 | |||
120 | return booleanInterpretation | ||
89 | } | 121 | } |
90 | 122 | ||
91 | def protected initIntegers(PartialInterpretation partialInterpretation, SortedSet<Integer> knownIntegers, int minNewIntegers, int maxNewIntegers) { | 123 | def protected initIntegers(PartialInterpretation partialInterpretation, SortedSet<Integer> knownIntegers, int minNewIntegers, int maxNewIntegers) { |
@@ -100,6 +132,8 @@ class PartialInterpretationInitialiser { | |||
100 | if(maxNewIntegers>0) { | 132 | if(maxNewIntegers>0) { |
101 | throw new UnsupportedOperationException('''Unspecified Integers are currently not supported!''') | 133 | throw new UnsupportedOperationException('''Unspecified Integers are currently not supported!''') |
102 | } | 134 | } |
135 | |||
136 | return integerInterpretation | ||
103 | } | 137 | } |
104 | 138 | ||
105 | def protected initReals(PartialInterpretation partialInterpretation, SortedSet<BigDecimal> knownReals, int minNewReals, int maxNewReals) { | 139 | def protected initReals(PartialInterpretation partialInterpretation, SortedSet<BigDecimal> knownReals, int minNewReals, int maxNewReals) { |
@@ -114,6 +148,7 @@ class PartialInterpretationInitialiser { | |||
114 | if(maxNewReals>0) { | 148 | if(maxNewReals>0) { |
115 | throw new UnsupportedOperationException('''Unspecified Real values are currently not supported!''') | 149 | throw new UnsupportedOperationException('''Unspecified Real values are currently not supported!''') |
116 | } | 150 | } |
151 | return realInterpretation | ||
117 | } | 152 | } |
118 | 153 | ||
119 | def protected initStrings(PartialInterpretation partialInterpretation, SortedSet<String> knownStrings, int minNewStrings, int maxNewStrings) { | 154 | def protected initStrings(PartialInterpretation partialInterpretation, SortedSet<String> knownStrings, int minNewStrings, int maxNewStrings) { |
@@ -128,13 +163,15 @@ class PartialInterpretationInitialiser { | |||
128 | if(maxNewStrings>0) { | 163 | if(maxNewStrings>0) { |
129 | throw new UnsupportedOperationException('''Unspecified String values are currently not supported!''') | 164 | throw new UnsupportedOperationException('''Unspecified String values are currently not supported!''') |
130 | } | 165 | } |
166 | |||
167 | return stringInterpretation | ||
131 | } | 168 | } |
132 | 169 | ||
133 | def protected initElements(PartialInterpretation interpretation, | 170 | def protected initElements(PartialInterpretation interpretation, |
134 | Map<Type, Integer> minNewElementsByType, Map<Type, Integer> maxNewElementsByType, | 171 | Map<Type, Integer> minNewElementsByType, Map<Type, Integer> maxNewElementsByType, |
135 | int minNewElements, int maxNewElements, | 172 | int minNewElements, int maxNewElements) |
136 | Problem2PartialInterpretationTrace trace) | ||
137 | { | 173 | { |
174 | val Map<TypeDeclaration, PartialComplexTypeInterpretation> type2Interpretation = new HashMap | ||
138 | val engine = ViatraQueryEngine.on(new EMFScope(interpretation.problem)) | 175 | val engine = ViatraQueryEngine.on(new EMFScope(interpretation.problem)) |
139 | // Elements | 176 | // Elements |
140 | interpretation.minNewElements = minNewElements | 177 | interpretation.minNewElements = minNewElements |
@@ -146,37 +183,45 @@ class PartialInterpretationInitialiser { | |||
146 | } | 183 | } |
147 | 184 | ||
148 | for(typeDeclaration : interpretation.problem.types.filter(TypeDeclaration)) { | 185 | for(typeDeclaration : interpretation.problem.types.filter(TypeDeclaration)) { |
149 | val typeInterpretation = typeDeclaration.initialisePartialTypeInterpretation(engine,trace) | 186 | val typeInterpretation = typeDeclaration.initialisePartialTypeInterpretation(engine) |
150 | interpretation.partialtypeinterpratation += typeInterpretation | 187 | interpretation.partialtypeinterpratation += typeInterpretation |
188 | type2Interpretation.put(typeDeclaration,typeInterpretation) | ||
151 | } | 189 | } |
152 | interpretation.problem.connectSuperypes(trace) | 190 | interpretation.problem.connectSuperypes(type2Interpretation) |
191 | return type2Interpretation | ||
153 | } | 192 | } |
154 | 193 | ||
155 | def private connectSuperypes(LogicProblem problem, Problem2PartialInterpretationTrace trace) { | 194 | def private connectSuperypes(LogicProblem problem, Map<TypeDeclaration, PartialComplexTypeInterpretation> trace) { |
156 | for(typeDeclaration : problem.types.filter(TypeDeclaration)) { | 195 | for(typeDeclaration : problem.types.filter(TypeDeclaration)) { |
157 | val supertypes = typeDeclaration.<Type>transitiveClosurePlus[it.supertypes] | 196 | val supertypes = typeDeclaration.<Type>transitiveClosurePlus[it.supertypes] |
158 | for(supertype : supertypes.filter(TypeDeclaration)) { | 197 | for(supertype : supertypes.filter(TypeDeclaration)) { |
159 | typeDeclaration.lookup(trace.type2Interpretation).supertypeInterpretation += supertype.lookup(trace.type2Interpretation) | 198 | typeDeclaration.lookup(trace).supertypeInterpretation += supertype.lookup(trace) |
160 | //println('''«typeDeclaration.name» --> «supertype.name»''') | 199 | //println('''«typeDeclaration.name» --> «supertype.name»''') |
161 | } | 200 | } |
162 | } | 201 | } |
163 | } | 202 | } |
164 | 203 | ||
165 | def private initRelations(PartialInterpretation interpretation, Problem2PartialInterpretationTrace trace) { | 204 | def private initRelations(PartialInterpretation interpretation) { |
166 | interpretation.partialrelationinterpretation += interpretation.problem.relations.filter(RelationDeclaration) | 205 | val Map<RelationDeclaration, PartialRelationInterpretation> relation2Interpretation = new HashMap |
167 | .map[initialisePartialRelationInterpretation(trace)] | 206 | for(relation : interpretation.problem.relations.filter(RelationDeclaration)) { |
207 | val partialInterpretation = relation.initialisePartialRelationInterpretation | ||
208 | interpretation.partialrelationinterpretation += partialInterpretation | ||
209 | relation2Interpretation.put(relation,partialInterpretation) | ||
210 | } | ||
168 | for(pMR2A : interpretation.problem.annotations.filter(PartialModelRelation2Assertion)) { | 211 | for(pMR2A : interpretation.problem.annotations.filter(PartialModelRelation2Assertion)) { |
169 | val relation = pMR2A.targetRelation | 212 | val relation = pMR2A.targetRelation |
170 | val r = relation.lookup(trace.relation2Interpretation) | 213 | val r = relation.lookup(relation2Interpretation) |
171 | r.relationlinks+=pMR2A.links.map[EcoreUtil.copy(it)] | 214 | r.relationlinks+=pMR2A.links.map[EcoreUtil.copy(it)] |
172 | } | 215 | } |
173 | // interpretation.partialfunctioninterpretation += interpretation.problem.functions.filter(FunctionDeclaration) | 216 | // interpretation.partialfunctioninterpretation += interpretation.problem.functions.filter(FunctionDeclaration) |
174 | // .map[initialisePartialFunctionInterpretation(trace)] | 217 | // .map[initialisePartialFunctionInterpretation(trace)] |
175 | // interpretation.partialconstantinterpretation += interpretation.problem.constants.filter(ConstantDeclaration) | 218 | // interpretation.partialconstantinterpretation += interpretation.problem.constants.filter(ConstantDeclaration) |
176 | // .map[initialisePartialConstantDeclaration(trace)] | 219 | // .map[initialisePartialConstantDeclaration(trace)] |
220 | |||
221 | return relation2Interpretation | ||
177 | } | 222 | } |
178 | 223 | ||
179 | def private initialisePartialTypeInterpretation(TypeDeclaration t, ViatraQueryEngine engine, Problem2PartialInterpretationTrace trace) { | 224 | def private initialisePartialTypeInterpretation(TypeDeclaration t, ViatraQueryEngine engine) { |
180 | val supertypeMatcher = SupertypeStar.Matcher.on(engine) | 225 | val supertypeMatcher = SupertypeStar.Matcher.on(engine) |
181 | val res = createPartialComplexTypeInterpretation => [ | 226 | val res = createPartialComplexTypeInterpretation => [ |
182 | it.interpretationOf = t | 227 | it.interpretationOf = t |
@@ -184,11 +229,10 @@ class PartialInterpretationInitialiser { | |||
184 | .filter(TypeDefinition) | 229 | .filter(TypeDefinition) |
185 | .map[elements].flatten | 230 | .map[elements].flatten |
186 | ] | 231 | ] |
187 | trace.type2Interpretation.put(t,res) | ||
188 | return res | 232 | return res |
189 | } | 233 | } |
190 | 234 | ||
191 | def private initialisePartialRelationInterpretation(RelationDeclaration r, Problem2PartialInterpretationTrace trace) { | 235 | def private initialisePartialRelationInterpretation(RelationDeclaration r) { |
192 | val res = createPartialRelationInterpretation => [ | 236 | val res = createPartialRelationInterpretation => [ |
193 | it.interpretationOf = r | 237 | it.interpretationOf = r |
194 | if(r.parameters.size==2) { | 238 | if(r.parameters.size==2) { |
@@ -196,15 +240,6 @@ class PartialInterpretationInitialiser { | |||
196 | it.param2 = r.parameters.get(1) | 240 | it.param2 = r.parameters.get(1) |
197 | } else throw new UnsupportedOperationException | 241 | } else throw new UnsupportedOperationException |
198 | ] | 242 | ] |
199 | trace.relation2Interpretation.put(r,res) | ||
200 | return res | 243 | return res |
201 | } | 244 | } |
202 | |||
203 | def private PartialConstantInterpretation initialisePartialConstantDeclaration(ConstantDeclaration c, Problem2PartialInterpretationTrace trace) { | ||
204 | throw new UnsupportedOperationException | ||
205 | } | ||
206 | |||
207 | def private PartialFunctionInterpretation initialisePartialFunctionInterpretation(FunctionDeclaration f, Problem2PartialInterpretationTrace trace) { | ||
208 | throw new UnsupportedOperationException | ||
209 | } | ||
210 | } \ No newline at end of file | 245 | } \ No newline at end of file |