diff options
Diffstat (limited to 'Application')
-rw-r--r-- | Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend | 93 |
1 files changed, 49 insertions, 44 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend index 69365add..ad950fc8 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend | |||
@@ -19,16 +19,13 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.Insta | |||
19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | 20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml |
21 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser | 21 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser |
22 | import hu.bme.mit.inf.dslreasoner.workspace.ProjectWorkspace | 22 | import hu.bme.mit.inf.dslreasoner.workspace.URIBasedWorkspace |
23 | import java.io.File | ||
23 | import java.util.LinkedHashMap | 24 | import java.util.LinkedHashMap |
25 | import java.util.LinkedList | ||
24 | import java.util.Optional | 26 | import java.util.Optional |
25 | import java.util.Scanner | ||
26 | import org.eclipse.core.runtime.IProgressMonitor | 27 | import org.eclipse.core.runtime.IProgressMonitor |
27 | import org.eclipse.emf.common.util.URI | 28 | import org.eclipse.emf.common.util.URI |
28 | import hu.bme.mit.inf.dslreasoner.workspace.URIBasedWorkspace | ||
29 | import java.util.LinkedList | ||
30 | import java.io.File | ||
31 | import org.eclipse.ui.console.ConsolePlugin | ||
32 | 29 | ||
33 | class GenerationTaskExecutor { | 30 | class GenerationTaskExecutor { |
34 | val metamodelLoader = new MetamodelLoader | 31 | val metamodelLoader = new MetamodelLoader |
@@ -228,49 +225,57 @@ class GenerationTaskExecutor { | |||
228 | emfRepresentations += outputWorkspaceForRun.getFile(emfFileName) | 225 | emfRepresentations += outputWorkspaceForRun.getFile(emfFileName) |
229 | 226 | ||
230 | val representation = solution.representation.get(interpretationIndex) | 227 | val representation = solution.representation.get(interpretationIndex) |
231 | if(representation instanceof PartialInterpretation) { | 228 | if(documentationLevel.atLeastNormal) { |
232 | val vis1 = new PartialInterpretation2Gml | 229 | if(representation instanceof PartialInterpretation) { |
233 | val gml = vis1.transform(representation) | 230 | val vis1 = new PartialInterpretation2Gml |
234 | val glmFilename = '''«IF runs>1»«run»_«ENDIF»«interpretationIndex+1».gml''' | 231 | val gml = vis1.transform(representation) |
235 | outputWorkspaceForRun.writeText(glmFilename,gml) | 232 | val glmFilename = '''«IF runs>1»«run»_«ENDIF»«interpretationIndex+1».gml''' |
236 | gmlRepresentations += outputWorkspaceForRun.getFile(glmFilename) | 233 | outputWorkspaceForRun.writeText(glmFilename,gml) |
237 | if(representation.newElements.size + representation.problem.elements.size < 150) { | 234 | gmlRepresentations += outputWorkspaceForRun.getFile(glmFilename) |
238 | val vis2 = new GraphvizVisualiser | 235 | if(representation.newElements.size + representation.problem.elements.size < 150) { |
239 | val dot = vis2.visualiseConcretization(representation) | 236 | val vis2 = new GraphvizVisualiser |
240 | val dotFileName = '''«IF runs>1»«run»_«ENDIF»«interpretationIndex+1».png''' | 237 | val dot = vis2.visualiseConcretization(representation) |
241 | dot.writeToFile(outputWorkspaceForRun,dotFileName) | 238 | val dotFileName = '''«IF runs>1»«run»_«ENDIF»«interpretationIndex+1».png''' |
242 | dotRepresentations += outputWorkspaceForRun.getFile(dotFileName) | 239 | dot.writeToFile(outputWorkspaceForRun,dotFileName) |
243 | } | 240 | dotRepresentations += outputWorkspaceForRun.getFile(dotFileName) |
244 | else { | 241 | } |
242 | else { | ||
243 | dotRepresentations += null | ||
244 | } | ||
245 | } else { | ||
246 | gmlRepresentations += null | ||
245 | dotRepresentations += null | 247 | dotRepresentations += null |
246 | } | 248 | } |
247 | } else { | ||
248 | gmlRepresentations += null | ||
249 | dotRepresentations += null | ||
250 | } | 249 | } |
251 | monitor.worked(100) | 250 | monitor.worked(100) |
252 | } | 251 | } |
253 | console.writeMessage( | 252 | if(!emfRepresentations.empty) { |
254 | '''Models: «FOR f : emfRepresentations»#«ENDFOR»''', | 253 | console.writeMessage( |
255 | "#", | 254 | '''Models: «FOR f : emfRepresentations»#«ENDFOR»''', |
256 | emfRepresentations.map[ | 255 | "#", |
257 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) | 256 | emfRepresentations.map[ |
258 | ] | 257 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) |
259 | ) | 258 | ] |
260 | console.writeMessage( | 259 | ) |
261 | '''Visualisations: «FOR f : gmlRepresentations»#«ENDFOR»''', | 260 | } |
262 | "#", | 261 | if(!gmlRepresentations.empty) { |
263 | gmlRepresentations.map[ | 262 | console.writeMessage( |
264 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) | 263 | '''Visualisations: «FOR f : gmlRepresentations»#«ENDFOR»''', |
265 | ] | 264 | "#", |
266 | ) | 265 | gmlRepresentations.map[ |
267 | console.writeMessage( | 266 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) |
268 | '''Visualisations: «FOR f : dotRepresentations»#«ENDFOR»''', | 267 | ] |
269 | "#", | 268 | ) |
270 | dotRepresentations.map[ | 269 | } |
271 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) | 270 | if(!dotRepresentations.empty) { |
272 | ] | 271 | console.writeMessage( |
273 | ) | 272 | '''Visualisations: «FOR f : dotRepresentations»#«ENDFOR»''', |
273 | "#", | ||
274 | dotRepresentations.map[ | ||
275 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) | ||
276 | ] | ||
277 | ) | ||
278 | } | ||
274 | } else { | 279 | } else { |
275 | monitor.worked(solverConfig.solutionScope.numberOfRequiredSolution*100) | 280 | monitor.worked(solverConfig.solutionScope.numberOfRequiredSolution*100) |
276 | } | 281 | } |