diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit')
5 files changed, 102 insertions, 88 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/MultiplicityGoalConstraintCalculator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/MultiplicityGoalConstraintCalculator.xtend index 034420d6..b28cd584 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/MultiplicityGoalConstraintCalculator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/MultiplicityGoalConstraintCalculator.xtend | |||
@@ -10,15 +10,13 @@ class MultiplicityGoalConstraintCalculator { | |||
10 | val String targetRelationName | 10 | val String targetRelationName |
11 | val IQuerySpecification<?> querySpecification | 11 | val IQuerySpecification<?> querySpecification |
12 | var ViatraQueryMatcher<?> matcher | 12 | var ViatraQueryMatcher<?> matcher |
13 | val int minValue | ||
14 | val boolean containment | 13 | val boolean containment |
15 | val int cost | 14 | val int cost |
16 | 15 | ||
17 | public new(String targetRelationName, IQuerySpecification<?> querySpecification, int minValue, boolean containment, int cost) { | 16 | public new(String targetRelationName, IQuerySpecification<?> querySpecification, boolean containment, int cost) { |
18 | this.targetRelationName = targetRelationName | 17 | this.targetRelationName = targetRelationName |
19 | this.querySpecification = querySpecification | 18 | this.querySpecification = querySpecification |
20 | this.matcher = null | 19 | this.matcher = null |
21 | this.minValue = minValue | ||
22 | this.containment = containment | 20 | this.containment = containment |
23 | this.cost = cost | 21 | this.cost = cost |
24 | } | 22 | } |
@@ -27,7 +25,6 @@ class MultiplicityGoalConstraintCalculator { | |||
27 | this.targetRelationName = other.targetRelationName | 25 | this.targetRelationName = other.targetRelationName |
28 | this.querySpecification = other.querySpecification | 26 | this.querySpecification = other.querySpecification |
29 | this.matcher = null | 27 | this.matcher = null |
30 | this.minValue = other.minValue | ||
31 | this.containment = other.containment | 28 | this.containment = other.containment |
32 | this.cost = other.cost | 29 | this.cost = other.cost |
33 | } | 30 | } |
@@ -49,14 +46,8 @@ class MultiplicityGoalConstraintCalculator { | |||
49 | var res = 0 | 46 | var res = 0 |
50 | val allMatches = this.matcher.allMatches | 47 | val allMatches = this.matcher.allMatches |
51 | for(match : allMatches) { | 48 | for(match : allMatches) { |
52 | val existingMultiplicity = match.get(4) as Integer | 49 | val missingMultiplicity = match.get(2) as Integer |
53 | if(existingMultiplicity < this.minValue) { | 50 | res += missingMultiplicity |
54 | val missingMultiplicity = this.minValue-existingMultiplicity | ||
55 | res += missingMultiplicity | ||
56 | } | ||
57 | // if(missingMultiplicity!=0) { | ||
58 | // println(targetRelationName+ " missing multiplicity: "+missingMultiplicity) | ||
59 | // } | ||
60 | } | 51 | } |
61 | // if(res>0) | 52 | // if(res>0) |
62 | // println(targetRelationName+ " all missing multiplicities: "+res + "*"+cost+"="+res*cost) | 53 | // println(targetRelationName+ " all missing multiplicities: "+res + "*"+cost+"="+res*cost) |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronScopePropagator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronScopePropagator.xtend index 120fb18a..9b4dff0f 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronScopePropagator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronScopePropagator.xtend | |||
@@ -88,6 +88,7 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { | |||
88 | val result = operator.saturate() | 88 | val result = operator.saturate() |
89 | if (result == PolyhedronSaturationResult.EMPTY) { | 89 | if (result == PolyhedronSaturationResult.EMPTY) { |
90 | cache.put(signature, PolyhedronSignature.EMPTY) | 90 | cache.put(signature, PolyhedronSignature.EMPTY) |
91 | // println("INVALID") | ||
91 | setScopesInvalid() | 92 | setScopesInvalid() |
92 | } else { | 93 | } else { |
93 | val resultSignature = polyhedron.createSignature | 94 | val resultSignature = polyhedron.createSignature |
@@ -110,11 +111,8 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { | |||
110 | } | 111 | } |
111 | } | 112 | } |
112 | 113 | ||
113 | override propagateAdditionToRelation(Relation r) { | 114 | override isPropagationNeededAfterAdditionToRelation(Relation r) { |
114 | super.propagateAdditionToRelation(r) | 115 | relevantRelations.contains(r) || super.isPropagationNeededAfterAdditionToRelation(r) |
115 | if (relevantRelations.contains(r)) { | ||
116 | propagateAllScopeConstraints() | ||
117 | } | ||
118 | } | 116 | } |
119 | 117 | ||
120 | def resetBounds() { | 118 | def resetBounds() { |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend index 8f3a5bb0..8350c7f4 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend | |||
@@ -114,21 +114,21 @@ class ScopePropagator { | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | def void propagateAdditionToRelation(Relation r) { | 117 | def isPropagationNeededAfterAdditionToRelation(Relation r) { |
118 | // Nothing to propagate. | 118 | false |
119 | } | 119 | } |
120 | 120 | ||
121 | private def removeOne(Scope scope) { | 121 | private def removeOne(Scope scope) { |
122 | if (scope.maxNewElements === 0) { | ||
123 | throw new IllegalArgumentException('''Inconsistent object creation: «scope.targetTypeInterpretation»''') | ||
124 | } else if (scope.maxNewElements > 0) { | ||
125 | scope.maxNewElements = scope.maxNewElements - 1 | ||
126 | } | ||
127 | if (scope.minNewElements > 0) { | 122 | if (scope.minNewElements > 0) { |
128 | scope.minNewElements = scope.minNewElements - 1 | 123 | scope.minNewElements = scope.minNewElements - 1 |
129 | } | 124 | } |
130 | if (scope.minNewElementsHeuristic > 0) { | 125 | if (scope.minNewElementsHeuristic > 0) { |
131 | scope.minNewElementsHeuristic = scope.minNewElementsHeuristic - 1 | 126 | scope.minNewElementsHeuristic = scope.minNewElementsHeuristic - 1 |
132 | } | 127 | } |
128 | if (scope.maxNewElements > 0) { | ||
129 | scope.maxNewElements = scope.maxNewElements - 1 | ||
130 | } else if (scope.maxNewElements === 0) { | ||
131 | setScopesInvalid() | ||
132 | } | ||
133 | } | 133 | } |
134 | } | 134 | } |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/GoalConstraintProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/GoalConstraintProvider.xtend index 238ade5b..d2ee80dc 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/GoalConstraintProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/GoalConstraintProvider.xtend | |||
@@ -15,9 +15,8 @@ class GoalConstraintProvider { | |||
15 | val queries = entry.value | 15 | val queries = entry.value |
16 | val targetRelationName = constraint.relation.name | 16 | val targetRelationName = constraint.relation.name |
17 | val query = queries.unfinishedMultiplicityQuery | 17 | val query = queries.unfinishedMultiplicityQuery |
18 | val minValue = constraint.lowerBound | ||
19 | val containment = constraint.containment | 18 | val containment = constraint.containment |
20 | res += new MultiplicityGoalConstraintCalculator(targetRelationName, query, minValue, containment, 1) | 19 | res += new MultiplicityGoalConstraintCalculator(targetRelationName, query, containment, 1) |
21 | } | 20 | } |
22 | } | 21 | } |
23 | return res | 22 | return res |
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 0b8a9019..863ee18b 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 | |||
@@ -32,9 +32,12 @@ import java.util.LinkedHashMap | |||
32 | import java.util.LinkedList | 32 | import java.util.LinkedList |
33 | import java.util.List | 33 | import java.util.List |
34 | import java.util.Map | 34 | import java.util.Map |
35 | import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine | ||
35 | import org.eclipse.viatra.query.runtime.api.GenericPatternMatch | 36 | import org.eclipse.viatra.query.runtime.api.GenericPatternMatch |
36 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | 37 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification |
38 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine | ||
37 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher | 39 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher |
40 | import org.eclipse.viatra.query.runtime.emf.EMFScope | ||
38 | import org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRule | 41 | import org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRule |
39 | import org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRuleFactory | 42 | import org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRuleFactory |
40 | import org.eclipse.xtend.lib.annotations.Data | 43 | import org.eclipse.xtend.lib.annotations.Data |
@@ -45,6 +48,8 @@ class RefinementRuleProvider { | |||
45 | val extension PartialinterpretationFactory factory2 = PartialinterpretationFactory.eINSTANCE | 48 | val extension PartialinterpretationFactory factory2 = PartialinterpretationFactory.eINSTANCE |
46 | val extension LogiclanguageFactory factory3 = LogiclanguageFactory.eINSTANCE | 49 | val extension LogiclanguageFactory factory3 = LogiclanguageFactory.eINSTANCE |
47 | 50 | ||
51 | var AdvancedViatraQueryEngine queryEngine | ||
52 | |||
48 | def canonizeName(String name) { | 53 | def canonizeName(String name) { |
49 | return name.replace(' ','_') | 54 | return name.replace(' ','_') |
50 | } | 55 | } |
@@ -60,6 +65,7 @@ class RefinementRuleProvider { | |||
60 | { | 65 | { |
61 | val res = new LinkedHashMap | 66 | val res = new LinkedHashMap |
62 | val recursiveObjectCreation = recursiveObjectCreation(p,i) | 67 | val recursiveObjectCreation = recursiveObjectCreation(p,i) |
68 | queryEngine = ViatraQueryEngine.on(new EMFScope(i)) as AdvancedViatraQueryEngine | ||
63 | for(LHSEntry: patterns.refineObjectQueries.entrySet) { | 69 | for(LHSEntry: patterns.refineObjectQueries.entrySet) { |
64 | val containmentRelation = LHSEntry.key.containmentRelation | 70 | val containmentRelation = LHSEntry.key.containmentRelation |
65 | val inverseRelation = LHSEntry.key.inverseContainment | 71 | val inverseRelation = LHSEntry.key.inverseContainment |
@@ -90,8 +96,7 @@ class RefinementRuleProvider { | |||
90 | if(inverseRelation!== null) { | 96 | if(inverseRelation!== null) { |
91 | ruleBuilder.action[match | | 97 | ruleBuilder.action[match | |
92 | statistics.incrementTransformationCount | 98 | statistics.incrementTransformationCount |
93 | // println(name) | 99 | // println(name) |
94 | val startTime = System.nanoTime | ||
95 | //val problem = match.get(0) as LogicProblem | 100 | //val problem = match.get(0) as LogicProblem |
96 | val interpretation = match.get(1) as PartialInterpretation | 101 | val interpretation = match.get(1) as PartialInterpretation |
97 | val relationInterpretation = match.get(2) as PartialRelationInterpretation | 102 | val relationInterpretation = match.get(2) as PartialRelationInterpretation |
@@ -99,79 +104,89 @@ class RefinementRuleProvider { | |||
99 | val typeInterpretation = match.get(4) as PartialComplexTypeInterpretation | 104 | val typeInterpretation = match.get(4) as PartialComplexTypeInterpretation |
100 | val container = match.get(5) as DefinedElement | 105 | val container = match.get(5) as DefinedElement |
101 | 106 | ||
102 | createObjectActionWithContainmentAndInverse( | 107 | queryEngine.delayUpdatePropagation [ |
103 | nameNewElement, | 108 | val startTime = System.nanoTime |
104 | interpretation, | 109 | createObjectActionWithContainmentAndInverse( |
105 | typeInterpretation, | 110 | nameNewElement, |
106 | container, | 111 | interpretation, |
107 | relationInterpretation, | 112 | typeInterpretation, |
108 | inverseRelationInterpretation, | 113 | container, |
109 | [createDefinedElement], | 114 | relationInterpretation, |
110 | recursiceObjectCreations, | 115 | inverseRelationInterpretation, |
111 | scopePropagator | 116 | [createDefinedElement], |
112 | ) | 117 | recursiceObjectCreations, |
113 | 118 | scopePropagator | |
114 | val propagatorStartTime = System.nanoTime | 119 | ) |
115 | statistics.addExecutionTime(propagatorStartTime-startTime) | 120 | statistics.addExecutionTime(System.nanoTime-startTime) |
121 | ] | ||
116 | 122 | ||
117 | // Scope propagation | 123 | // Scope propagation |
118 | scopePropagator.propagateAllScopeConstraints() | 124 | queryEngine.delayUpdatePropagation [ |
119 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | 125 | val propagatorStartTime = System.nanoTime |
126 | scopePropagator.propagateAllScopeConstraints() | ||
127 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | ||
128 | ] | ||
120 | ] | 129 | ] |
121 | } else { | 130 | } else { |
122 | ruleBuilder.action[match | | 131 | ruleBuilder.action[match | |
123 | statistics.incrementTransformationCount | 132 | statistics.incrementTransformationCount |
124 | // println(name) | 133 | // println(name) |
125 | val startTime = System.nanoTime | ||
126 | //val problem = match.get(0) as LogicProblem | 134 | //val problem = match.get(0) as LogicProblem |
127 | val interpretation = match.get(1) as PartialInterpretation | 135 | val interpretation = match.get(1) as PartialInterpretation |
128 | val relationInterpretation = match.get(2) as PartialRelationInterpretation | 136 | val relationInterpretation = match.get(2) as PartialRelationInterpretation |
129 | val typeInterpretation = match.get(3) as PartialComplexTypeInterpretation | 137 | val typeInterpretation = match.get(3) as PartialComplexTypeInterpretation |
130 | val container = match.get(4) as DefinedElement | 138 | val container = match.get(4) as DefinedElement |
131 | 139 | ||
132 | createObjectActionWithContainment( | 140 | queryEngine.delayUpdatePropagation [ |
133 | nameNewElement, | 141 | val startTime = System.nanoTime |
134 | interpretation, | 142 | createObjectActionWithContainment( |
135 | typeInterpretation, | 143 | nameNewElement, |
136 | container, | 144 | interpretation, |
137 | relationInterpretation, | 145 | typeInterpretation, |
138 | [createDefinedElement], | 146 | container, |
139 | recursiceObjectCreations, | 147 | relationInterpretation, |
140 | scopePropagator | 148 | [createDefinedElement], |
141 | ) | 149 | recursiceObjectCreations, |
142 | 150 | scopePropagator | |
143 | val propagatorStartTime = System.nanoTime | 151 | ) |
144 | statistics.addExecutionTime(propagatorStartTime-startTime) | 152 | statistics.addExecutionTime(System.nanoTime-startTime) |
153 | ] | ||
145 | 154 | ||
146 | // Scope propagation | 155 | // Scope propagation |
147 | scopePropagator.propagateAllScopeConstraints() | 156 | queryEngine.delayUpdatePropagation [ |
148 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | 157 | val propagatorStartTime = System.nanoTime |
158 | scopePropagator.propagateAllScopeConstraints() | ||
159 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | ||
160 | ] | ||
149 | ] | 161 | ] |
150 | } | 162 | } |
151 | } else { | 163 | } else { |
152 | ruleBuilder.action[match | | 164 | ruleBuilder.action[match | |
153 | statistics.incrementTransformationCount | 165 | statistics.incrementTransformationCount |
154 | // println(name) | 166 | // println(name) |
155 | val startTime = System.nanoTime | ||
156 | //val problem = match.get(0) as LogicProblem | 167 | //val problem = match.get(0) as LogicProblem |
157 | val interpretation = match.get(1) as PartialInterpretation | 168 | val interpretation = match.get(1) as PartialInterpretation |
158 | val typeInterpretation = match.get(2) as PartialComplexTypeInterpretation | 169 | val typeInterpretation = match.get(2) as PartialComplexTypeInterpretation |
159 | 170 | ||
160 | createObjectAction( | 171 | queryEngine.delayUpdatePropagation [ |
161 | nameNewElement, | 172 | val startTime = System.nanoTime |
162 | interpretation, | 173 | createObjectAction( |
163 | typeInterpretation, | 174 | nameNewElement, |
164 | [createDefinedElement], | 175 | interpretation, |
165 | recursiceObjectCreations, | 176 | typeInterpretation, |
166 | scopePropagator | 177 | [createDefinedElement], |
167 | ) | 178 | recursiceObjectCreations, |
168 | 179 | scopePropagator | |
169 | val propagatorStartTime = System.nanoTime | 180 | ) |
170 | statistics.addExecutionTime(propagatorStartTime-startTime) | 181 | statistics.addExecutionTime(System.nanoTime-startTime) |
182 | ] | ||
171 | 183 | ||
172 | // Scope propagation | 184 | // Scope propagation |
173 | scopePropagator.propagateAllScopeConstraints() | 185 | queryEngine.delayUpdatePropagation [ |
174 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | 186 | val propagatorStartTime = System.nanoTime |
187 | scopePropagator.propagateAllScopeConstraints() | ||
188 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | ||
189 | ] | ||
175 | ] | 190 | ] |
176 | } | 191 | } |
177 | return ruleBuilder.build | 192 | return ruleBuilder.build |
@@ -342,7 +357,7 @@ class RefinementRuleProvider { | |||
342 | if (inverseRelation === null) { | 357 | if (inverseRelation === null) { |
343 | ruleBuilder.action [ match | | 358 | ruleBuilder.action [ match | |
344 | statistics.incrementTransformationCount | 359 | statistics.incrementTransformationCount |
345 | val startTime = System.nanoTime | 360 | |
346 | // println(name) | 361 | // println(name) |
347 | // val problem = match.get(0) as LogicProblem | 362 | // val problem = match.get(0) as LogicProblem |
348 | // val interpretation = match.get(1) as PartialInterpretation | 363 | // val interpretation = match.get(1) as PartialInterpretation |
@@ -350,19 +365,24 @@ class RefinementRuleProvider { | |||
350 | val src = match.get(3) as DefinedElement | 365 | val src = match.get(3) as DefinedElement |
351 | val trg = match.get(4) as DefinedElement | 366 | val trg = match.get(4) as DefinedElement |
352 | 367 | ||
353 | createRelationLinkAction(src, trg, relationInterpretation) | 368 | queryEngine.delayUpdatePropagation [ |
354 | 369 | val startTime = System.nanoTime | |
355 | val propagatorStartTime = System.nanoTime | 370 | createRelationLinkAction(src, trg, relationInterpretation) |
356 | statistics.addExecutionTime(propagatorStartTime-startTime) | 371 | statistics.addExecutionTime(System.nanoTime-startTime) |
372 | ] | ||
357 | 373 | ||
358 | // Scope propagation | 374 | // Scope propagation |
359 | scopePropagator.propagateAdditionToRelation(declaration) | 375 | if (scopePropagator.isPropagationNeededAfterAdditionToRelation(declaration)) { |
360 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | 376 | queryEngine.delayUpdatePropagation [ |
377 | val propagatorStartTime = System.nanoTime | ||
378 | scopePropagator.propagateAllScopeConstraints() | ||
379 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | ||
380 | ] | ||
381 | } | ||
361 | ] | 382 | ] |
362 | } else { | 383 | } else { |
363 | ruleBuilder.action [ match | | 384 | ruleBuilder.action [ match | |
364 | statistics.incrementTransformationCount | 385 | statistics.incrementTransformationCount |
365 | val startTime = System.nanoTime | ||
366 | // println(name) | 386 | // println(name) |
367 | // val problem = match.get(0) as LogicProblem | 387 | // val problem = match.get(0) as LogicProblem |
368 | // val interpretation = match.get(1) as PartialInterpretation | 388 | // val interpretation = match.get(1) as PartialInterpretation |
@@ -371,14 +391,20 @@ class RefinementRuleProvider { | |||
371 | val src = match.get(4) as DefinedElement | 391 | val src = match.get(4) as DefinedElement |
372 | val trg = match.get(5) as DefinedElement | 392 | val trg = match.get(5) as DefinedElement |
373 | 393 | ||
374 | createRelationLinkWithInverse(src, trg, relationInterpretation, inverseInterpretation) | 394 | queryEngine.delayUpdatePropagation [ |
375 | 395 | val startTime = System.nanoTime | |
376 | val propagatorStartTime = System.nanoTime | 396 | createRelationLinkWithInverse(src, trg, relationInterpretation, inverseInterpretation) |
377 | statistics.addExecutionTime(propagatorStartTime-startTime) | 397 | statistics.addExecutionTime(System.nanoTime-startTime) |
398 | ] | ||
378 | 399 | ||
379 | // Scope propagation | 400 | // Scope propagation |
380 | scopePropagator.propagateAdditionToRelation(declaration) | 401 | if (scopePropagator.isPropagationNeededAfterAdditionToRelation(declaration)) { |
381 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | 402 | queryEngine.delayUpdatePropagation [ |
403 | val propagatorStartTime = System.nanoTime | ||
404 | scopePropagator.propagateAllScopeConstraints() | ||
405 | statistics.addScopePropagationTime(System.nanoTime-propagatorStartTime) | ||
406 | ] | ||
407 | } | ||
382 | ] | 408 | ] |
383 | } | 409 | } |
384 | 410 | ||