diff options
author | 2018-01-23 18:01:01 +0100 | |
---|---|---|
committer | 2018-01-23 18:01:01 +0100 | |
commit | 99c2eebf5120066ebd03766ac61f0d3aa230da40 (patch) | |
tree | 11f6799cdfcf05586bab1944a6907602501e5d66 | |
parent | Scoping and linking of Viatra Packages and Patterns is completed (diff) | |
download | VIATRA-Generator-99c2eebf5120066ebd03766ac61f0d3aa230da40.tar.gz VIATRA-Generator-99c2eebf5120066ebd03766ac61f0d3aa230da40.tar.zst VIATRA-Generator-99c2eebf5120066ebd03766ac61f0d3aa230da40.zip |
Removed PQuery from API, IQuerySpecification is used instead
4 files changed, 17 insertions, 10 deletions
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend index 91c6a61a..ae22af1c 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend | |||
@@ -41,7 +41,7 @@ import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | |||
41 | @Data class ViatraQuerySetDescriptor { | 41 | @Data class ViatraQuerySetDescriptor { |
42 | val List<? extends IQuerySpecification<?>> patterns | 42 | val List<? extends IQuerySpecification<?>> patterns |
43 | val Set<? extends IQuerySpecification<?>> validationPatterns | 43 | val Set<? extends IQuerySpecification<?>> validationPatterns |
44 | val Map<PQuery,EStructuralFeature> derivedFeatures | 44 | val Map<IQuerySpecification<?>,EStructuralFeature> derivedFeatures |
45 | } | 45 | } |
46 | class Viatra2LogicTrace { | 46 | class Viatra2LogicTrace { |
47 | public val Map<PQuery, RelationDefinition> query2Relation = new HashMap | 47 | public val Map<PQuery, RelationDefinition> query2Relation = new HashMap |
@@ -155,7 +155,7 @@ class Viatra2Logic { | |||
155 | 155 | ||
156 | def transformQueryConstraints( | 156 | def transformQueryConstraints( |
157 | Set<? extends IQuerySpecification<?>> validationPatterns, | 157 | Set<? extends IQuerySpecification<?>> validationPatterns, |
158 | Map<PQuery,EStructuralFeature> derivedFeatures, | 158 | Map<IQuerySpecification<?>,EStructuralFeature> derivedFeatures, |
159 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | 159 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, |
160 | Viatra2LogicTrace viatra2LogicTrace) | 160 | Viatra2LogicTrace viatra2LogicTrace) |
161 | { | 161 | { |
@@ -179,7 +179,7 @@ class Viatra2Logic { | |||
179 | ecore2LogicTrace.output.annotations.add(annotation) | 179 | ecore2LogicTrace.output.annotations.add(annotation) |
180 | } | 180 | } |
181 | for(derivedFeature : derivedFeatures.entrySet) { | 181 | for(derivedFeature : derivedFeatures.entrySet) { |
182 | val relationDefinition = derivedFeature.key.lookup(viatra2LogicTrace.query2Relation) | 182 | val relationDefinition = derivedFeature.key.internalQueryRepresentation.lookup(viatra2LogicTrace.query2Relation) |
183 | val feature = derivedFeature.value | 183 | val feature = derivedFeature.value |
184 | if(feature instanceof EAttribute) { | 184 | if(feature instanceof EAttribute) { |
185 | val declaration = ecore2Logic.relationOfAttribute(ecore2LogicTrace.trace,feature) | 185 | val declaration = ecore2Logic.relationOfAttribute(ecore2LogicTrace.trace,feature) |
@@ -190,7 +190,7 @@ class Viatra2Logic { | |||
190 | } else throw new IllegalArgumentException('''Unknown feature: «feature»''') | 190 | } else throw new IllegalArgumentException('''Unknown feature: «feature»''') |
191 | val annotation = createDefinedByDerivedFeature => [ | 191 | val annotation = createDefinedByDerivedFeature => [ |
192 | it.target = relationDefinition.defines | 192 | it.target = relationDefinition.defines |
193 | it.query = derivedFeature.key.lookup(viatra2LogicTrace.query2Annotation) | 193 | it.query = derivedFeature.key.internalQueryRepresentation.lookup(viatra2LogicTrace.query2Annotation) |
194 | ] | 194 | ] |
195 | ecore2LogicTrace.output.annotations+=annotation | 195 | ecore2LogicTrace.output.annotations+=annotation |
196 | } | 196 | } |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/util/ParseUtil.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/util/ParseUtil.xtend index 005304ea..d315ac3f 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/util/ParseUtil.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/util/ParseUtil.xtend | |||
@@ -55,7 +55,7 @@ class ParseUtil { | |||
55 | } | 55 | } |
56 | 56 | ||
57 | // @Inject | 57 | // @Inject |
58 | // var ParseHelper<PatternModel> parseHelper; | 58 | // var ParseHelper<PatternModel> parseHelper; |
59 | val builder = new SpecificationBuilder | 59 | val builder = new SpecificationBuilder |
60 | 60 | ||
61 | public def parse(CharSequence vqlFileContent) { | 61 | public def parse(CharSequence vqlFileContent) { |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend index e07da778..43d145d3 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend | |||
@@ -74,8 +74,8 @@ class FAMLoader extends MetamodelLoader{ | |||
74 | val patterns = i.specifications.toList | 74 | val patterns = i.specifications.toList |
75 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet | 75 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet |
76 | val derivedFeatures = new LinkedHashMap | 76 | val derivedFeatures = new LinkedHashMap |
77 | derivedFeatures.put(i.type.internalQueryRepresentation,metamodel.attributes.filter[it.name == "type"].head) | 77 | derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) |
78 | derivedFeatures.put(i.model.internalQueryRepresentation,metamodel.references.filter[it.name == "model"].head) | 78 | derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) |
79 | val res = new ViatraQuerySetDescriptor( | 79 | val res = new ViatraQuerySetDescriptor( |
80 | patterns, | 80 | patterns, |
81 | wfPatterns, | 81 | wfPatterns, |
@@ -196,7 +196,7 @@ class FileSystemLoader extends MetamodelLoader{ | |||
196 | val patterns = patternGroup.specifications.toList | 196 | val patterns = patternGroup.specifications.toList |
197 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet | 197 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet |
198 | val derivedFeatures = new HashMap | 198 | val derivedFeatures = new HashMap |
199 | derivedFeatures.put(patternGroup.live.internalQueryRepresentation,metamodel.references.filter[it.name == "live"].head) | 199 | derivedFeatures.put(patternGroup.live,metamodel.references.filter[it.name == "live"].head) |
200 | return new ViatraQuerySetDescriptor( | 200 | return new ViatraQuerySetDescriptor( |
201 | patterns, | 201 | patterns, |
202 | wfPatterns, | 202 | wfPatterns, |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend index d0f88b65..863a91c8 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend | |||
@@ -34,6 +34,8 @@ import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore | |||
34 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner | 34 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner |
35 | import java.util.LinkedList | 35 | import java.util.LinkedList |
36 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | 36 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation |
37 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicStructureBuilder | ||
38 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder | ||
37 | 39 | ||
38 | class SimpleRun { | 40 | class SimpleRun { |
39 | 41 | ||
@@ -93,6 +95,11 @@ class SimpleRun { | |||
93 | val interpretations = reasoner.getInterpretations(solution as ModelResult) | 95 | val interpretations = reasoner.getInterpretations(solution as ModelResult) |
94 | val models = new LinkedList | 96 | val models = new LinkedList |
95 | for(interpretation : interpretations) { | 97 | for(interpretation : interpretations) { |
98 | val extension b = new LogicStructureBuilder | ||
99 | val extension a = new LogicProblemBuilder | ||
100 | |||
101 | |||
102 | |||
96 | val instanceModel = logic2Ecore.transformInterpretation(interpretation,modelGenerationProblem.trace) | 103 | val instanceModel = logic2Ecore.transformInterpretation(interpretation,modelGenerationProblem.trace) |
97 | models+=instanceModel | 104 | models+=instanceModel |
98 | } | 105 | } |
@@ -115,8 +122,8 @@ class SimpleRun { | |||
115 | val patterns = i.specifications.toList | 122 | val patterns = i.specifications.toList |
116 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet | 123 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet |
117 | val derivedFeatures = new LinkedHashMap | 124 | val derivedFeatures = new LinkedHashMap |
118 | derivedFeatures.put(i.type.internalQueryRepresentation,metamodel.attributes.filter[it.name == "type"].head) | 125 | derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) |
119 | derivedFeatures.put(i.model.internalQueryRepresentation,metamodel.references.filter[it.name == "model"].head) | 126 | derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) |
120 | val res = new ViatraQuerySetDescriptor( | 127 | val res = new ViatraQuerySetDescriptor( |
121 | patterns, | 128 | patterns, |
122 | wfPatterns, | 129 | wfPatterns, |