diff options
author | 2018-03-24 22:16:37 -0400 | |
---|---|---|
committer | 2018-03-24 22:16:37 -0400 | |
commit | 4236f6735c91e8db3e4eb5641f5625f83024f434 (patch) | |
tree | 4daa916edd6d7f2e6d8908fe6582d166770193de /Application/hu.bme.mit.inf.dslreasoner.application | |
parent | example projects added (diff) | |
download | VIATRA-Generator-4236f6735c91e8db3e4eb5641f5625f83024f434.tar.gz VIATRA-Generator-4236f6735c91e8db3e4eb5641f5625f83024f434.tar.zst VIATRA-Generator-4236f6735c91e8db3e4eb5641f5625f83024f434.zip |
Removed unused projects
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application')
11 files changed, 0 insertions, 527 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/Context.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/Context.xtend deleted file mode 100644 index c00c0d31..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/Context.xtend +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution | ||
2 | |||
3 | import org.eclipse.xtend.lib.annotations.Accessors | ||
4 | |||
5 | class Context { | ||
6 | @Accessors(PUBLIC_GETTER,PUBLIC_SETTER) | ||
7 | var boolean printToConsole = true | ||
8 | |||
9 | def writeError(Object object) { | ||
10 | if(printToConsole) { | ||
11 | println(object) | ||
12 | } | ||
13 | } | ||
14 | } \ No newline at end of file | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ExecuteScript.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ExecuteScript.xtend deleted file mode 100644 index 403d00d8..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ExecuteScript.xtend +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution | ||
2 | |||
3 | import org.apache.log4j.Logger | ||
4 | import org.apache.log4j.LogManager | ||
5 | import org.apache.log4j.Level | ||
6 | import java.io.PrintStream | ||
7 | import java.io.OutputStream | ||
8 | import java.io.BufferedWriter | ||
9 | import java.io.Writer | ||
10 | |||
11 | class ExecuteScript { | ||
12 | def static void main(String[] args) { | ||
13 | val Logger logger = LogManager.getLogger(ExecuteScript); | ||
14 | logger.level = Level::DEBUG | ||
15 | |||
16 | println() | ||
17 | System.out.println("asd") | ||
18 | |||
19 | logger.debug("debug") | ||
20 | logger.info("info") | ||
21 | logger.warn("warning") | ||
22 | logger.error("error") | ||
23 | logger.fatal("fatal") | ||
24 | } | ||
25 | } \ No newline at end of file | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/Executor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/Executor.xtend deleted file mode 100644 index 4d887423..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/Executor.xtend +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript | ||
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.Task | ||
5 | import java.util.HashMap | ||
6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask | ||
7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.Metamodel | ||
8 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | ||
9 | import java.util.List | ||
10 | import org.eclipse.emf.ecore.EClass | ||
11 | import org.eclipse.emf.ecore.EEnumLiteral | ||
12 | import org.eclipse.emf.ecore.EReference | ||
13 | import org.eclipse.emf.ecore.EEnum | ||
14 | import org.eclipse.emf.ecore.EAttribute | ||
15 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor | ||
16 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace | ||
17 | import org.eclipse.emf.ecore.EObject | ||
18 | import java.util.LinkedHashMap | ||
19 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor | ||
20 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | ||
21 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic | ||
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic | ||
23 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration | ||
24 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration | ||
25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration | ||
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod | ||
27 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy | ||
28 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner | ||
29 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult | ||
30 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | ||
31 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult | ||
32 | import org.eclipse.emf.ecore.resource.Resource | ||
33 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | ||
34 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | ||
35 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration | ||
36 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolver | ||
37 | import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore | ||
38 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner | ||
39 | import java.util.LinkedList | ||
40 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | ||
41 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicStructureBuilder | ||
42 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder | ||
43 | import org.eclipse.emf.ecore.util.EcoreUtil | ||
44 | import org.eclipse.xtext.EcoreUtil2 | ||
45 | import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl | ||
46 | import org.eclipse.emf.ecore.resource.ResourceSet | ||
47 | import org.eclipse.emf.common.util.URI | ||
48 | import org.eclipse.emf.ecore.EPackage | ||
49 | |||
50 | class Executor { | ||
51 | public def void execute(ConfigurationScript configurationScript) { | ||
52 | val tasks = configurationScript.commands.filter(Task) | ||
53 | val numberOfModels = tasks.map[it.calculateTaskSteps].reduce[p1, p2|p1+p2] | ||
54 | } | ||
55 | |||
56 | def private dispatch calculateTaskSteps(Task task) { | ||
57 | throw new UnsupportedOperationException() | ||
58 | } | ||
59 | def private dispatch calculateTaskSteps(GenerationTask task) { | ||
60 | return task.number * task.runs | ||
61 | } | ||
62 | |||
63 | def private dispatch executeTask(Task task) { | ||
64 | throw new UnsupportedOperationException() | ||
65 | } | ||
66 | def private dispatch executeTask(GenerationTask generationTask) { | ||
67 | val metamodel = generationTask.metamodel | ||
68 | if(metamodel != null) { | ||
69 | |||
70 | } | ||
71 | } | ||
72 | |||
73 | def protected loadPackage(ResourceSet rs, String path) { | ||
74 | var EObject content = null | ||
75 | |||
76 | try { | ||
77 | val resource = rs.getResource(URI.createURI(path),true) | ||
78 | content = resource.contents.get(0) | ||
79 | } catch(IllegalArgumentException e) { | ||
80 | return null | ||
81 | } catch(RuntimeException e) { | ||
82 | return null | ||
83 | } | ||
84 | |||
85 | if(content instanceof EPackage) { | ||
86 | |||
87 | } else return null | ||
88 | } | ||
89 | |||
90 | def loadPatternModel(ResourceSet rs, String path) { | ||
91 | var model = null | ||
92 | |||
93 | |||
94 | } | ||
95 | } | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/validation/MetamodelValidator.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/validation/MetamodelValidator.xtend deleted file mode 100644 index aae47c83..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/validation/MetamodelValidator.xtend +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution.validation | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor | ||
4 | import java.util.LinkedList | ||
5 | import java.util.List | ||
6 | import org.eclipse.emf.ecore.EAttribute | ||
7 | import org.eclipse.emf.ecore.EClass | ||
8 | import org.eclipse.emf.ecore.EDataType | ||
9 | import org.eclipse.emf.ecore.EEnum | ||
10 | import org.eclipse.emf.ecore.EEnumLiteral | ||
11 | import org.eclipse.emf.ecore.EReference | ||
12 | import org.eclipse.emf.ecore.EcorePackage | ||
13 | |||
14 | class MetamodelValidator { | ||
15 | def validateMetamodel(EcoreMetamodelDescriptor descriptor) { | ||
16 | val errors = new LinkedList | ||
17 | this.allSupertypesAreIncluded(descriptor.classes,errors) | ||
18 | this.allEnumTypesareIncluded(descriptor.enums,descriptor.literals,errors) | ||
19 | this.referenceEndpointsAreIncluded(descriptor.classes,descriptor.references,errors) | ||
20 | this.attributeSourcePontIsIncluded(descriptor.classes,descriptor.attributes,errors) | ||
21 | this.attributeTargetIsSupported(descriptor.attributes,errors) | ||
22 | return errors | ||
23 | } | ||
24 | |||
25 | |||
26 | private def supportedEDataType(EDataType dataType) { | ||
27 | val extension l = EcorePackage.eINSTANCE | ||
28 | return #[EInt, EBoolean, EString, EDouble, EFloat].contains(dataType) | ||
29 | } | ||
30 | |||
31 | def allSupertypesAreIncluded(List<EClass> classes, List<String> errors) { | ||
32 | for(c : classes) { | ||
33 | for(s : c.ESuperTypes) { | ||
34 | if(!classes.contains(s)) { | ||
35 | errors.add('''Metamodel contains "«c.name»" but not contains its supertype "«s.name»"!''') | ||
36 | } | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | def allEnumTypesareIncluded(List<EEnum> enums, List<EEnumLiteral> literals, List<String> errors) { | ||
41 | for(l: literals) { | ||
42 | if(!enums.contains(l.EEnum)) { | ||
43 | errors.add('''Metamodel contains literal "«l.name»" but does not contains enum "«l.EEnum.name»"!''') | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | def referenceEndpointsAreIncluded(List<EClass> classes, List<EReference> references, List<String> errors) { | ||
48 | for(reference : references) { | ||
49 | val src = reference.EContainingClass | ||
50 | if(!classes.contains(src)) { | ||
51 | errors.add('''Metamodel contains reference "«reference.name»" but does not contains its source type "«src.name»"!''') | ||
52 | } | ||
53 | |||
54 | val trg = reference.EReferenceType | ||
55 | if(!classes.contains(trg)) { | ||
56 | errors.add('''Metamodel contains reference "«reference.name»" but does not contains its target type "«trg.name»"!''') | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | def attributeSourcePontIsIncluded(List<EClass> classes, List<EAttribute> attributes, List<String> errors) { | ||
61 | for(attribute : attributes) { | ||
62 | val src = attribute.containerClass | ||
63 | if(!classes.contains(src)) { | ||
64 | errors.add('''Metamodel contains attribute "«attribute.name»" but does not contains its source type "«src.name»"!''') | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | def attributeTargetIsSupported(List<EAttribute> attributes, List<String> errors) { | ||
69 | for(attribute: attributes) { | ||
70 | val trg = attribute.EAttributeType | ||
71 | if(!supportedEDataType(trg)) { | ||
72 | errors.add('''Metamodels contains attribute "«attribute.name»" with unsupported type "«trg.name»"!''') | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | } \ No newline at end of file | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/validation/QueryAndMetamodelValidator.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/validation/QueryAndMetamodelValidator.xtend deleted file mode 100644 index e1a20ffd..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/validation/QueryAndMetamodelValidator.xtend +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution.validation | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor | ||
4 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor | ||
5 | import java.util.List | ||
6 | import java.util.Set | ||
7 | import org.eclipse.emf.ecore.ENamedElement | ||
8 | import org.eclipse.viatra.query.patternlanguage.patternLanguage.Pattern | ||
9 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | ||
10 | import java.util.LinkedList | ||
11 | |||
12 | class QueryAndMetamodelValidator { | ||
13 | |||
14 | def public validateQueryAndMetamodel( | ||
15 | EcoreMetamodelDescriptor metamodel, | ||
16 | Pair<ViatraQuerySetDescriptor, Set<Pattern>> viatra) | ||
17 | { | ||
18 | val patterns = viatra.value | ||
19 | val elementsInMetamodel = | ||
20 | (metamodel.classes + | ||
21 | metamodel.enums + | ||
22 | metamodel.literals+ | ||
23 | metamodel.attributes + | ||
24 | metamodel.references) | ||
25 | .toSet | ||
26 | val errors = new LinkedList | ||
27 | for(pattern : patterns) { | ||
28 | val elements = getReferredNamedElements(pattern) | ||
29 | for(element : elements) { | ||
30 | if(!elementsInMetamodel.contains(element)) { | ||
31 | errors+='''Pattern "«pattern.name»" refers to an element "«element»" that is not included to the selected metamodel!''' | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | return errors | ||
36 | } | ||
37 | |||
38 | def getReferredNamedElements(Pattern pattern) { | ||
39 | val elements = pattern.eAllContents.toList | ||
40 | return elements.map[element| | ||
41 | val references = element.eClass.EAllReferences | ||
42 | return references.map[r | | ||
43 | if(r.isMany) { | ||
44 | return (element.eGet(r) as List<?>).filter(ENamedElement) | ||
45 | } else { | ||
46 | val value = element.eGet(r) | ||
47 | if(value instanceof ENamedElement) return #[value] | ||
48 | else return #[] | ||
49 | } | ||
50 | ].flatten.filter(ENamedElement) | ||
51 | ].flatten | ||
52 | } | ||
53 | } \ No newline at end of file | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.MetamodelValidator.xtendbin b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.MetamodelValidator.xtendbin deleted file mode 100644 index 4b5f1417..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.MetamodelValidator.xtendbin +++ /dev/null | |||
Binary files differ | |||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.QueryAndMetamodelValidator.xtendbin b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.QueryAndMetamodelValidator.xtendbin deleted file mode 100644 index 3816ffb2..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.QueryAndMetamodelValidator.xtendbin +++ /dev/null | |||
Binary files differ | |||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.gitignore b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.gitignore deleted file mode 100644 index 48aea421..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/.gitignore +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | /.MetamodelValidator.java._trace | ||
2 | /.QueryAndMetamodelValidator.java._trace | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/MetamodelValidator.java b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/MetamodelValidator.java deleted file mode 100644 index 1e21f6ab..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/MetamodelValidator.java +++ /dev/null | |||
@@ -1,167 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution.validation; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | ||
4 | import java.util.Collections; | ||
5 | import java.util.LinkedList; | ||
6 | import java.util.List; | ||
7 | import org.eclipse.emf.common.util.EList; | ||
8 | import org.eclipse.emf.ecore.EAttribute; | ||
9 | import org.eclipse.emf.ecore.EClass; | ||
10 | import org.eclipse.emf.ecore.EDataType; | ||
11 | import org.eclipse.emf.ecore.EEnum; | ||
12 | import org.eclipse.emf.ecore.EEnumLiteral; | ||
13 | import org.eclipse.emf.ecore.EReference; | ||
14 | import org.eclipse.emf.ecore.EcorePackage; | ||
15 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
16 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
17 | import org.eclipse.xtext.xbase.lib.Extension; | ||
18 | |||
19 | @SuppressWarnings("all") | ||
20 | public class MetamodelValidator { | ||
21 | public LinkedList<String> validateMetamodel(final EcoreMetamodelDescriptor descriptor) { | ||
22 | final LinkedList<String> errors = new LinkedList<String>(); | ||
23 | List<EClass> _classes = descriptor.getClasses(); | ||
24 | this.allSupertypesAreIncluded(_classes, errors); | ||
25 | List<EEnum> _enums = descriptor.getEnums(); | ||
26 | List<EEnumLiteral> _literals = descriptor.getLiterals(); | ||
27 | this.allEnumTypesareIncluded(_enums, _literals, errors); | ||
28 | List<EClass> _classes_1 = descriptor.getClasses(); | ||
29 | List<EReference> _references = descriptor.getReferences(); | ||
30 | this.referenceEndpointsAreIncluded(_classes_1, _references, errors); | ||
31 | List<EClass> _classes_2 = descriptor.getClasses(); | ||
32 | List<EAttribute> _attributes = descriptor.getAttributes(); | ||
33 | this.attributeSourcePontIsIncluded(_classes_2, _attributes, errors); | ||
34 | List<EAttribute> _attributes_1 = descriptor.getAttributes(); | ||
35 | this.attributeTargetIsSupported(_attributes_1, errors); | ||
36 | return errors; | ||
37 | } | ||
38 | |||
39 | private boolean supportedEDataType(final EDataType dataType) { | ||
40 | @Extension | ||
41 | final EcorePackage l = EcorePackage.eINSTANCE; | ||
42 | EDataType _eInt = l.getEInt(); | ||
43 | EDataType _eBoolean = l.getEBoolean(); | ||
44 | EDataType _eString = l.getEString(); | ||
45 | EDataType _eDouble = l.getEDouble(); | ||
46 | EDataType _eFloat = l.getEFloat(); | ||
47 | return Collections.<EDataType>unmodifiableList(CollectionLiterals.<EDataType>newArrayList(_eInt, _eBoolean, _eString, _eDouble, _eFloat)).contains(dataType); | ||
48 | } | ||
49 | |||
50 | public void allSupertypesAreIncluded(final List<EClass> classes, final List<String> errors) { | ||
51 | for (final EClass c : classes) { | ||
52 | EList<EClass> _eSuperTypes = c.getESuperTypes(); | ||
53 | for (final EClass s : _eSuperTypes) { | ||
54 | boolean _contains = classes.contains(s); | ||
55 | boolean _not = (!_contains); | ||
56 | if (_not) { | ||
57 | StringConcatenation _builder = new StringConcatenation(); | ||
58 | _builder.append("Metamodel contains \""); | ||
59 | String _name = c.getName(); | ||
60 | _builder.append(_name, ""); | ||
61 | _builder.append("\" but not contains its supertype \""); | ||
62 | String _name_1 = s.getName(); | ||
63 | _builder.append(_name_1, ""); | ||
64 | _builder.append("\"!"); | ||
65 | errors.add(_builder.toString()); | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | |||
71 | public void allEnumTypesareIncluded(final List<EEnum> enums, final List<EEnumLiteral> literals, final List<String> errors) { | ||
72 | for (final EEnumLiteral l : literals) { | ||
73 | EEnum _eEnum = l.getEEnum(); | ||
74 | boolean _contains = enums.contains(_eEnum); | ||
75 | boolean _not = (!_contains); | ||
76 | if (_not) { | ||
77 | StringConcatenation _builder = new StringConcatenation(); | ||
78 | _builder.append("Metamodel contains literal \""); | ||
79 | String _name = l.getName(); | ||
80 | _builder.append(_name, ""); | ||
81 | _builder.append("\" but does not contains enum \""); | ||
82 | EEnum _eEnum_1 = l.getEEnum(); | ||
83 | String _name_1 = _eEnum_1.getName(); | ||
84 | _builder.append(_name_1, ""); | ||
85 | _builder.append("\"!"); | ||
86 | errors.add(_builder.toString()); | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | public void referenceEndpointsAreIncluded(final List<EClass> classes, final List<EReference> references, final List<String> errors) { | ||
92 | for (final EReference reference : references) { | ||
93 | { | ||
94 | final EClass src = reference.getEContainingClass(); | ||
95 | boolean _contains = classes.contains(src); | ||
96 | boolean _not = (!_contains); | ||
97 | if (_not) { | ||
98 | StringConcatenation _builder = new StringConcatenation(); | ||
99 | _builder.append("Metamodel contains reference \""); | ||
100 | String _name = reference.getName(); | ||
101 | _builder.append(_name, ""); | ||
102 | _builder.append("\" but does not contains its source type \""); | ||
103 | String _name_1 = src.getName(); | ||
104 | _builder.append(_name_1, ""); | ||
105 | _builder.append("\"!"); | ||
106 | errors.add(_builder.toString()); | ||
107 | } | ||
108 | final EClass trg = reference.getEReferenceType(); | ||
109 | boolean _contains_1 = classes.contains(trg); | ||
110 | boolean _not_1 = (!_contains_1); | ||
111 | if (_not_1) { | ||
112 | StringConcatenation _builder_1 = new StringConcatenation(); | ||
113 | _builder_1.append("Metamodel contains reference \""); | ||
114 | String _name_2 = reference.getName(); | ||
115 | _builder_1.append(_name_2, ""); | ||
116 | _builder_1.append("\" but does not contains its target type \""); | ||
117 | String _name_3 = trg.getName(); | ||
118 | _builder_1.append(_name_3, ""); | ||
119 | _builder_1.append("\"!"); | ||
120 | errors.add(_builder_1.toString()); | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | public void attributeSourcePontIsIncluded(final List<EClass> classes, final List<EAttribute> attributes, final List<String> errors) { | ||
127 | for (final EAttribute attribute : attributes) { | ||
128 | { | ||
129 | final Class<?> src = attribute.getContainerClass(); | ||
130 | boolean _contains = classes.contains(src); | ||
131 | boolean _not = (!_contains); | ||
132 | if (_not) { | ||
133 | StringConcatenation _builder = new StringConcatenation(); | ||
134 | _builder.append("Metamodel contains attribute \""); | ||
135 | String _name = attribute.getName(); | ||
136 | _builder.append(_name, ""); | ||
137 | _builder.append("\" but does not contains its source type \""); | ||
138 | String _name_1 = src.getName(); | ||
139 | _builder.append(_name_1, ""); | ||
140 | _builder.append("\"!"); | ||
141 | errors.add(_builder.toString()); | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | } | ||
146 | |||
147 | public void attributeTargetIsSupported(final List<EAttribute> attributes, final List<String> errors) { | ||
148 | for (final EAttribute attribute : attributes) { | ||
149 | { | ||
150 | final EDataType trg = attribute.getEAttributeType(); | ||
151 | boolean _supportedEDataType = this.supportedEDataType(trg); | ||
152 | boolean _not = (!_supportedEDataType); | ||
153 | if (_not) { | ||
154 | StringConcatenation _builder = new StringConcatenation(); | ||
155 | _builder.append("Metamodels contains attribute \""); | ||
156 | String _name = attribute.getName(); | ||
157 | _builder.append(_name, ""); | ||
158 | _builder.append("\" with unsupported type \""); | ||
159 | String _name_1 = trg.getName(); | ||
160 | _builder.append(_name_1, ""); | ||
161 | _builder.append("\"!"); | ||
162 | errors.add(_builder.toString()); | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | } | ||
167 | } | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/QueryAndMetamodelValidator.java b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/QueryAndMetamodelValidator.java deleted file mode 100644 index ee4567d8..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/execution/validation/QueryAndMetamodelValidator.java +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.execution.validation; | ||
2 | |||
3 | import com.google.common.collect.Iterables; | ||
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | ||
5 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; | ||
6 | import java.util.Collections; | ||
7 | import java.util.LinkedList; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.common.util.EList; | ||
11 | import org.eclipse.emf.common.util.TreeIterator; | ||
12 | import org.eclipse.emf.ecore.EAttribute; | ||
13 | import org.eclipse.emf.ecore.EClass; | ||
14 | import org.eclipse.emf.ecore.EClassifier; | ||
15 | import org.eclipse.emf.ecore.EEnum; | ||
16 | import org.eclipse.emf.ecore.EEnumLiteral; | ||
17 | import org.eclipse.emf.ecore.ENamedElement; | ||
18 | import org.eclipse.emf.ecore.EObject; | ||
19 | import org.eclipse.emf.ecore.EReference; | ||
20 | import org.eclipse.viatra.query.patternlanguage.patternLanguage.Pattern; | ||
21 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
22 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
23 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
24 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
25 | import org.eclipse.xtext.xbase.lib.IteratorExtensions; | ||
26 | import org.eclipse.xtext.xbase.lib.ListExtensions; | ||
27 | import org.eclipse.xtext.xbase.lib.Pair; | ||
28 | |||
29 | @SuppressWarnings("all") | ||
30 | public class QueryAndMetamodelValidator { | ||
31 | public LinkedList<String> validateQueryAndMetamodel(final EcoreMetamodelDescriptor metamodel, final Pair<ViatraQuerySetDescriptor, Set<Pattern>> viatra) { | ||
32 | final Set<Pattern> patterns = viatra.getValue(); | ||
33 | List<EClass> _classes = metamodel.getClasses(); | ||
34 | List<EEnum> _enums = metamodel.getEnums(); | ||
35 | Iterable<EClassifier> _plus = Iterables.<EClassifier>concat(_classes, _enums); | ||
36 | List<EEnumLiteral> _literals = metamodel.getLiterals(); | ||
37 | Iterable<ENamedElement> _plus_1 = Iterables.<ENamedElement>concat(_plus, _literals); | ||
38 | List<EAttribute> _attributes = metamodel.getAttributes(); | ||
39 | Iterable<ENamedElement> _plus_2 = Iterables.<ENamedElement>concat(_plus_1, _attributes); | ||
40 | List<EReference> _references = metamodel.getReferences(); | ||
41 | Iterable<ENamedElement> _plus_3 = Iterables.<ENamedElement>concat(_plus_2, _references); | ||
42 | final Set<ENamedElement> elementsInMetamodel = IterableExtensions.<ENamedElement>toSet(_plus_3); | ||
43 | final LinkedList<String> errors = new LinkedList<String>(); | ||
44 | for (final Pattern pattern : patterns) { | ||
45 | { | ||
46 | final Iterable<ENamedElement> elements = this.getReferredNamedElements(pattern); | ||
47 | for (final ENamedElement element : elements) { | ||
48 | boolean _contains = elementsInMetamodel.contains(element); | ||
49 | boolean _not = (!_contains); | ||
50 | if (_not) { | ||
51 | StringConcatenation _builder = new StringConcatenation(); | ||
52 | _builder.append("Pattern \""); | ||
53 | String _name = pattern.getName(); | ||
54 | _builder.append(_name, ""); | ||
55 | _builder.append("\" refers to an element \""); | ||
56 | _builder.append(element, ""); | ||
57 | _builder.append("\" that is not included to the selected metamodel!"); | ||
58 | errors.add(_builder.toString()); | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | return errors; | ||
64 | } | ||
65 | |||
66 | public Iterable<ENamedElement> getReferredNamedElements(final Pattern pattern) { | ||
67 | TreeIterator<EObject> _eAllContents = pattern.eAllContents(); | ||
68 | final List<EObject> elements = IteratorExtensions.<EObject>toList(_eAllContents); | ||
69 | final Function1<EObject, Iterable<ENamedElement>> _function = (EObject element) -> { | ||
70 | EClass _eClass = element.eClass(); | ||
71 | final EList<EReference> references = _eClass.getEAllReferences(); | ||
72 | final Function1<EReference, Iterable<ENamedElement>> _function_1 = (EReference r) -> { | ||
73 | boolean _isMany = r.isMany(); | ||
74 | if (_isMany) { | ||
75 | Object _eGet = element.eGet(r); | ||
76 | return Iterables.<ENamedElement>filter(((List<?>) _eGet), ENamedElement.class); | ||
77 | } else { | ||
78 | final Object value = element.eGet(r); | ||
79 | if ((value instanceof ENamedElement)) { | ||
80 | return Collections.<ENamedElement>unmodifiableList(CollectionLiterals.<ENamedElement>newArrayList(((ENamedElement)value))); | ||
81 | } else { | ||
82 | return Collections.<ENamedElement>unmodifiableList(CollectionLiterals.<ENamedElement>newArrayList()); | ||
83 | } | ||
84 | } | ||
85 | }; | ||
86 | List<Iterable<ENamedElement>> _map = ListExtensions.<EReference, Iterable<ENamedElement>>map(references, _function_1); | ||
87 | Iterable<ENamedElement> _flatten = Iterables.<ENamedElement>concat(_map); | ||
88 | return Iterables.<ENamedElement>filter(_flatten, ENamedElement.class); | ||
89 | }; | ||
90 | List<Iterable<ENamedElement>> _map = ListExtensions.<EObject, Iterable<ENamedElement>>map(elements, _function); | ||
91 | return Iterables.<ENamedElement>concat(_map); | ||
92 | } | ||
93 | } | ||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/qualifiednameprovider/.gitignore b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/qualifiednameprovider/.gitignore deleted file mode 100644 index e581c9b2..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/qualifiednameprovider/.gitignore +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | /.QualifiedNameValueConverter.java._trace | ||
2 | /.ApplicationConfigurationQualifiedNameProvider.java._trace | ||