diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend')
-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, 33 insertions, 32 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 b4cb9ec7..db0e17b9 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 | |||
@@ -90,7 +90,7 @@ class RefinementRuleProvider { | |||
90 | if(containmentRelation !== null) { | 90 | if(containmentRelation !== null) { |
91 | if(inverseRelation!== null) { | 91 | if(inverseRelation!== null) { |
92 | ruleBuilder.action[match | | 92 | ruleBuilder.action[match | |
93 | println(name) | 93 | //println(name) |
94 | val startTime = System.nanoTime | 94 | val startTime = System.nanoTime |
95 | //val problem = match.get(0) as LogicProblem | 95 | //val problem = match.get(0) as LogicProblem |
96 | val interpretation = match.get(1) as PartialInterpretation | 96 | val interpretation = match.get(1) as PartialInterpretation |
@@ -115,7 +115,7 @@ class RefinementRuleProvider { | |||
115 | ] | 115 | ] |
116 | } else { | 116 | } else { |
117 | ruleBuilder.action[match | | 117 | ruleBuilder.action[match | |
118 | println(name) | 118 | //println(name) |
119 | val startTime = System.nanoTime | 119 | val startTime = System.nanoTime |
120 | //val problem = match.get(0) as LogicProblem | 120 | //val problem = match.get(0) as LogicProblem |
121 | val interpretation = match.get(1) as PartialInterpretation | 121 | val interpretation = match.get(1) as PartialInterpretation |
@@ -139,7 +139,7 @@ class RefinementRuleProvider { | |||
139 | } | 139 | } |
140 | } else { | 140 | } else { |
141 | ruleBuilder.action[match | | 141 | ruleBuilder.action[match | |
142 | println(name) | 142 | //println(name) |
143 | val startTime = System.nanoTime | 143 | val startTime = System.nanoTime |
144 | //val problem = match.get(0) as LogicProblem | 144 | //val problem = match.get(0) as LogicProblem |
145 | val interpretation = match.get(1) as PartialInterpretation | 145 | val interpretation = match.get(1) as PartialInterpretation |
@@ -179,36 +179,37 @@ class RefinementRuleProvider { | |||
179 | 179 | ||
180 | if(containmentReferences.contains(relation)) { | 180 | if(containmentReferences.contains(relation)) { |
181 | val targetTypeInterpretation = getTypeInterpretation(i, relation, 1) | 181 | val targetTypeInterpretation = getTypeInterpretation(i, relation, 1) |
182 | 182 | if(!(targetTypeInterpretation as PartialComplexTypeInterpretation).interpretationOf.isIsAbstract) { | |
183 | val inverseAnnotation = p.assertions.filter(InverseRelationAssertion).filter[it.inverseA === relation || it.inverseB === relation] | 183 | val inverseAnnotation = p.assertions.filter(InverseRelationAssertion).filter[it.inverseA === relation || it.inverseB === relation] |
184 | if(!inverseAnnotation.empty) { | 184 | if(!inverseAnnotation.empty) { |
185 | val onlyInverseAnnotation = if(inverseAnnotation.head.inverseA===relation) { | 185 | val onlyInverseAnnotation = if(inverseAnnotation.head.inverseA===relation) { |
186 | inverseAnnotation.head.inverseB | 186 | inverseAnnotation.head.inverseB |
187 | } else { | ||
188 | inverseAnnotation.head.inverseA | ||
189 | } | ||
190 | val inverseRelationInterpretation = i.partialrelationinterpretation.filter[it.interpretationOf === onlyInverseAnnotation].head | ||
191 | for(var times=0; times<number; times++) { | ||
192 | recursiveObjectCreation.get(sourceTypeInterpretation.interpretationOf) += | ||
193 | new ObjectCreationInterpretationData( | ||
194 | i, | ||
195 | targetTypeInterpretation, | ||
196 | relationInterpretation, | ||
197 | inverseRelationInterpretation, | ||
198 | targetTypeInterpretation.getTypeConstructor | ||
199 | ) | ||
200 | } | ||
201 | |||
187 | } else { | 202 | } else { |
188 | inverseAnnotation.head.inverseA | 203 | for(var times=0; times<number; times++) { |
189 | } | 204 | recursiveObjectCreation.get(sourceTypeInterpretation.interpretationOf) += |
190 | val inverseRelationInterpretation = i.partialrelationinterpretation.filter[it.interpretationOf === onlyInverseAnnotation].head | 205 | new ObjectCreationInterpretationData( |
191 | for(var times=0; times<number; times++) { | 206 | i, |
192 | recursiveObjectCreation.get(sourceTypeInterpretation.interpretationOf) += | 207 | targetTypeInterpretation, |
193 | new ObjectCreationInterpretationData( | 208 | relationInterpretation, |
194 | i, | 209 | null, |
195 | targetTypeInterpretation, | 210 | targetTypeInterpretation.getTypeConstructor |
196 | relationInterpretation, | 211 | ) |
197 | inverseRelationInterpretation, | 212 | } |
198 | targetTypeInterpretation.getTypeConstructor | ||
199 | ) | ||
200 | } | ||
201 | |||
202 | } else { | ||
203 | for(var times=0; times<number; times++) { | ||
204 | recursiveObjectCreation.get(sourceTypeInterpretation.interpretationOf) += | ||
205 | new ObjectCreationInterpretationData( | ||
206 | i, | ||
207 | targetTypeInterpretation, | ||
208 | relationInterpretation, | ||
209 | null, | ||
210 | targetTypeInterpretation.getTypeConstructor | ||
211 | ) | ||
212 | } | 213 | } |
213 | } | 214 | } |
214 | } else if(relation.parameters.get(1) instanceof PrimitiveTypeReference) { | 215 | } else if(relation.parameters.get(1) instanceof PrimitiveTypeReference) { |