diff options
author | 2020-05-11 00:17:10 +0200 | |
---|---|---|
committer | 2020-05-11 00:17:10 +0200 | |
commit | 21ebd1b18fc450a9fe84bef0af2f85396d05bea9 (patch) | |
tree | 213c9a1c01ced4935535d051c1e2332c7016915c /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit | |
parent | Merge branch 'master' of github.com:viatra/VIATRA-Generator (diff) | |
download | VIATRA-Generator-21ebd1b18fc450a9fe84bef0af2f85396d05bea9.tar.gz VIATRA-Generator-21ebd1b18fc450a9fe84bef0af2f85396d05bea9.tar.zst VIATRA-Generator-21ebd1b18fc450a9fe84bef0af2f85396d05bea9.zip |
automated containment and attribute addition for subclasses
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend index db0e17b9..f2efc87a 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend | |||
@@ -176,6 +176,10 @@ class RefinementRuleProvider { | |||
176 | val number = lowermultiplicities.head.lower | 176 | val number = lowermultiplicities.head.lower |
177 | if(number > 0) { | 177 | if(number > 0) { |
178 | val sourceTypeInterpretation = getTypeInterpretation(i, relation, 0) as PartialComplexTypeInterpretation | 178 | val sourceTypeInterpretation = getTypeInterpretation(i, relation, 0) as PartialComplexTypeInterpretation |
179 | val subtypeInterpretations = i.partialtypeinterpratation.filter(PartialComplexTypeInterpretation).filter[ | ||
180 | it === sourceTypeInterpretation || | ||
181 | it.supertypeInterpretation.contains(sourceTypeInterpretation) | ||
182 | ] | ||
179 | 183 | ||
180 | if(containmentReferences.contains(relation)) { | 184 | if(containmentReferences.contains(relation)) { |
181 | val targetTypeInterpretation = getTypeInterpretation(i, relation, 1) | 185 | val targetTypeInterpretation = getTypeInterpretation(i, relation, 1) |
@@ -188,41 +192,46 @@ class RefinementRuleProvider { | |||
188 | inverseAnnotation.head.inverseA | 192 | inverseAnnotation.head.inverseA |
189 | } | 193 | } |
190 | val inverseRelationInterpretation = i.partialrelationinterpretation.filter[it.interpretationOf === onlyInverseAnnotation].head | 194 | val inverseRelationInterpretation = i.partialrelationinterpretation.filter[it.interpretationOf === onlyInverseAnnotation].head |
191 | for(var times=0; times<number; times++) { | 195 | for(subTypeInterpretation : subtypeInterpretations) { |
192 | recursiveObjectCreation.get(sourceTypeInterpretation.interpretationOf) += | 196 | for(var times=0; times<number; times++) { |
193 | new ObjectCreationInterpretationData( | 197 | recursiveObjectCreation.get(subTypeInterpretation.interpretationOf) += |
194 | i, | 198 | new ObjectCreationInterpretationData( |
195 | targetTypeInterpretation, | 199 | i, |
196 | relationInterpretation, | 200 | targetTypeInterpretation, |
197 | inverseRelationInterpretation, | 201 | relationInterpretation, |
198 | targetTypeInterpretation.getTypeConstructor | 202 | inverseRelationInterpretation, |
199 | ) | 203 | targetTypeInterpretation.getTypeConstructor |
204 | ) | ||
205 | } | ||
200 | } | 206 | } |
201 | |||
202 | } else { | 207 | } else { |
203 | for(var times=0; times<number; times++) { | 208 | for(subTypeInterpretation : subtypeInterpretations) { |
204 | recursiveObjectCreation.get(sourceTypeInterpretation.interpretationOf) += | 209 | for(var times=0; times<number; times++) { |
205 | new ObjectCreationInterpretationData( | 210 | recursiveObjectCreation.get(subTypeInterpretation.interpretationOf) += |
206 | i, | 211 | new ObjectCreationInterpretationData( |
207 | targetTypeInterpretation, | 212 | i, |
208 | relationInterpretation, | 213 | targetTypeInterpretation, |
209 | null, | 214 | relationInterpretation, |
210 | targetTypeInterpretation.getTypeConstructor | 215 | null, |
211 | ) | 216 | targetTypeInterpretation.getTypeConstructor |
217 | ) | ||
218 | } | ||
212 | } | 219 | } |
213 | } | 220 | } |
214 | } | 221 | } |
215 | } else if(relation.parameters.get(1) instanceof PrimitiveTypeReference) { | 222 | } else if(relation.parameters.get(1) instanceof PrimitiveTypeReference) { |
216 | val targetTypeInterpretation = getTypeInterpretation(i, relation, 1) | 223 | val targetTypeInterpretation = getTypeInterpretation(i, relation, 1) |
217 | for(var times=0; times<number; times++) { | 224 | for(subTypeInterpretation : subtypeInterpretations) { |
218 | recursiveObjectCreation.get(sourceTypeInterpretation.interpretationOf) += | 225 | for(var times=0; times<number; times++) { |
219 | new ObjectCreationInterpretationData( | 226 | recursiveObjectCreation.get(subTypeInterpretation.interpretationOf) += |
220 | i, | 227 | new ObjectCreationInterpretationData( |
221 | targetTypeInterpretation, | 228 | i, |
222 | relationInterpretation, | 229 | targetTypeInterpretation, |
223 | null, | 230 | relationInterpretation, |
224 | targetTypeInterpretation.getTypeConstructor | 231 | null, |
225 | ) | 232 | targetTypeInterpretation.getTypeConstructor |
233 | ) | ||
234 | } | ||
226 | } | 235 | } |
227 | } | 236 | } |
228 | } | 237 | } |