diff options
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/src/hu')
6 files changed, 35 insertions, 18 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 c3ba9f81..d718bb91 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 | |||
@@ -1,5 +1,6 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution | 1 | package hu.bme.mit.inf.dslreasoner.application.execution |
2 | 2 | ||
3 | import com.google.inject.Injector | ||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript | 4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript |
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask | 5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask |
5 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | 6 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic |
@@ -24,7 +25,9 @@ import java.util.LinkedList | |||
24 | import java.util.Optional | 25 | import java.util.Optional |
25 | import org.eclipse.core.runtime.IProgressMonitor | 26 | import org.eclipse.core.runtime.IProgressMonitor |
26 | import org.eclipse.emf.common.util.URI | 27 | import org.eclipse.emf.common.util.URI |
28 | import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor | ||
27 | 29 | ||
30 | @FinalFieldsConstructor | ||
28 | class GenerationTaskExecutor { | 31 | class GenerationTaskExecutor { |
29 | val metamodelLoader = new MetamodelLoader | 32 | val metamodelLoader = new MetamodelLoader |
30 | val modelLoader = new ModelLoader | 33 | val modelLoader = new ModelLoader |
@@ -32,6 +35,7 @@ class GenerationTaskExecutor { | |||
32 | val solverLoader = new SolverLoader | 35 | val solverLoader = new SolverLoader |
33 | val scopeLoader = new ScopeLoader | 36 | val scopeLoader = new ScopeLoader |
34 | val statisticsUtil = new StatisticSections2CSV | 37 | val statisticsUtil = new StatisticSections2CSV |
38 | val Injector injector | ||
35 | 39 | ||
36 | def executeGenerationTask( | 40 | def executeGenerationTask( |
37 | GenerationTask task, | 41 | GenerationTask task, |
@@ -102,7 +106,7 @@ class GenerationTaskExecutor { | |||
102 | var domain2LogicTransformationTime = System.nanoTime | 106 | var domain2LogicTransformationTime = System.nanoTime |
103 | val Ecore2Logic ecore2Logic = new Ecore2Logic | 107 | val Ecore2Logic ecore2Logic = new Ecore2Logic |
104 | val Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic) | 108 | val Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic) |
105 | val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic) | 109 | val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic, injector) |
106 | val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic | 110 | val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic |
107 | 111 | ||
108 | var modelGeneration = ecore2Logic.transformMetamodel(metamodelDescriptor,new Ecore2LogicConfiguration()) | 112 | var modelGeneration = ecore2Logic.transformMetamodel(metamodelDescriptor,new Ecore2LogicConfiguration()) |
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSSetup.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSSetup.xtend index c209cde5..371f6f8c 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSSetup.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSSetup.xtend | |||
@@ -1,11 +1,7 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution | 1 | package hu.bme.mit.inf.dslreasoner.application.execution |
2 | 2 | ||
3 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetupGenerated | ||
4 | import com.google.inject.Injector | ||
5 | import com.google.inject.Guice | 3 | import com.google.inject.Guice |
6 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageRuntimeModule | 4 | import com.google.inject.Injector |
7 | import com.google.inject.Guice; | ||
8 | import com.google.inject.Injector; | ||
9 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup | 5 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup |
10 | 6 | ||
11 | class PatternLanguageWithRSSetup extends EMFPatternLanguageStandaloneSetup{ | 7 | class PatternLanguageWithRSSetup extends EMFPatternLanguageStandaloneSetup{ |
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend index 3dea677f..9d0985d2 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend | |||
@@ -1,5 +1,7 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution | 1 | package hu.bme.mit.inf.dslreasoner.application.execution |
2 | 2 | ||
3 | import com.google.inject.Inject | ||
4 | import com.google.inject.Injector | ||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigReference | 5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigReference |
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification | 6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification |
5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript | 7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript |
@@ -33,11 +35,19 @@ import org.eclipse.core.runtime.jobs.Job | |||
33 | import org.eclipse.emf.common.util.URI | 35 | import org.eclipse.emf.common.util.URI |
34 | import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor | 36 | import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor |
35 | 37 | ||
36 | @FinalFieldsConstructor | ||
37 | class ScriptExecutor { | 38 | class ScriptExecutor { |
38 | val parser = new ApplicationConfigurationParser | 39 | val parser = new ApplicationConfigurationParser |
39 | 40 | ||
40 | val ScriptConsole.Factory scriptConsoleFactory | 41 | val ScriptConsole.Factory scriptConsoleFactory |
42 | val Injector injector | ||
43 | |||
44 | @FinalFieldsConstructor | ||
45 | new() { | ||
46 | } | ||
47 | |||
48 | new(ScriptConsole.Factory scriptConsoleFactory) { | ||
49 | this(scriptConsoleFactory, null) | ||
50 | } | ||
41 | 51 | ||
42 | /** | 52 | /** |
43 | * Executes a script | 53 | * Executes a script |
@@ -101,7 +111,7 @@ class ScriptExecutor { | |||
101 | } | 111 | } |
102 | 112 | ||
103 | def dispatch void execute(GenerationTask task, IProgressMonitor monitor) { | 113 | def dispatch void execute(GenerationTask task, IProgressMonitor monitor) { |
104 | val generationTaskExecutor = new GenerationTaskExecutor | 114 | val generationTaskExecutor = new GenerationTaskExecutor(injector) |
105 | generationTaskExecutor.executeGenerationTask(task,this,scriptConsoleFactory,monitor) | 115 | generationTaskExecutor.executeGenerationTask(task,this,scriptConsoleFactory,monitor) |
106 | } | 116 | } |
107 | 117 | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend index a549df00..fd50ad51 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend | |||
@@ -28,6 +28,7 @@ import java.util.Optional | |||
28 | import org.eclipse.viatra.query.patternlanguage.emf.vql.PatternModel | 28 | import org.eclipse.viatra.query.patternlanguage.emf.vql.PatternModel |
29 | import org.eclipse.xtext.EcoreUtil2 | 29 | import org.eclipse.xtext.EcoreUtil2 |
30 | import org.eclipse.xtext.xbase.lib.Functions.Function1 | 30 | import org.eclipse.xtext.xbase.lib.Functions.Function1 |
31 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloyBackendSolver | ||
31 | 32 | ||
32 | class SolverLoader { | 33 | class SolverLoader { |
33 | def loadSolver(Solver solver, Map<String, String> config) { | 34 | def loadSolver(Solver solver, Map<String, String> config) { |
@@ -73,9 +74,9 @@ class SolverLoader { | |||
73 | if (!objectiveEntries.empty) { | 74 | if (!objectiveEntries.empty) { |
74 | throw new IllegalArgumentException("Objectives are not supported by Alloy.") | 75 | throw new IllegalArgumentException("Objectives are not supported by Alloy.") |
75 | } | 76 | } |
76 | val c = new SmtSolverConfiguration | 77 | val c = new AlloySolverConfiguration |
77 | config.getAsBoolean("fixRandomSeed", console).ifPresent[c.fixRandomSeed = it] | 78 | config.getAsInteger("symmetry", console).ifPresent[c.symmetry = it] |
78 | config.getAsType("path", console, [it], String).ifPresent[c.solverPath = it] | 79 | config.getAsType("solver",console,[x|AlloyBackendSolver::valueOf(x)],AlloyBackendSolver).ifPresent[c.solver = it] |
79 | c | 80 | c |
80 | } | 81 | } |
81 | case SMT_SOLVER: { | 82 | case SMT_SOLVER: { |
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend index 42be3ed7..23c76758 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend | |||
@@ -12,6 +12,8 @@ import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | |||
12 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup | 12 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup |
13 | import org.eclipse.viatra.query.runtime.rete.matcher.ReteEngine | 13 | import org.eclipse.viatra.query.runtime.rete.matcher.ReteEngine |
14 | import org.eclipse.xtext.resource.XtextResourceSet | 14 | import org.eclipse.xtext.resource.XtextResourceSet |
15 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions | ||
16 | import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory | ||
15 | 17 | ||
16 | class StandaloneScriptExecutor { | 18 | class StandaloneScriptExecutor { |
17 | def static void main(String[] args) { | 19 | def static void main(String[] args) { |
@@ -44,7 +46,10 @@ class StandaloneScriptExecutor { | |||
44 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("xmi",new XMIResourceFactoryImpl) | 46 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("xmi",new XMIResourceFactoryImpl) |
45 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("logicproblem",new XMIResourceFactoryImpl) | 47 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("logicproblem",new XMIResourceFactoryImpl) |
46 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("partialmodel",new XMIResourceFactoryImpl) | 48 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("partialmodel",new XMIResourceFactoryImpl) |
47 | ReteEngine.getClass | 49 | //ReteEngine.getClass |
50 | |||
51 | ViatraQueryEngineOptions.setSystemDefaultBackends(ReteBackendFactory.INSTANCE, ReteBackendFactory.INSTANCE, | ||
52 | ReteBackendFactory.INSTANCE) | ||
48 | 53 | ||
49 | val ext = path.split("\\.").last | 54 | val ext = path.split("\\.").last |
50 | if(ext.equals("vsconfig")) { | 55 | if(ext.equals("vsconfig")) { |
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/linking/ApplicationConfigurationLinkingService.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/linking/ApplicationConfigurationLinkingService.xtend index fafba1d7..c876f3be 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/linking/ApplicationConfigurationLinkingService.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/linking/ApplicationConfigurationLinkingService.xtend | |||
@@ -71,28 +71,29 @@ class ApplicationConfigurationLinkingService extends DefaultLinkingService { | |||
71 | } | 71 | } |
72 | 72 | ||
73 | private def getByUri(EObject context, EReference ref, INode node) { | 73 | private def getByUri(EObject context, EReference ref, INode node) { |
74 | val linkedObjects = super.getLinkedObjects(context, ref, node) | ||
75 | if (!linkedObjects.empty) { | ||
76 | return linkedObjects | ||
77 | } | ||
74 | val uri = getNSUri(node) | 78 | val uri = getNSUri(node) |
75 | if (uri.present) { | 79 | if (uri.present) { |
76 | var URI createdURI | 80 | var URI createdURI |
77 | try { | 81 | try { |
78 | createdURI = URI.createURI(uri.get) | 82 | createdURI = URI.createURI(uri.get) |
79 | } catch (IllegalArgumentException e) { | 83 | } catch (IllegalArgumentException e) { |
80 | return super.getLinkedObjects(context, ref, node) | 84 | return #[] |
81 | } | 85 | } |
82 | var Resource res | 86 | var Resource res |
83 | try { | 87 | try { |
84 | res = context.eResource.resourceSet.getResource(createdURI, true); | 88 | res = context.eResource.resourceSet.getResource(createdURI, true); |
85 | } catch (RuntimeException e) { | 89 | } catch (RuntimeException e) { |
86 | return super.getLinkedObjects(context, ref, node) | 90 | return #[] |
87 | } | 91 | } |
88 | if (res !== null && res.contents !== null) { | 92 | if (res !== null && res.contents !== null) { |
89 | return res.contents.filter[ref.EType.isInstance(it)].toList | 93 | return res.contents.filter[ref.EType.isInstance(it)].toList |
90 | } else { | ||
91 | return super.getLinkedObjects(context, ref, node) | ||
92 | } | 94 | } |
93 | } else { | ||
94 | return super.getLinkedObjects(context, ref, node) | ||
95 | } | 95 | } |
96 | return #[] | ||
96 | } | 97 | } |
97 | 98 | ||
98 | private def getNSUri(INode node) { | 99 | private def getNSUri(INode node) { |