diff options
author | 2017-10-16 14:43:41 +0200 | |
---|---|---|
committer | 2017-10-16 14:43:41 +0200 | |
commit | e7b208c529bfaa22550575ef8ea083bdb920b4b1 (patch) | |
tree | 53eb81b634a9ef64b66e1a5f33dce560d95244cf | |
parent | By default, Alloy uses filtered type ORM mapping (diff) | |
download | VIATRA-Generator-e7b208c529bfaa22550575ef8ea083bdb920b4b1.tar.gz VIATRA-Generator-e7b208c529bfaa22550575ef8ea083bdb920b4b1.tar.zst VIATRA-Generator-e7b208c529bfaa22550575ef8ea083bdb920b4b1.zip |
measurement and mutant coverage
3 files changed, 108 insertions, 110 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend index 40edbd02..12fe775a 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend | |||
@@ -1,5 +1,7 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.run | 1 | package hu.bme.mit.inf.dslreasoner.run |
2 | 2 | ||
3 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolver | ||
4 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration | ||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | 5 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic |
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration | 6 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration |
5 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor | 7 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor |
@@ -18,25 +20,21 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod | |||
18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic | 20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic |
19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage | 22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage |
21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | ||
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor | 23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor |
23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy | 24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy |
24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner | 25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner |
25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration | 26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration |
27 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | ||
26 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | 28 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace |
29 | import java.util.LinkedList | ||
27 | import java.util.List | 30 | import java.util.List |
28 | import org.eclipse.emf.ecore.EObject | 31 | import org.eclipse.emf.ecore.EObject |
29 | import org.eclipse.emf.ecore.resource.Resource | 32 | import org.eclipse.emf.ecore.resource.Resource |
30 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | 33 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl |
31 | import org.eclipse.viatra.query.runtime.api.IPatternMatch | ||
32 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | ||
33 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher | ||
34 | import org.eclipse.xtend.lib.annotations.Data | 34 | import org.eclipse.xtend.lib.annotations.Data |
35 | import java.util.LinkedList | 35 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification |
36 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolver | 36 | import java.util.Set |
37 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration | 37 | import java.util.Comparator |
38 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvisVisualisation | ||
39 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | ||
40 | 38 | ||
41 | enum Metamodel { | 39 | enum Metamodel { |
42 | FAM, YakinduWOSynch, Yakindu | 40 | FAM, YakinduWOSynch, Yakindu |
@@ -111,17 +109,18 @@ class ScenarioRunner { | |||
111 | 109 | ||
112 | } else if(scenario.constraints == Constraints.MinusOne) { | 110 | } else if(scenario.constraints == Constraints.MinusOne) { |
113 | var first = true | 111 | var first = true |
114 | //for(remove : vq.validationPatterns) { | 112 | |
113 | for(remove : vq.validationPatterns) { | ||
115 | for(run : 1..scenario.runs) { | 114 | for(run : 1..scenario.runs) { |
116 | 115 | ||
117 | //val removeName = remove.fullyQualifiedName | 116 | val removeName = remove.fullyQualifiedName |
118 | //val desc = new ViatraQuerySetDescriptor(vq.patterns,vq.validationPatterns.filter[it != remove].toSet,emptyMap) | 117 | val vq_m = new ViatraQuerySetDescriptor(vq.patterns.filter[it != remove].toList,vq.validationPatterns.filter[it != remove].toSet,emptyMap) |
119 | runCase(first,"minusOne"+run,run,scenario,mm,vq,ps) | 118 | runCase(first,"minusOne_"+removeName+"_"+run,run,scenario,mm,vq_m,ps) |
120 | first = false | 119 | first = false |
121 | System.gc System.gc System.gc | 120 | System.gc System.gc System.gc |
122 | //Thread.sleep(3000) | 121 | Thread.sleep(3000) |
123 | } | 122 | } |
124 | //} | 123 | } |
125 | } | 124 | } |
126 | } | 125 | } |
127 | 126 | ||
@@ -170,7 +169,7 @@ class ScenarioRunner { | |||
170 | loader = if(metamodel == Metamodel::FAM) { | 169 | loader = if(metamodel == Metamodel::FAM) { |
171 | new FAMLoader(inputs) | 170 | new FAMLoader(inputs) |
172 | } else if(metamodel == Metamodel::Yakindu || metamodel == Metamodel::YakinduWOSynch) { | 171 | } else if(metamodel == Metamodel::Yakindu || metamodel == Metamodel::YakinduWOSynch) { |
173 | new YakinduLoader(inputs) => [it.useSynchronization = false] | 172 | new YakinduLoader(inputs) => [it.useSynchronization = false it.useComplexStates = true] |
174 | } else throw new IllegalArgumentException('''Unknown domain: «metamodel»''') | 173 | } else throw new IllegalArgumentException('''Unknown domain: «metamodel»''') |
175 | } | 174 | } |
176 | 175 | ||
@@ -193,28 +192,28 @@ class ScenarioRunner { | |||
193 | it.nameNewElements = false | 192 | it.nameNewElements = false |
194 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis | 193 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis |
195 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints | 194 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints |
196 | it.debugCongiguration.partalInterpretationVisualisationFrequency = 1 | 195 | //it.debugCongiguration.partalInterpretationVisualisationFrequency = 1 |
197 | it.debugCongiguration.partialInterpretatioVisualiser = new GraphvizVisualisation | 196 | //it.debugCongiguration.partialInterpretatioVisualiser = new GraphvizVisualisation |
198 | it.stateCoderStrategy = if(scenario.statecoder == StateCoder::ID) { | 197 | it.stateCoderStrategy = if(scenario.statecoder == StateCoder::ID) { |
199 | StateCoderStrategy::IDBased | 198 | StateCoderStrategy::IDBased |
200 | } else { | 199 | } else { |
201 | StateCoderStrategy::Neighbourhood | 200 | StateCoderStrategy::Neighbourhood |
202 | } | 201 | } |
203 | if(scenario.statecoder != StateCoder::ID || scenario.statecoder != StateCoder::Normal) { | 202 | if(scenario.statecoder != StateCoder::ID || scenario.statecoder != StateCoder::Normal) { |
204 | val range = if(scenario.statecoder != StateCoder::R1) { | 203 | val range = if(scenario.statecoder === StateCoder::R1) { |
205 | 1 | 204 | 1 |
206 | } else if(scenario.statecoder != StateCoder::R2) { | 205 | } else if(scenario.statecoder === StateCoder::R2) { |
207 | 2 | 206 | 2 |
208 | } else if(scenario.statecoder != StateCoder::R3) { | 207 | } else if(scenario.statecoder === StateCoder::R3) { |
209 | 3 | 208 | 3 |
210 | } | 209 | } |
211 | 210 | ||
212 | it.diversityRequirement = new DiversityDescriptor => [ | 211 | it.diversityRequirement = new DiversityDescriptor => [ |
213 | it.relevantTypes = null | 212 | it.relevantTypes = null |
214 | it.relevantRelations = null | 213 | it.relevantRelations = null |
215 | it.maxNumber = 1 | 214 | it.maxNumber = 0 |
216 | it.range = range | 215 | it.range = range |
217 | it.parallels = 1 | 216 | it.parallels = 0 |
218 | ] | 217 | ] |
219 | } | 218 | } |
220 | ] | 219 | ] |
@@ -254,10 +253,15 @@ class ScenarioRunner { | |||
254 | val representationNumber = representationIndex + 1 | 253 | val representationNumber = representationIndex + 1 |
255 | if(representation instanceof PartialInterpretation) { | 254 | if(representation instanceof PartialInterpretation) { |
256 | workspace.writeModel(representation, '''solution«representationNumber».partialinterpretation''') | 255 | workspace.writeModel(representation, '''solution«representationNumber».partialinterpretation''') |
257 | val partialInterpretation2GML = new PartialInterpretation2Gml | 256 | // val partialInterpretation2GML = new PartialInterpretation2Gml |
258 | val gml = partialInterpretation2GML.transform(representation) | 257 | // val gml = partialInterpretation2GML.transform(representation) |
259 | //ecore2GML.transform(root) | 258 | // ecore2GML.transform(root) |
260 | workspace.writeText('''solutionVisualisation«representationNumber».gml''',gml) | 259 | // workspace.writeText('''solutionVisualisation«representationNumber».gml''',gml) |
260 | |||
261 | // val visualiser = new GraphvizVisualisation | ||
262 | // val visualisation = visualiser.visualiseConcretization(representation) | ||
263 | // visualisation.writeToFile(workspace,'''solutionVisualisation«representationNumber»''') | ||
264 | |||
261 | } else { | 265 | } else { |
262 | workspace.writeText('''solution«representationNumber».txt''',representation.toString) | 266 | workspace.writeText('''solution«representationNumber».txt''',representation.toString) |
263 | } | 267 | } |
@@ -313,7 +317,7 @@ class ScenarioRunner { | |||
313 | 317 | ||
314 | class DiverseMeasurementRunner { | 318 | class DiverseMeasurementRunner { |
315 | def static void main(String[] args) { | 319 | def static void main(String[] args) { |
316 | val scenario = new Scenario(30,49,Metamodel::Yakindu,Constraints.All,StateCoder.Normal,1,Solver::ViatraSolver) | 320 | val scenario = new Scenario(30,29,Metamodel::YakinduWOSynch,Constraints.Metamodel,StateCoder.R1,20,Solver::Alloy) |
317 | val scenarioRunner = new ScenarioRunner | 321 | val scenarioRunner = new ScenarioRunner |
318 | scenarioRunner.runScenario(scenario) | 322 | scenarioRunner.runScenario(scenario) |
319 | } | 323 | } |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphInconsistencyDetector.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphInconsistencyDetector.xtend index 4022804c..22addd3d 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphInconsistencyDetector.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphInconsistencyDetector.xtend | |||
@@ -12,7 +12,7 @@ class SGraphInconsistencyDetector extends ModelGenerationMethodBasedGlobalConstr | |||
12 | var ViatraQueryMatcher<?> noEntry | 12 | var ViatraQueryMatcher<?> noEntry |
13 | var ViatraQueryMatcher<?> entryHasNoOutgoing | 13 | var ViatraQueryMatcher<?> entryHasNoOutgoing |
14 | var ViatraQueryMatcher<?> choiceHasNoOutgiong | 14 | var ViatraQueryMatcher<?> choiceHasNoOutgiong |
15 | var ViatraQueryMatcher<?> choiceHasNoIncoming | 15 | //var ViatraQueryMatcher<?> choiceHasNoIncoming |
16 | var ViatraQueryMatcher<?> noSynch | 16 | var ViatraQueryMatcher<?> noSynch |
17 | var ViatraQueryMatcher<?> synchronizationHasNoOutgoing | 17 | var ViatraQueryMatcher<?> synchronizationHasNoOutgoing |
18 | 18 | ||
@@ -27,63 +27,48 @@ class SGraphInconsistencyDetector extends ModelGenerationMethodBasedGlobalConstr | |||
27 | return SGraphInconsistencyDetector.simpleName | 27 | return SGraphInconsistencyDetector.simpleName |
28 | } | 28 | } |
29 | 29 | ||
30 | def private selectMatcher(ThreadContext context, String name) { | ||
31 | val x = method.unfinishedWF.filter[ | ||
32 | it.fullyQualifiedName.equals(name) | ||
33 | ].head | ||
34 | if(x!==null) { | ||
35 | x.getMatcher(context.queryEngine) | ||
36 | } else { | ||
37 | return null | ||
38 | } | ||
39 | } | ||
40 | |||
41 | def private numberOfMatches(ViatraQueryMatcher<?> matcher) { | ||
42 | if(matcher!==null) { | ||
43 | matcher.countMatches | ||
44 | } else { | ||
45 | return 0 | ||
46 | } | ||
47 | } | ||
48 | |||
30 | override init(ThreadContext context) { | 49 | override init(ThreadContext context) { |
31 | partialInterpretation = context.model as PartialInterpretation | 50 | partialInterpretation = context.model as PartialInterpretation |
32 | 51 | this.noEntry = context.selectMatcher("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noEntryInRegion") | |
33 | try{ | 52 | this.entryHasNoOutgoing = context.selectMatcher("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noOutgoingTransitionFromEntry") |
34 | this.noEntry = method.unfinishedWF.filter[ | 53 | this.noStateInRegion = context.selectMatcher("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noStateInRegion") |
35 | it.fullyQualifiedName.equals("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noEntryInRegion") | 54 | this.choiceHasNoOutgiong = context.selectMatcher("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_choiceHasNoOutgoing") |
36 | ].head.getMatcher(context.queryEngine) | 55 | this.noSynch = context.selectMatcher("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noSynch") |
37 | 56 | this.synchronizedSiblingRegions = context.selectMatcher("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_SynchronizedRegionDoesNotHaveMultipleRegions") | |
38 | this.entryHasNoOutgoing = method.unfinishedWF.filter[ | 57 | this.synchronizationHasNoOutgoing = context.selectMatcher("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_synchHasNoOutgoing") |
39 | it.fullyQualifiedName.equals("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noOutgoingTransitionFromEntry") | ||
40 | ].head.getMatcher(context.queryEngine) | ||
41 | |||
42 | this.noStateInRegion = method.unfinishedWF.filter[ | ||
43 | it.fullyQualifiedName.equals("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noStateInRegion") | ||
44 | ].head.getMatcher(context.queryEngine) | ||
45 | |||
46 | this.choiceHasNoOutgiong = method.unfinishedWF.filter[ | ||
47 | it.fullyQualifiedName.equals("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_choiceHasNoOutgoing") | ||
48 | ].head.getMatcher(context.queryEngine) | ||
49 | |||
50 | } catch(Exception e) { } | ||
51 | try{ | ||
52 | this.noSynch = method.unfinishedWF.filter[ | ||
53 | it.fullyQualifiedName.equals("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noSynch") | ||
54 | ].head.getMatcher(context.queryEngine) | ||
55 | |||
56 | this.synchronizedSiblingRegions = method.unfinishedWF.filter[ | ||
57 | it.fullyQualifiedName.equals("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_SynchronizedRegionDoesNotHaveMultipleRegions") | ||
58 | ].head.getMatcher(context.queryEngine) | ||
59 | |||
60 | this.synchronizationHasNoOutgoing = method.unfinishedWF.filter[ | ||
61 | it.fullyQualifiedName.equals("unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_synchHasNoOutgoing") | ||
62 | ].head.getMatcher(context.queryEngine) | ||
63 | } catch(Exception e) { } | ||
64 | } | 58 | } |
65 | 59 | ||
66 | override checkGlobalConstraint(ThreadContext context) { | 60 | override checkGlobalConstraint(ThreadContext context) { |
67 | if(noEntry !== null) { | 61 | var requiredNewObjects = |
68 | var requiredNewObjects = noEntry.countMatches*2 +entryHasNoOutgoing.countMatches + noStateInRegion.countMatches | 62 | noEntry.numberOfMatches*2 + |
69 | if(choiceHasNoOutgiong!=null) { | 63 | entryHasNoOutgoing.numberOfMatches + |
70 | requiredNewObjects+=choiceHasNoOutgiong.countMatches | 64 | noStateInRegion.numberOfMatches + |
71 | } | 65 | choiceHasNoOutgiong.numberOfMatches + |
72 | if(synchronizationHasNoOutgoing!= null) { | 66 | noSynch.numberOfMatches*2 + |
73 | requiredNewObjects += | 67 | synchronizationHasNoOutgoing.numberOfMatches + |
74 | noSynch.countMatches*2 + | 68 | synchronizedSiblingRegions.numberOfMatches*4 |
75 | synchronizationHasNoOutgoing.countMatches + | 69 | val availableNewObjects = partialInterpretation.maxNewElements |
76 | synchronizedSiblingRegions.countMatches*4 | 70 | val res = availableNewObjects >= requiredNewObjects |
77 | } | 71 | return res |
78 | |||
79 | val availableNewObjects = partialInterpretation.maxNewElements | ||
80 | val res = availableNewObjects >= requiredNewObjects | ||
81 | //println('''[«availableNewObjects» >= «requiredNewObjects»] = «res»''') | ||
82 | return res | ||
83 | } else { | ||
84 | true | ||
85 | } | ||
86 | |||
87 | } | 72 | } |
88 | override createNew() { | 73 | override createNew() { |
89 | return new SGraphInconsistencyDetector(this.method) | 74 | return new SGraphInconsistencyDetector(this.method) |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend index f0059a85..6b74d161 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend | |||
@@ -26,39 +26,48 @@ class VisualiseAllModelInDirectory { | |||
26 | // val folderName = new File("D:/Data/ICSE18/FAM+WF/Largest-by-Graph-Solver") | 26 | // val folderName = new File("D:/Data/ICSE18/FAM+WF/Largest-by-Graph-Solver") |
27 | // for(subFolderName : folderName.listFiles) { | 27 | // for(subFolderName : folderName.listFiles) { |
28 | // subFolderName.absolutePath.visualiseModel | 28 | // subFolderName.absolutePath.visualiseModel |
29 | // } | 29 | // } |
30 | visualise('''D:\FASE18Meas\OneMinus_Alloy''') | ||
30 | } | 31 | } |
31 | 32 | ||
32 | def static visualiseModel(String folderName) { | 33 | def static void visualise(String path) { |
33 | val file = new File(folderName+"/"+"solution1.partialinterpretation") | 34 | val file = new File(path) |
34 | val hasSource = file.exists | 35 | if(file.isDirectory) { |
35 | 36 | for(subFileName : file.list) { | |
36 | 37 | (path + "/" + subFileName).visualise | |
37 | if(hasSource) { | ||
38 | val hasPng = new File(folderName+"/"+"solution1.png").exists | ||
39 | val hasGml = new File(folderName+"/"+"solution1.gml").exists | ||
40 | |||
41 | val workspace = new FileSystemWorkspace(folderName,"") | ||
42 | val model = workspace.readModel(PartialInterpretation,"solution1.partialinterpretation") | ||
43 | |||
44 | if(!hasGml) { | ||
45 | val partialInterpretation2GML = new PartialInterpretation2Gml | ||
46 | val gmlText = partialInterpretation2GML.transform(model) | ||
47 | workspace.writeText('''solution1.gml''',gmlText) | ||
48 | println('''solution1.gml''') | ||
49 | } | 38 | } |
50 | 39 | } else if(file.isFile) { | |
51 | if(!hasPng && model.newElements.size <160) { | 40 | if(path.endsWith("partialinterpretation")) { |
52 | val visualiser = new GraphvizVisualisation | 41 | visualiseModel(file,path) |
53 | val visualisation = visualiser.visualiseConcretization(model) | ||
54 | visualisation.writeToFile(workspace,"solution1") | ||
55 | println("solution1.png") | ||
56 | println("Need png!") | ||
57 | } | 42 | } |
58 | 43 | } | |
59 | println('''«folderName» visualised''') | 44 | } |
60 | } else { | 45 | |
61 | println('''«folderName» missing''') | 46 | def static visualiseModel(File file, String fileName) { |
47 | val list = file.name.split("\\.") | ||
48 | val fileNameWithoutExtension = list.subList(0,list.length-1).join('.') | ||
49 | val parent = file.parent | ||
50 | |||
51 | val hasPng = new File(parent + "/" + fileNameWithoutExtension+".png").exists | ||
52 | val hasGml = new File(parent + "/" + fileNameWithoutExtension+".gml").exists | ||
53 | |||
54 | val workspace = new FileSystemWorkspace(parent,"") | ||
55 | val model = workspace.readModel(PartialInterpretation,'''«fileNameWithoutExtension».partialinterpretation''') | ||
56 | |||
57 | if(!hasGml) { | ||
58 | val partialInterpretation2GML = new PartialInterpretation2Gml | ||
59 | val gmlText = partialInterpretation2GML.transform(model) | ||
60 | workspace.writeText('''«fileNameWithoutExtension».gml''',gmlText) | ||
61 | println('''«fileNameWithoutExtension».gml''') | ||
62 | } | 62 | } |
63 | |||
64 | if(!hasPng && model.newElements.size <160) { | ||
65 | val visualiser = new GraphvizVisualisation | ||
66 | val visualisation = visualiser.visualiseConcretization(model) | ||
67 | visualisation.writeToFile(workspace,fileNameWithoutExtension) | ||
68 | println('''«fileNameWithoutExtension».png''') | ||
69 | } | ||
70 | |||
71 | println('''«parent»/«fileNameWithoutExtension» visualised''') | ||
63 | } | 72 | } |
64 | } | 73 | } |