diff options
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme')
4 files changed, 72 insertions, 14 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfigurationRuntimeModule.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfigurationRuntimeModule.xtend index 59b2f3f8..f3ba89ad 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfigurationRuntimeModule.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfigurationRuntimeModule.xtend | |||
@@ -15,6 +15,9 @@ import org.eclipse.viatra.query.patternlanguage.emf.scoping.IMetamodelProvider | |||
15 | import org.eclipse.viatra.query.patternlanguage.emf.scoping.IMetamodelProviderInstance | 15 | import org.eclipse.viatra.query.patternlanguage.emf.scoping.IMetamodelProviderInstance |
16 | import org.eclipse.viatra.query.patternlanguage.emf.scoping.MetamodelProviderService | 16 | import org.eclipse.viatra.query.patternlanguage.emf.scoping.MetamodelProviderService |
17 | import org.eclipse.viatra.query.patternlanguage.emf.scoping.ResourceSetMetamodelProviderService | 17 | import org.eclipse.viatra.query.patternlanguage.emf.scoping.ResourceSetMetamodelProviderService |
18 | import org.eclipse.viatra.query.tooling.core.targetplatform.TargetPlatformMetamodelProviderService | ||
19 | import org.eclipse.viatra.query.tooling.core.targetplatform.ITargetPlatformMetamodelLoader | ||
20 | import org.eclipse.viatra.query.tooling.core.targetplatform.TargetPlatformMetamodelsIndex | ||
18 | 21 | ||
19 | /** | 22 | /** |
20 | * Use this class to register components to be used at runtime / without the Equinox extension registry. | 23 | * Use this class to register components to be used at runtime / without the Equinox extension registry. |
@@ -36,8 +39,9 @@ class ApplicationConfigurationRuntimeModule extends AbstractApplicationConfigura | |||
36 | val metamodelProviderBinder = Multibinder.newSetBinder(binder, IMetamodelProviderInstance) | 39 | val metamodelProviderBinder = Multibinder.newSetBinder(binder, IMetamodelProviderInstance) |
37 | metamodelProviderBinder.addBinding.to(MetamodelProviderService) | 40 | metamodelProviderBinder.addBinding.to(MetamodelProviderService) |
38 | metamodelProviderBinder.addBinding.to(ResourceSetMetamodelProviderService) | 41 | metamodelProviderBinder.addBinding.to(ResourceSetMetamodelProviderService) |
42 | metamodelProviderBinder.addBinding.to(TargetPlatformMetamodelProviderService) | ||
39 | } | 43 | } |
40 | 44 | ||
41 | def Class<? extends IGenmodelMappingLoader> bindIGenmodelMappingLoader() { | 45 | def Class<? extends IGenmodelMappingLoader> bindIGenmodelMappingLoader() { |
42 | GenmodelExtensionLoader | 46 | GenmodelExtensionLoader |
43 | } | 47 | } |
@@ -46,6 +50,10 @@ class ApplicationConfigurationRuntimeModule extends AbstractApplicationConfigura | |||
46 | ApplicationConfigurationValueConverterService | 50 | ApplicationConfigurationValueConverterService |
47 | } | 51 | } |
48 | 52 | ||
53 | def Class<? extends ITargetPlatformMetamodelLoader> bindITargetPlatformMetamodelLoader() { | ||
54 | TargetPlatformMetamodelsIndex | ||
55 | } | ||
56 | |||
49 | // override bindIQualifiedNameProvider() { | 57 | // override bindIQualifiedNameProvider() { |
50 | // ApplicationConfigurationQualifiedNameProvider | 58 | // ApplicationConfigurationQualifiedNameProvider |
51 | // } | 59 | // } |
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend index 77c5252a..24f77754 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend | |||
@@ -90,12 +90,16 @@ class ScriptConsole implements Closeable { | |||
90 | } | 90 | } |
91 | 91 | ||
92 | private def prepareFile(URI uri) { | 92 | private def prepareFile(URI uri) { |
93 | val fileString = uri.toFileString | 93 | if (uri === null) { |
94 | val file = new File(fileString) | 94 | return null |
95 | if(this.cleanFiles && file.exists) { | 95 | } else { |
96 | file.delete | 96 | val fileString = uri.toFileString |
97 | val file = new File(fileString) | ||
98 | if (this.cleanFiles && file.exists) { | ||
99 | file.delete | ||
100 | } | ||
101 | return file | ||
97 | } | 102 | } |
98 | return file | ||
99 | } | 103 | } |
100 | 104 | ||
101 | override close() throws IOException { | 105 | override close() throws IOException { |
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 32d44540..c783c9b9 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,6 +1,10 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution | 1 | package hu.bme.mit.inf.dslreasoner.application.execution |
2 | 2 | ||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigReference | ||
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification | ||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript | 5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript |
6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileReference | ||
7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileSpecification | ||
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask | 8 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask |
5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GraphPatternReference | 9 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GraphPatternReference |
6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.MetamodelReference | 10 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.MetamodelReference |
@@ -8,30 +12,65 @@ import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.Metamodel | |||
8 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.PartialModelReference | 12 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.PartialModelReference |
9 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.PartialModelSpecification | 13 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.PartialModelSpecification |
10 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.PatternSpecification | 14 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.PatternSpecification |
11 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.Task | ||
12 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileSpecification | ||
13 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileReference | ||
14 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification | ||
15 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeReference | 15 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeReference |
16 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification | 16 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification |
17 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigReference | 17 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.Task |
18 | import hu.bme.mit.inf.dslreasoner.application.execution.util.ApplicationConfigurationParser | ||
18 | import java.util.LinkedHashMap | 19 | import java.util.LinkedHashMap |
20 | import org.eclipse.emf.common.util.URI | ||
21 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.EPackageImport | ||
19 | 22 | ||
20 | class ScriptExecutor { | 23 | class ScriptExecutor { |
21 | 24 | val parser = new ApplicationConfigurationParser | |
22 | def static void main(String[] args) { | 25 | def static void main(String[] args) { |
23 | println("generator") | 26 | println("generator") |
24 | } | 27 | } |
25 | 28 | ||
29 | /** | ||
30 | * Executes a script | ||
31 | */ | ||
32 | public def executeScript(URI uri) { | ||
33 | val script = parser.parse(uri) | ||
34 | script.executeScript | ||
35 | } | ||
36 | |||
26 | public def executeScript(ConfigurationScript script) { | 37 | public def executeScript(ConfigurationScript script) { |
38 | script.activateAllEPackageReferences | ||
27 | val tasks = script.commands.filter(Task) | 39 | val tasks = script.commands.filter(Task) |
28 | for(task : tasks.filterNull) { | 40 | for(task : tasks.filterNull) { |
29 | task.execute | 41 | task.execute |
30 | } | 42 | } |
31 | } | 43 | } |
32 | 44 | ||
45 | private def activateAllEPackageReferences(ConfigurationScript script) { | ||
46 | val ecoreImports = script.imports.filter(EPackageImport).toMap[it.importedPackage.nsURI] | ||
47 | val packageRegistry = script.eResource.resourceSet.packageRegistry | ||
48 | for(entry : ecoreImports.entrySet) { | ||
49 | println('''«entry.key» -> «entry.value.importedPackage.name»''') | ||
50 | packageRegistry.put(entry.key,entry.value.importedPackage) | ||
51 | } | ||
52 | |||
53 | // val viatraImports = script.imports.filter(ViatraImport) | ||
54 | // for(viatraImport : viatraImports) { | ||
55 | // val PatternModel importedViatra = viatraImport.importedViatra as PatternModel | ||
56 | // val packagesImportedByViatra = importedViatra.importPackages.packageImport | ||
57 | // for(packageImport : packagesImportedByViatra) { | ||
58 | // val originalPackage = packageImport.EPackage | ||
59 | // if(originalPackage.eIsProxy) { | ||
60 | // println('''Proxy: «originalPackage»''') | ||
61 | // } else if(ecoreImports.containsKey(originalPackage.nsURI)) { | ||
62 | // packageImport.EPackage = ecoreImports.get(originalPackage.nsURI).importedPackage | ||
63 | // println('''Redirected: «originalPackage.nsURI» -> «packageImport.EPackage.name»''') | ||
64 | // } else { | ||
65 | // println('''Unreferred: «originalPackage.name»''') | ||
66 | // } | ||
67 | // } | ||
68 | // } | ||
69 | } | ||
70 | |||
33 | def public dispatch execute(GenerationTask task) { | 71 | def public dispatch execute(GenerationTask task) { |
34 | 72 | val generationTaskExecutor = new GenerationTaskExecutor | |
73 | generationTaskExecutor.executeGenerationTask(task,this) | ||
35 | } | 74 | } |
36 | 75 | ||
37 | def public dispatch execute(Task task) { | 76 | def public dispatch execute(Task task) { |
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/util/VQLParser.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/util/VQLParser.xtend index e6d516f4..f85e3dcf 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/util/VQLParser.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/util/VQLParser.xtend | |||
@@ -21,6 +21,9 @@ import org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationB | |||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | 21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification |
22 | import org.eclipse.xtext.resource.XtextResourceSet | 22 | import org.eclipse.xtext.resource.XtextResourceSet |
23 | import hu.bme.mit.inf.dslreasoner.application.execution.ScriptConsole | 23 | import hu.bme.mit.inf.dslreasoner.application.execution.ScriptConsole |
24 | import org.eclipse.viatra.query.patternlanguage.emf.scoping.IMetamodelProvider | ||
25 | import hu.bme.mit.inf.dslreasoner.application.linking.PreloadedMetamodelProvider | ||
26 | import org.eclipse.viatra.query.patternlanguage.emf.scoping.CompoundMetamodelProviderService | ||
24 | 27 | ||
25 | class MyModule extends EMFPatternLanguageRuntimeModule implements Module { | 28 | class MyModule extends EMFPatternLanguageRuntimeModule implements Module { |
26 | def public Class<? extends IAnnotationValidatorLoader> bindAnnotationValidatorLoader() { | 29 | def public Class<? extends IAnnotationValidatorLoader> bindAnnotationValidatorLoader() { |
@@ -29,6 +32,10 @@ class MyModule extends EMFPatternLanguageRuntimeModule implements Module { | |||
29 | def public Class<? extends IGenmodelMappingLoader> bindGenmodelMappingLoader() { | 32 | def public Class<? extends IGenmodelMappingLoader> bindGenmodelMappingLoader() { |
30 | return typeof(GenmodelExtensionLoader); | 33 | return typeof(GenmodelExtensionLoader); |
31 | } | 34 | } |
35 | override Class<? extends IMetamodelProvider> bindIMetamodelProvider() { | ||
36 | CompoundMetamodelProviderService | ||
37 | // PreloadedMetamodelProvider | ||
38 | } | ||
32 | } | 39 | } |
33 | 40 | ||
34 | class VQLParser { | 41 | class VQLParser { |