diff options
author | 2020-12-15 13:18:17 -0500 | |
---|---|---|
committer | 2021-01-06 00:02:49 +0100 | |
commit | f5afda733ffdf4f52da932e03919c20b99bf7fa6 (patch) | |
tree | fc875240bafc47c02e19d22b32e4c5a99fcfd941 /Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java | |
parent | implement getOneSolution with Dreal Integration (diff) | |
download | VIATRA-Generator-f5afda733ffdf4f52da932e03919c20b99bf7fa6.tar.gz VIATRA-Generator-f5afda733ffdf4f52da932e03919c20b99bf7fa6.tar.zst VIATRA-Generator-f5afda733ffdf4f52da932e03919c20b99bf7fa6.zip |
Add config flag for selecting numeric solver. Integ with Z3
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java')
-rw-r--r-- | Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java deleted file mode 100644 index 0b5b8f03..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.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.ecore.EAttribute; | ||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.emf.ecore.EClassifier; | ||
14 | import org.eclipse.emf.ecore.EEnum; | ||
15 | import org.eclipse.emf.ecore.EEnumLiteral; | ||
16 | import org.eclipse.emf.ecore.ENamedElement; | ||
17 | import org.eclipse.emf.ecore.EObject; | ||
18 | import org.eclipse.emf.ecore.EReference; | ||
19 | import org.eclipse.viatra.query.patternlanguage.emf.vql.Pattern; | ||
20 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
21 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
22 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
23 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
24 | import org.eclipse.xtext.xbase.lib.IteratorExtensions; | ||
25 | import org.eclipse.xtext.xbase.lib.ListExtensions; | ||
26 | import org.eclipse.xtext.xbase.lib.Pair; | ||
27 | |||
28 | @SuppressWarnings("all") | ||
29 | public class QueryAndMetamodelValidator { | ||
30 | public LinkedList<String> validateQueryAndMetamodel(final EcoreMetamodelDescriptor metamodel, final Pair<ViatraQuerySetDescriptor, Set<Pattern>> viatra) { | ||
31 | final Set<Pattern> patterns = viatra.getValue(); | ||
32 | List<EClass> _classes = metamodel.getClasses(); | ||
33 | List<EEnum> _enums = metamodel.getEnums(); | ||
34 | Iterable<EClassifier> _plus = Iterables.<EClassifier>concat(_classes, _enums); | ||
35 | List<EEnumLiteral> _literals = metamodel.getLiterals(); | ||
36 | Iterable<ENamedElement> _plus_1 = Iterables.<ENamedElement>concat(_plus, _literals); | ||
37 | List<EAttribute> _attributes = metamodel.getAttributes(); | ||
38 | Iterable<ENamedElement> _plus_2 = Iterables.<ENamedElement>concat(_plus_1, _attributes); | ||
39 | List<EReference> _references = metamodel.getReferences(); | ||
40 | final Set<ENamedElement> elementsInMetamodel = IterableExtensions.<ENamedElement>toSet(Iterables.<ENamedElement>concat(_plus_2, _references)); | ||
41 | final LinkedList<String> errors = new LinkedList<String>(); | ||
42 | for (final Pattern pattern : patterns) { | ||
43 | { | ||
44 | final Iterable<ENamedElement> elements = this.getReferredNamedElements(pattern); | ||
45 | for (final ENamedElement element : elements) { | ||
46 | boolean _contains = elementsInMetamodel.contains(element); | ||
47 | boolean _not = (!_contains); | ||
48 | if (_not) { | ||
49 | StringConcatenation _builder = new StringConcatenation(); | ||
50 | _builder.append("Pattern \""); | ||
51 | String _name = pattern.getName(); | ||
52 | _builder.append(_name); | ||
53 | _builder.append("\" refers to an element \""); | ||
54 | _builder.append(element); | ||
55 | _builder.append("\" that is not included to the selected metamodel!"); | ||
56 | errors.add(_builder.toString()); | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | return errors; | ||
62 | } | ||
63 | |||
64 | public Iterable<ENamedElement> getReferredNamedElements(final Pattern pattern) { | ||
65 | final List<EObject> elements = IteratorExtensions.<EObject>toList(pattern.eAllContents()); | ||
66 | final Function1<EObject, Iterable<ENamedElement>> _function = (EObject element) -> { | ||
67 | final EList<EReference> references = element.eClass().getEAllReferences(); | ||
68 | final Function1<EReference, Iterable<ENamedElement>> _function_1 = (EReference r) -> { | ||
69 | boolean _isMany = r.isMany(); | ||
70 | if (_isMany) { | ||
71 | Object _eGet = element.eGet(r); | ||
72 | return Iterables.<ENamedElement>filter(((List<?>) _eGet), ENamedElement.class); | ||
73 | } else { | ||
74 | final Object value = element.eGet(r); | ||
75 | if ((value instanceof ENamedElement)) { | ||
76 | return Collections.<ENamedElement>unmodifiableList(CollectionLiterals.<ENamedElement>newArrayList(((ENamedElement)value))); | ||
77 | } else { | ||
78 | return Collections.<ENamedElement>unmodifiableList(CollectionLiterals.<ENamedElement>newArrayList()); | ||
79 | } | ||
80 | } | ||
81 | }; | ||
82 | return Iterables.<ENamedElement>filter((Iterables.<ENamedElement>concat(ListExtensions.<EReference, Iterable<ENamedElement>>map(references, _function_1))), ENamedElement.class); | ||
83 | }; | ||
84 | return Iterables.<ENamedElement>concat(ListExtensions.<EObject, Iterable<ENamedElement>>map(elements, _function)); | ||
85 | } | ||
86 | } | ||