diff options
Diffstat (limited to 'Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/CSERposterSample.java')
-rw-r--r-- | Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/CSERposterSample.java | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/CSERposterSample.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/CSERposterSample.java new file mode 100644 index 00000000..ee5069d7 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/CSERposterSample.java | |||
@@ -0,0 +1,103 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.realistic.metrics.examples; | ||
2 | |||
3 | import com.google.common.collect.Iterables; | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage; | ||
5 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic; | ||
6 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration; | ||
7 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace; | ||
8 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | ||
9 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; | ||
10 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; | ||
11 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2PartialInterpretation; | ||
12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.AbstractNodeDescriptor; | ||
13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.Neighbourhood2Gml; | ||
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.NeighbourhoodWithTraces; | ||
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.PartialInterpretation2ImmutableTypeLattice; | ||
16 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation; | ||
17 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; | ||
18 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; | ||
19 | import java.io.PrintWriter; | ||
20 | import java.util.Collections; | ||
21 | import java.util.List; | ||
22 | import java.util.Map; | ||
23 | import java.util.Set; | ||
24 | import linkedList.LinkedListPackage; | ||
25 | import org.eclipse.emf.common.util.EList; | ||
26 | import org.eclipse.emf.ecore.EAttribute; | ||
27 | import org.eclipse.emf.ecore.EClass; | ||
28 | import org.eclipse.emf.ecore.EEnum; | ||
29 | import org.eclipse.emf.ecore.EEnumLiteral; | ||
30 | import org.eclipse.emf.ecore.EObject; | ||
31 | import org.eclipse.emf.ecore.EPackage; | ||
32 | import org.eclipse.emf.ecore.EReference; | ||
33 | import org.eclipse.emf.ecore.resource.Resource; | ||
34 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; | ||
35 | import org.eclipse.viatra.query.runtime.rete.matcher.ReteEngine; | ||
36 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
37 | import org.eclipse.xtext.xbase.lib.Exceptions; | ||
38 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
39 | import org.eclipse.xtext.xbase.lib.InputOutput; | ||
40 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
41 | |||
42 | @SuppressWarnings("all") | ||
43 | public class CSERposterSample { | ||
44 | private final static InstanceModel2PartialInterpretation partialInterpretation2Logic = new InstanceModel2PartialInterpretation(); | ||
45 | |||
46 | private final static PartialInterpretation2ImmutableTypeLattice neighbourhoodComputer = new PartialInterpretation2ImmutableTypeLattice(); | ||
47 | |||
48 | private final static Ecore2Logic ecore2Logic = new Ecore2Logic(); | ||
49 | |||
50 | private final static PartialInterpretation2Gml partialVisualizer = new PartialInterpretation2Gml(); | ||
51 | |||
52 | private final static Neighbourhood2Gml neighbourhoodVisualizer = new Neighbourhood2Gml(); | ||
53 | |||
54 | private final static int depth = 1; | ||
55 | |||
56 | public static void main(final String[] args) { | ||
57 | try { | ||
58 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
59 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | ||
60 | _extensionToFactoryMap.put("*", _xMIResourceFactoryImpl); | ||
61 | YakindummPackage.eINSTANCE.eClass(); | ||
62 | LinkedListPackage.eINSTANCE.eClass(); | ||
63 | ReteEngine.class.getClass(); | ||
64 | final String outputs = "outputs"; | ||
65 | final String instModName = "realisticModel"; | ||
66 | StringConcatenation _builder = new StringConcatenation(); | ||
67 | _builder.append("resources"); | ||
68 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder.toString(), ""); | ||
69 | final EObject model = workspace.<EObject>readModel(EObject.class, (instModName + ".xmi")); | ||
70 | final EPackage pckg = model.eClass().getEPackage(); | ||
71 | List<EClass> _list = IterableExtensions.<EClass>toList(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class)); | ||
72 | Set<EClass> _emptySet = Collections.<EClass>emptySet(); | ||
73 | List<EEnum> _list_1 = IterableExtensions.<EEnum>toList(Iterables.<EEnum>filter(pckg.getEClassifiers(), EEnum.class)); | ||
74 | final Function1<EEnum, EList<EEnumLiteral>> _function = (EEnum it) -> { | ||
75 | return it.getELiterals(); | ||
76 | }; | ||
77 | List<EEnumLiteral> _list_2 = IterableExtensions.<EEnumLiteral>toList(Iterables.<EEnumLiteral>concat(IterableExtensions.<EEnum, EList<EEnumLiteral>>map(Iterables.<EEnum>filter(pckg.getEClassifiers(), EEnum.class), _function))); | ||
78 | final Function1<EClass, EList<EReference>> _function_1 = (EClass it) -> { | ||
79 | return it.getEReferences(); | ||
80 | }; | ||
81 | List<EReference> _list_3 = IterableExtensions.<EReference>toList(Iterables.<EReference>concat(IterableExtensions.<EClass, EList<EReference>>map(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class), _function_1))); | ||
82 | final Function1<EClass, EList<EAttribute>> _function_2 = (EClass it) -> { | ||
83 | return it.getEAttributes(); | ||
84 | }; | ||
85 | List<EAttribute> _list_4 = IterableExtensions.<EAttribute>toList(Iterables.<EAttribute>concat(IterableExtensions.<EClass, EList<EAttribute>>map(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class), _function_2))); | ||
86 | final EcoreMetamodelDescriptor metamodel = new EcoreMetamodelDescriptor(_list, _emptySet, | ||
87 | false, _list_1, _list_2, _list_3, _list_4); | ||
88 | Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration(); | ||
89 | final TracedOutput<LogicProblem, Ecore2Logic_Trace> metamodelTransformationOutput = CSERposterSample.ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration); | ||
90 | final PartialInterpretation partialModelOutput = CSERposterSample.partialInterpretation2Logic.transform(metamodelTransformationOutput, model.eResource(), false); | ||
91 | final PrintWriter writer = new PrintWriter((((outputs + "//") + instModName) + "MODEL.gml")); | ||
92 | writer.print(CSERposterSample.partialVisualizer.transform(partialModelOutput)); | ||
93 | writer.close(); | ||
94 | final NeighbourhoodWithTraces<Map<? extends AbstractNodeDescriptor, Integer>, AbstractNodeDescriptor> hood = CSERposterSample.neighbourhoodComputer.createRepresentation(partialModelOutput, CSERposterSample.depth, Integer.MAX_VALUE, Integer.MAX_VALUE); | ||
95 | final PrintWriter w2 = new PrintWriter((((outputs + "/") + instModName) + "NEIGHBOURHOOD.gml")); | ||
96 | w2.print(CSERposterSample.neighbourhoodVisualizer.transform(hood, partialModelOutput)); | ||
97 | w2.close(); | ||
98 | InputOutput.<String>println("visualization done"); | ||
99 | } catch (Throwable _e) { | ||
100 | throw Exceptions.sneakyThrow(_e); | ||
101 | } | ||
102 | } | ||
103 | } | ||