diff options
Diffstat (limited to 'Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire')
4 files changed, 30 insertions, 73 deletions
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/EcoreTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/EcoreTest.xtend index 18b3badd..35b76350 100644 --- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/EcoreTest.xtend +++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/EcoreTest.xtend | |||
@@ -1,11 +1,10 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.vampire.icse | 1 | package ca.mcgill.ecse.dslreasoner.vampire.icse |
2 | 2 | ||
3 | import ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.filesystemPackage | ||
3 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver | 4 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver |
4 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration | 5 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration |
5 | import functionalarchitecture.FunctionalarchitecturePackage | ||
6 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | 6 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic |
7 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration | 7 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration |
8 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor | ||
9 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel | 8 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel |
10 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner | 9 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner |
11 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult | 10 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult |
@@ -13,91 +12,48 @@ import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore | |||
13 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic | 12 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic |
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic | 13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic |
15 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | 14 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace |
16 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace | ||
17 | import java.util.List | ||
18 | import org.eclipse.emf.ecore.EAttribute | ||
19 | import org.eclipse.emf.ecore.EClass | ||
20 | import org.eclipse.emf.ecore.EEnum | ||
21 | import org.eclipse.emf.ecore.EEnumLiteral | ||
22 | import org.eclipse.emf.ecore.EObject | ||
23 | import org.eclipse.emf.ecore.EReference | ||
24 | import org.eclipse.emf.ecore.resource.Resource | ||
25 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | ||
26 | 15 | ||
27 | class EcoreTest { | 16 | class EcoreTest { |
28 | def static void main(String[] args) { | 17 | def static void main(String[] args) { |
29 | val inputs = new FileSystemWorkspace('''initialModels/''', "") | 18 | val inputs = new FileSystemWorkspace('''initialModels/''', "") |
30 | val workspace = new FileSystemWorkspace('''output/FAMTest/''', "") | 19 | val workspace = new FileSystemWorkspace('''output/FEcoreTest/''', "") |
31 | workspace.initAndClear | 20 | workspace.initAndClear |
32 | 21 | ||
33 | println("Input and output workspaces are created") | 22 | println("Input and output workspaces are created") |
34 | 23 | ||
35 | val metamodel = loadMetamodel() | 24 | val metamodel = GeneralTest.loadMetamodel(filesystemPackage.eINSTANCE) |
36 | val partialModel = loadPartialModel(inputs) | 25 | val partialModel = GeneralTest.loadPartialModel(inputs, "fs/filesystemInstance.xmi") |
37 | // val queries = loadQueries(metamodel) | 26 | // val queries = GeneralTest.loadQueries(metamodel, ecorePatterns.instance) |
27 | val queries = null | ||
38 | 28 | ||
39 | println("DSL loaded") | 29 | println("DSL loaded") |
40 | 30 | ||
41 | val Ecore2Logic ecore2Logic = new Ecore2Logic | 31 | val Ecore2Logic ecore2Logic = new Ecore2Logic |
42 | val Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic) | 32 | val Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic) |
43 | val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic) | 33 | val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic) |
44 | val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic | 34 | val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic |
45 | 35 | ||
46 | val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel,new Ecore2LogicConfiguration()) | 36 | val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, new Ecore2LogicConfiguration()) |
47 | val modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem,partialModel) | 37 | val modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem, partialModel) |
48 | // val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelGenerationProblem,new Viatra2LogicConfiguration) | 38 | // val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelGenerationProblem,new Viatra2LogicConfiguration) |
49 | |||
50 | val logicProblem = modelGenerationProblem.output | 39 | val logicProblem = modelGenerationProblem.output |
51 | // val logicProblem = modelExtensionProblem.output | 40 | // val logicProblem = modelExtensionProblem.output |
52 | // val logicProblem = validModelExtensionProblem.output | 41 | // val logicProblem = validModelExtensionProblem.output |
53 | |||
54 | |||
55 | println("Problem created") | 42 | println("Problem created") |
56 | 43 | ||
57 | var LogicResult solution | 44 | var LogicResult solution |
58 | var LogicReasoner reasoner | 45 | var LogicReasoner reasoner |
59 | //* | 46 | // * |
60 | reasoner = new VampireSolver | 47 | reasoner = new VampireSolver |
61 | val vampireConfig = new VampireSolverConfiguration => [ | 48 | val vampireConfig = new VampireSolverConfiguration => [ |
62 | //add configuration things, in config file first | 49 | // add configuration things, in config file first |
63 | it.documentationLevel = DocumentationLevel::FULL | 50 | it.documentationLevel = DocumentationLevel::FULL |
64 | ] | 51 | ] |
65 | |||
66 | solution = reasoner.solve(logicProblem, vampireConfig, workspace) | ||
67 | |||
68 | println("Problem solved") | ||
69 | |||
70 | |||
71 | } | ||
72 | 52 | ||
73 | def private static loadMetamodel() { | 53 | solution = reasoner.solve(logicProblem, vampireConfig, workspace) |
74 | val pckg = FunctionalarchitecturePackage.eINSTANCE | ||
75 | val List<EClass> classes = pckg.getEClassifiers.filter(EClass).toList | ||
76 | val List<EEnum> enums = pckg.getEClassifiers.filter(EEnum).toList | ||
77 | val List<EEnumLiteral> literals = enums.map[getELiterals].flatten.toList | ||
78 | val List<EReference> references = classes.map[getEReferences].flatten.toList | ||
79 | val List<EAttribute> attributes = classes.map[getEAttributes].flatten.toList | ||
80 | return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) | ||
81 | } | ||
82 | 54 | ||
83 | def private static loadPartialModel(ReasonerWorkspace inputs) { | 55 | println("Problem solved") |
84 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); | ||
85 | // inputs.readModel(EObject,"FunctionalArchitectureModel.xmi").eResource.allContents.toList | ||
86 | inputs.readModel(EObject,"FamInstance.xmi").eResource.allContents.toList | ||
87 | } | ||
88 | 56 | ||
89 | def private static loadQueries(EcoreMetamodelDescriptor metamodel) { | ||
90 | // val i = Patterns.instance | ||
91 | // val patterns = i.specifications.toList | ||
92 | // val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet | ||
93 | // val derivedFeatures = new LinkedHashMap | ||
94 | // derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) | ||
95 | // derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) | ||
96 | // val res = new ViatraQuerySetDescriptor( | ||
97 | // patterns, | ||
98 | // wfPatterns, | ||
99 | // derivedFeatures | ||
100 | // ) | ||
101 | // return res | ||
102 | } | 57 | } |
58 | |||
103 | } | 59 | } |
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend index f66ad93c..3fc3d70f 100644 --- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend +++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend | |||
@@ -1,6 +1,5 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.vampire.icse | 1 | package ca.mcgill.ecse.dslreasoner.vampire.icse |
2 | 2 | ||
3 | import ca.mcgill.ecse.dslreasoner.vampire.queries.FamPatterns | ||
4 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver | 3 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver |
5 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration | 4 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration |
6 | import functionalarchitecture.Function | 5 | import functionalarchitecture.Function |
@@ -39,14 +38,15 @@ class FAMTest { | |||
39 | 38 | ||
40 | // Load DSL | 39 | // Load DSL |
41 | val metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE) | 40 | val metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE) |
42 | val partialModel = GeneralTest.loadPartialModel(inputs, "FaModel.xmi") | 41 | val partialModel = GeneralTest.loadPartialModel(inputs, "FAM/FaModel.xmi") |
43 | val queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance) | 42 | // val queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance) |
43 | val queries = null | ||
44 | 44 | ||
45 | println("DSL loaded") | 45 | println("DSL loaded") |
46 | 46 | ||
47 | val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, new Ecore2LogicConfiguration()) | 47 | val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, new Ecore2LogicConfiguration()) |
48 | var problem = modelGenerationProblem.output | 48 | var problem = modelGenerationProblem.output |
49 | // problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output | 49 | problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output |
50 | // problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output | 50 | // problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output |
51 | workspace.writeModel(problem, "Fam.logicproblem") | 51 | workspace.writeModel(problem, "Fam.logicproblem") |
52 | 52 | ||
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend index 50639577..d4cbb299 100644 --- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend +++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend | |||
@@ -1,7 +1,7 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.vampire.icse | 1 | package ca.mcgill.ecse.dslreasoner.vampire.icse |
2 | 2 | ||
3 | import ca.mcgill.ecse.dslreasoner.vampire.queries | ||
4 | import ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.filesystemPackage | 3 | import ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.filesystemPackage |
4 | import ca.mcgill.ecse.dslreasoner.vampire.queries.FileSystemPatterns | ||
5 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver | 5 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver |
6 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration | 6 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration |
7 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | 7 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic |
@@ -24,7 +24,7 @@ class FileSystemTest { | |||
24 | 24 | ||
25 | // Workspace setup | 25 | // Workspace setup |
26 | val inputs = new FileSystemWorkspace('''initialModels/''', "") | 26 | val inputs = new FileSystemWorkspace('''initialModels/''', "") |
27 | val workspace = new FileSystemWorkspace('''output/FAMTest/''', "") | 27 | val workspace = new FileSystemWorkspace('''output/FileSystemTest/''', "") |
28 | workspace.initAndClear | 28 | workspace.initAndClear |
29 | 29 | ||
30 | // Logicproblem writing setup | 30 | // Logicproblem writing setup |
@@ -34,9 +34,10 @@ class FileSystemTest { | |||
34 | 34 | ||
35 | println("Input and output workspaces are created") | 35 | println("Input and output workspaces are created") |
36 | 36 | ||
37 | |||
37 | val metamodel = GeneralTest.loadMetamodel(filesystemPackage.eINSTANCE) | 38 | val metamodel = GeneralTest.loadMetamodel(filesystemPackage.eINSTANCE) |
38 | val partialModel = GeneralTest.loadPartialModel(inputs, "fs/filesystemInstance.xmi") | 39 | val partialModel = GeneralTest.loadPartialModel(inputs, "fs/filesystemInstance.xmi") |
39 | //val queries = GeneralTest.loadQueries(metamodel, FileSystemPatterns.instance) | 40 | val queries = GeneralTest.loadQueries(metamodel, FileSystemPatterns.instance) |
40 | 41 | ||
41 | println("DSL loaded") | 42 | println("DSL loaded") |
42 | 43 | ||
@@ -44,7 +45,7 @@ class FileSystemTest { | |||
44 | var problem = modelGenerationProblem.output | 45 | var problem = modelGenerationProblem.output |
45 | // problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output | 46 | // problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output |
46 | // problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output | 47 | // problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output |
47 | workspace.writeModel(problem, "Fam.logicproblem") | 48 | workspace.writeModel(problem, "FileSystem.logicproblem") |
48 | 49 | ||
49 | println("Problem created") | 50 | println("Problem created") |
50 | 51 | ||
@@ -75,8 +76,8 @@ class FileSystemTest { | |||
75 | // add configuration things, in config file first | 76 | // add configuration things, in config file first |
76 | it.documentationLevel = DocumentationLevel::FULL | 77 | it.documentationLevel = DocumentationLevel::FULL |
77 | 78 | ||
78 | it.typeScopes.minNewElements = 4 | 79 | it.typeScopes.minNewElements = 40 |
79 | it.typeScopes.maxNewElements = 5 | 80 | it.typeScopes.maxNewElements = 59 |
80 | if(typeMapMin.size != 0) it.typeScopes.minNewElementsByType = typeMapMin | 81 | if(typeMapMin.size != 0) it.typeScopes.minNewElementsByType = typeMapMin |
81 | if(typeMapMin.size != 0) it.typeScopes.maxNewElementsByType = typeMapMax | 82 | if(typeMapMin.size != 0) it.typeScopes.maxNewElementsByType = typeMapMax |
82 | it.contCycleLevel = 5 | 83 | it.contCycleLevel = 5 |
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend index 1fac968b..f0d88b49 100644 --- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend +++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend | |||
@@ -35,7 +35,7 @@ class YakinduTest { | |||
35 | 35 | ||
36 | val metamodel = GeneralTest.loadMetamodel(yakinduPackage.eINSTANCE) | 36 | val metamodel = GeneralTest.loadMetamodel(yakinduPackage.eINSTANCE) |
37 | val partialModel = GeneralTest.loadPartialModel(inputs, "yakindu/yakinduinstance.xmi") | 37 | val partialModel = GeneralTest.loadPartialModel(inputs, "yakindu/yakinduinstance.xmi") |
38 | // val queries = GeneralTest.loadQueries(metamodel, FamPa | 38 | // val queries = GeneralTest.loadQueries(metamodel, yakinduPatterns.instance) |
39 | val queries = null | 39 | val queries = null |
40 | 40 | ||
41 | println("DSL loaded") | 41 | println("DSL loaded") |
@@ -75,8 +75,8 @@ class YakinduTest { | |||
75 | // add configuration things, in config file first | 75 | // add configuration things, in config file first |
76 | it.documentationLevel = DocumentationLevel::FULL | 76 | it.documentationLevel = DocumentationLevel::FULL |
77 | 77 | ||
78 | it.typeScopes.minNewElements = 20 | 78 | it.typeScopes.minNewElements = 53 |
79 | it.typeScopes.maxNewElements = 30 | 79 | it.typeScopes.maxNewElements = 53 |
80 | if(typeMapMin.size != 0) it.typeScopes.minNewElementsByType = typeMapMin | 80 | if(typeMapMin.size != 0) it.typeScopes.minNewElementsByType = typeMapMin |
81 | if(typeMapMin.size != 0) it.typeScopes.maxNewElementsByType = typeMapMax | 81 | if(typeMapMin.size != 0) it.typeScopes.maxNewElementsByType = typeMapMax |
82 | it.contCycleLevel = 5 | 82 | it.contCycleLevel = 5 |