diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver')
5 files changed, 80 insertions, 45 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend index f43ab96d..b6918294 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend | |||
@@ -1,8 +1,10 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra | 1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra |
2 | 2 | ||
3 | import com.google.common.collect.ImmutableMap | ||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel | 4 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel |
4 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem |
5 | import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.TransfomedViatraQuery | 6 | import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.TransfomedViatraQuery |
7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.ModalPatternQueries | ||
6 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternProvider | 8 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternProvider |
7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.rules.GoalConstraintProvider | 9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.rules.GoalConstraintProvider |
8 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.rules.RefinementRuleProvider | 10 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.rules.RefinementRuleProvider |
@@ -10,6 +12,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par | |||
10 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace | 12 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace |
11 | import java.util.Collection | 13 | import java.util.Collection |
12 | import java.util.List | 14 | import java.util.List |
15 | import java.util.Map | ||
13 | import java.util.Set | 16 | import java.util.Set |
14 | import org.eclipse.viatra.query.runtime.api.IPatternMatch | 17 | import org.eclipse.viatra.query.runtime.api.IPatternMatch |
15 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | 18 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification |
@@ -20,34 +23,41 @@ import org.eclipse.xtend.lib.annotations.Data | |||
20 | 23 | ||
21 | class ModelGenerationStatistics { | 24 | class ModelGenerationStatistics { |
22 | public var long transformationExecutionTime = 0 | 25 | public var long transformationExecutionTime = 0 |
26 | |||
23 | synchronized def addExecutionTime(long amount) { | 27 | synchronized def addExecutionTime(long amount) { |
24 | transformationExecutionTime+=amount | 28 | transformationExecutionTime += amount |
25 | } | 29 | } |
30 | |||
26 | public var long PreliminaryTypeAnalisisTime = 0 | 31 | public var long PreliminaryTypeAnalisisTime = 0 |
27 | } | 32 | } |
33 | |||
28 | @Data class ModelGenerationMethod { | 34 | @Data class ModelGenerationMethod { |
29 | ModelGenerationStatistics statistics | 35 | ModelGenerationStatistics statistics |
30 | 36 | ||
31 | Collection<? extends BatchTransformationRule<?,?>> objectRefinementRules | 37 | Collection<? extends BatchTransformationRule<?, ?>> objectRefinementRules |
32 | Collection<? extends BatchTransformationRule<?,?>> relationRefinementRules | 38 | Collection<? extends BatchTransformationRule<?, ?>> relationRefinementRules |
33 | 39 | ||
34 | List<MultiplicityGoalConstraintCalculator> unfinishedMultiplicities | 40 | List<MultiplicityGoalConstraintCalculator> unfinishedMultiplicities |
35 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unfinishedWF | 41 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unfinishedWF |
36 | 42 | ||
37 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> invalidWF | 43 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> invalidWF |
38 | 44 | ||
39 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> allPatterns | 45 | Map<String, ModalPatternQueries> modalRelationQueries |
46 | |||
47 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> allPatterns | ||
40 | } | 48 | } |
49 | |||
41 | enum TypeInferenceMethod { | 50 | enum TypeInferenceMethod { |
42 | Generic, PreliminaryAnalysis | 51 | Generic, |
52 | PreliminaryAnalysis | ||
43 | } | 53 | } |
44 | 54 | ||
45 | class ModelGenerationMethodProvider { | 55 | class ModelGenerationMethodProvider { |
46 | private val PatternProvider patternProvider = new PatternProvider | 56 | val PatternProvider patternProvider = new PatternProvider |
47 | private val RefinementRuleProvider refinementRuleProvider = new RefinementRuleProvider | 57 | val RefinementRuleProvider refinementRuleProvider = new RefinementRuleProvider |
48 | private val GoalConstraintProvider goalConstraintProvider = new GoalConstraintProvider | 58 | val GoalConstraintProvider goalConstraintProvider = new GoalConstraintProvider |
49 | 59 | ||
50 | public def ModelGenerationMethod createModelGenerationMethod( | 60 | def ModelGenerationMethod createModelGenerationMethod( |
51 | LogicProblem logicProblem, | 61 | LogicProblem logicProblem, |
52 | PartialInterpretation emptySolution, | 62 | PartialInterpretation emptySolution, |
53 | ReasonerWorkspace workspace, | 63 | ReasonerWorkspace workspace, |
@@ -58,25 +68,31 @@ class ModelGenerationMethodProvider { | |||
58 | ) { | 68 | ) { |
59 | val statistics = new ModelGenerationStatistics | 69 | val statistics = new ModelGenerationStatistics |
60 | val writeFiles = (debugLevel === DocumentationLevel.NORMAL || debugLevel === DocumentationLevel.FULL) | 70 | val writeFiles = (debugLevel === DocumentationLevel.NORMAL || debugLevel === DocumentationLevel.FULL) |
61 | 71 | ||
62 | val Set<PQuery> existingQueries = logicProblem | 72 | val Set<PQuery> existingQueries = logicProblem.relations.map[annotations].flatten.filter(TransfomedViatraQuery). |
63 | .relations | 73 | map[it.patternPQuery as PQuery].toSet |
64 | .map[annotations] | 74 | |
65 | .flatten | 75 | val queries = patternProvider.generateQueries(logicProblem, emptySolution, statistics, existingQueries, |
66 | .filter(TransfomedViatraQuery) | 76 | workspace, typeInferenceMethod, writeFiles) |
67 | .map[it.patternPQuery as PQuery] | 77 | val // LinkedHashMap<Pair<Relation, ? extends Type>, BatchTransformationRule<GenericPatternMatch, ViatraQueryMatcher<GenericPatternMatch>>> |
68 | .toSet | 78 | objectRefinementRules = refinementRuleProvider.createObjectRefinementRules(queries, scopePropagator, |
69 | 79 | nameNewElements, statistics) | |
70 | val queries = patternProvider.generateQueries(logicProblem,emptySolution,statistics,existingQueries,workspace,typeInferenceMethod,writeFiles) | 80 | val relationRefinementRules = refinementRuleProvider.createRelationRefinementRules(queries, statistics) |
71 | val //LinkedHashMap<Pair<Relation, ? extends Type>, BatchTransformationRule<GenericPatternMatch, ViatraQueryMatcher<GenericPatternMatch>>> | 81 | |
72 | objectRefinementRules = refinementRuleProvider.createObjectRefinementRules(queries,scopePropagator,nameNewElements,statistics) | ||
73 | val relationRefinementRules = refinementRuleProvider.createRelationRefinementRules(queries,statistics) | ||
74 | |||
75 | val unfinishedMultiplicities = goalConstraintProvider.getUnfinishedMultiplicityQueries(queries) | 82 | val unfinishedMultiplicities = goalConstraintProvider.getUnfinishedMultiplicityQueries(queries) |
76 | val unfinishedWF = queries.getUnfinishedWFQueries.values | 83 | val unfinishedWF = queries.getUnfinishedWFQueries.values |
77 | 84 | ||
85 | val modalRelationQueriesBuilder = ImmutableMap.builder | ||
86 | for (entry : queries.modalRelationQueries.entrySet) { | ||
87 | val annotation = entry.key.annotations.filter(TransfomedViatraQuery).head | ||
88 | if (annotation !== null) { | ||
89 | modalRelationQueriesBuilder.put(annotation.patternFullyQualifiedName, entry.value) | ||
90 | } | ||
91 | } | ||
92 | val modalRelationQueries = modalRelationQueriesBuilder.build | ||
93 | |||
78 | val invalidWF = queries.getInvalidWFQueries.values | 94 | val invalidWF = queries.getInvalidWFQueries.values |
79 | 95 | ||
80 | return new ModelGenerationMethod( | 96 | return new ModelGenerationMethod( |
81 | statistics, | 97 | statistics, |
82 | objectRefinementRules.values, | 98 | objectRefinementRules.values, |
@@ -84,6 +100,7 @@ class ModelGenerationMethodProvider { | |||
84 | unfinishedMultiplicities, | 100 | unfinishedMultiplicities, |
85 | unfinishedWF, | 101 | unfinishedWF, |
86 | invalidWF, | 102 | invalidWF, |
103 | modalRelationQueries, | ||
87 | queries.allQueries | 104 | queries.allQueries |
88 | ) | 105 | ) |
89 | } | 106 | } |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/MultiplicityGoalConstraintCalculator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/MultiplicityGoalConstraintCalculator.xtend index e05160d0..4b9629df 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/MultiplicityGoalConstraintCalculator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/MultiplicityGoalConstraintCalculator.xtend | |||
@@ -11,28 +11,28 @@ class MultiplicityGoalConstraintCalculator { | |||
11 | val IQuerySpecification<?> querySpecification; | 11 | val IQuerySpecification<?> querySpecification; |
12 | var ViatraQueryMatcher<?> matcher; | 12 | var ViatraQueryMatcher<?> matcher; |
13 | 13 | ||
14 | public new(String targetRelationName, IQuerySpecification<?> querySpecification) { | 14 | new(String targetRelationName, IQuerySpecification<?> querySpecification) { |
15 | this.targetRelationName = targetRelationName | 15 | this.targetRelationName = targetRelationName |
16 | this.querySpecification = querySpecification | 16 | this.querySpecification = querySpecification |
17 | this.matcher = null | 17 | this.matcher = null |
18 | } | 18 | } |
19 | 19 | ||
20 | public new(MultiplicityGoalConstraintCalculator other) { | 20 | new(MultiplicityGoalConstraintCalculator other) { |
21 | this.targetRelationName = other.targetRelationName | 21 | this.targetRelationName = other.targetRelationName |
22 | this.querySpecification = other.querySpecification | 22 | this.querySpecification = other.querySpecification |
23 | this.matcher = null | 23 | this.matcher = null |
24 | } | 24 | } |
25 | 25 | ||
26 | def public getName() { | 26 | def getName() { |
27 | targetRelationName | 27 | targetRelationName |
28 | } | 28 | } |
29 | 29 | ||
30 | def public init(Notifier notifier) { | 30 | def init(Notifier notifier) { |
31 | val engine = ViatraQueryEngine.on(new EMFScope(notifier)) | 31 | val engine = ViatraQueryEngine.on(new EMFScope(notifier)) |
32 | matcher = querySpecification.getMatcher(engine) | 32 | matcher = querySpecification.getMatcher(engine) |
33 | } | 33 | } |
34 | 34 | ||
35 | def public calculateValue() { | 35 | def calculateValue() { |
36 | var res = 0 | 36 | var res = 0 |
37 | val allMatches = this.matcher.allMatches | 37 | val allMatches = this.matcher.allMatches |
38 | for(match : allMatches) { | 38 | for(match : allMatches) { |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend index d4c76bb4..24b3e870 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend | |||
@@ -55,7 +55,7 @@ class PatternGenerator { | |||
55 | typeIndexer.requiresTypeAnalysis || typeRefinementGenerator.requiresTypeAnalysis | 55 | typeIndexer.requiresTypeAnalysis || typeRefinementGenerator.requiresTypeAnalysis |
56 | } | 56 | } |
57 | 57 | ||
58 | public dispatch def referRelation( | 58 | public dispatch def CharSequence referRelation( |
59 | RelationDeclaration referred, | 59 | RelationDeclaration referred, |
60 | String sourceVariable, | 60 | String sourceVariable, |
61 | String targetVariable, | 61 | String targetVariable, |
@@ -64,7 +64,7 @@ class PatternGenerator { | |||
64 | { | 64 | { |
65 | return this.relationDeclarationIndexer.referRelation(referred,sourceVariable,targetVariable,modality) | 65 | return this.relationDeclarationIndexer.referRelation(referred,sourceVariable,targetVariable,modality) |
66 | } | 66 | } |
67 | public dispatch def referRelation( | 67 | public dispatch def CharSequence referRelation( |
68 | RelationDefinition referred, | 68 | RelationDefinition referred, |
69 | String sourceVariable, | 69 | String sourceVariable, |
70 | String targetVariable, | 70 | String targetVariable, |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend index 0e13a5e1..e87f52af 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend | |||
@@ -2,8 +2,10 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns | |||
2 | 2 | ||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Relation | 3 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Relation |
4 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration | 4 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration |
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDefinition | ||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type | 6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type |
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | 7 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem |
8 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.Modality | ||
7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationStatistics | 9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationStatistics |
8 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeAnalysis | 10 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeAnalysis |
9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeAnalysisResult | 11 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeAnalysisResult |
@@ -11,7 +13,9 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod | |||
11 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.util.ParseUtil | 13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.util.ParseUtil |
12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
13 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace | 15 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace |
16 | import java.util.Collection | ||
14 | import java.util.Map | 17 | import java.util.Map |
18 | import java.util.Set | ||
15 | import org.eclipse.viatra.query.runtime.api.IPatternMatch | 19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch |
16 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | 20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification |
17 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher | 21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher |
@@ -19,8 +23,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery | |||
19 | import org.eclipse.xtend.lib.annotations.Data | 23 | import org.eclipse.xtend.lib.annotations.Data |
20 | 24 | ||
21 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 25 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
22 | import java.util.Collection | ||
23 | import java.util.Set | ||
24 | 26 | ||
25 | @Data class GeneratedPatterns { | 27 | @Data class GeneratedPatterns { |
26 | public Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> invalidWFQueries | 28 | public Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> invalidWFQueries |
@@ -29,9 +31,16 @@ import java.util.Set | |||
29 | public Map<ObjectCreationPrecondition, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refineObjectQueries | 31 | public Map<ObjectCreationPrecondition, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refineObjectQueries |
30 | public Map<? extends Type, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refineTypeQueries | 32 | public Map<? extends Type, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refineTypeQueries |
31 | public Map<Pair<RelationDeclaration, Relation>, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refinerelationQueries | 33 | public Map<Pair<RelationDeclaration, Relation>, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refinerelationQueries |
34 | public Map<RelationDefinition, ModalPatternQueries> modalRelationQueries | ||
32 | public Collection<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> allQueries | 35 | public Collection<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> allQueries |
33 | } | 36 | } |
34 | 37 | ||
38 | @Data class ModalPatternQueries { | ||
39 | val IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> mayQuery | ||
40 | val IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> mustQuery | ||
41 | val IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> currentQuery | ||
42 | } | ||
43 | |||
35 | class PatternProvider { | 44 | class PatternProvider { |
36 | 45 | ||
37 | val TypeAnalysis typeAnalysis = new TypeAnalysis | 46 | val TypeAnalysis typeAnalysis = new TypeAnalysis |
@@ -71,7 +80,7 @@ class PatternProvider { | |||
71 | LogicProblem problem, | 80 | LogicProblem problem, |
72 | PartialInterpretation emptySolution, | 81 | PartialInterpretation emptySolution, |
73 | TypeAnalysisResult typeAnalysisResult, | 82 | TypeAnalysisResult typeAnalysisResult, |
74 | Map<String, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> queries | 83 | Map<String, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> queries |
75 | ) { | 84 | ) { |
76 | val Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> | 85 | val Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> |
77 | invalidWFQueries = patternGenerator.invalidIndexer.getInvalidateByWfQueryNames(problem).mapValues[it.lookup(queries)] | 86 | invalidWFQueries = patternGenerator.invalidIndexer.getInvalidateByWfQueryNames(problem).mapValues[it.lookup(queries)] |
@@ -85,6 +94,14 @@ class PatternProvider { | |||
85 | refineTypeQueries = patternGenerator.typeRefinementGenerator.getRefineTypeQueryNames(problem,emptySolution,typeAnalysisResult).mapValues[it.lookup(queries)] | 94 | refineTypeQueries = patternGenerator.typeRefinementGenerator.getRefineTypeQueryNames(problem,emptySolution,typeAnalysisResult).mapValues[it.lookup(queries)] |
86 | val Map<Pair<RelationDeclaration, Relation>, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> | 95 | val Map<Pair<RelationDeclaration, Relation>, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> |
87 | refineRelationQueries = patternGenerator.relationRefinementGenerator.getRefineRelationQueries(problem).mapValues[it.lookup(queries)] | 96 | refineRelationQueries = patternGenerator.relationRefinementGenerator.getRefineRelationQueries(problem).mapValues[it.lookup(queries)] |
97 | val Map<RelationDefinition, ModalPatternQueries> modalRelationQueries = problem.relations.filter(RelationDefinition).toMap([it], [ relationDefinition | | ||
98 | val indexer = patternGenerator.relationDefinitionIndexer | ||
99 | new ModalPatternQueries( | ||
100 | indexer.relationDefinitionName(relationDefinition, Modality.MAY).lookup(queries), | ||
101 | indexer.relationDefinitionName(relationDefinition, Modality.MUST).lookup(queries), | ||
102 | indexer.relationDefinitionName(relationDefinition, Modality.CURRENT).lookup(queries) | ||
103 | ) | ||
104 | ]) | ||
88 | return new GeneratedPatterns( | 105 | return new GeneratedPatterns( |
89 | invalidWFQueries, | 106 | invalidWFQueries, |
90 | unfinishedWFQueries, | 107 | unfinishedWFQueries, |
@@ -92,6 +109,7 @@ class PatternProvider { | |||
92 | refineObjectsQueries, | 109 | refineObjectsQueries, |
93 | refineTypeQueries, | 110 | refineTypeQueries, |
94 | refineRelationQueries, | 111 | refineRelationQueries, |
112 | modalRelationQueries, | ||
95 | queries.values | 113 | queries.values |
96 | ) | 114 | ) |
97 | } | 115 | } |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend index 9723373f..cedcec5a 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend | |||
@@ -71,7 +71,7 @@ class RelationDefinitionIndexer { | |||
71 | ] | 71 | ] |
72 | } | 72 | } |
73 | 73 | ||
74 | private def relationDefinitionName(RelationDefinition relation, Modality modality) | 74 | def String relationDefinitionName(RelationDefinition relation, Modality modality) |
75 | '''«modality.name.toLowerCase»InRelation_«base.canonizeName(relation.name)»''' | 75 | '''«modality.name.toLowerCase»InRelation_«base.canonizeName(relation.name)»''' |
76 | 76 | ||
77 | private def canonizeName(PVariable v) { | 77 | private def canonizeName(PVariable v) { |