diff options
Diffstat (limited to 'Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics')
3 files changed, 110 insertions, 0 deletions
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/.CSERposterSample.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/.CSERposterSample.xtendbin new file mode 100644 index 00000000..50bd73de --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/.CSERposterSample.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/.gitignore b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/.gitignore new file mode 100644 index 00000000..b5da4aad --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/.gitignore | |||
@@ -0,0 +1 @@ | |||
/.CSERposterSample.java._trace | |||
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..b67728e8 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/examples/CSERposterSample.java | |||
@@ -0,0 +1,109 @@ | |||
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 | import simpleStatechart.SimpleStatechartPackage; | ||
42 | |||
43 | @SuppressWarnings("all") | ||
44 | public class CSERposterSample { | ||
45 | private final static InstanceModel2PartialInterpretation partialInterpretation2Logic = new InstanceModel2PartialInterpretation(); | ||
46 | |||
47 | private final static PartialInterpretation2ImmutableTypeLattice neighbourhoodComputer = new PartialInterpretation2ImmutableTypeLattice(); | ||
48 | |||
49 | private final static Ecore2Logic ecore2Logic = new Ecore2Logic(); | ||
50 | |||
51 | private final static PartialInterpretation2Gml partialVisualizer = new PartialInterpretation2Gml(); | ||
52 | |||
53 | private final static Neighbourhood2Gml neighbourhoodVisualizer = new Neighbourhood2Gml(); | ||
54 | |||
55 | private final static int depth = 1; | ||
56 | |||
57 | private final static String REALISTIC = "simpleSCRealistic"; | ||
58 | |||
59 | private final static String IRREALISTIC = "simpleSCIrrealistic"; | ||
60 | |||
61 | public static void main(final String[] args) { | ||
62 | try { | ||
63 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
64 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | ||
65 | _extensionToFactoryMap.put("*", _xMIResourceFactoryImpl); | ||
66 | YakindummPackage.eINSTANCE.eClass(); | ||
67 | LinkedListPackage.eINSTANCE.eClass(); | ||
68 | SimpleStatechartPackage.eINSTANCE.eClass(); | ||
69 | ReteEngine.class.getClass(); | ||
70 | final String outputs = "outputs"; | ||
71 | final String instModName = CSERposterSample.REALISTIC; | ||
72 | StringConcatenation _builder = new StringConcatenation(); | ||
73 | _builder.append("resources"); | ||
74 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder.toString(), ""); | ||
75 | final EObject model = workspace.<EObject>readModel(EObject.class, (instModName + ".xmi")); | ||
76 | final EPackage pckg = model.eClass().getEPackage(); | ||
77 | List<EClass> _list = IterableExtensions.<EClass>toList(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class)); | ||
78 | Set<EClass> _emptySet = Collections.<EClass>emptySet(); | ||
79 | List<EEnum> _list_1 = IterableExtensions.<EEnum>toList(Iterables.<EEnum>filter(pckg.getEClassifiers(), EEnum.class)); | ||
80 | final Function1<EEnum, EList<EEnumLiteral>> _function = (EEnum it) -> { | ||
81 | return it.getELiterals(); | ||
82 | }; | ||
83 | List<EEnumLiteral> _list_2 = IterableExtensions.<EEnumLiteral>toList(Iterables.<EEnumLiteral>concat(IterableExtensions.<EEnum, EList<EEnumLiteral>>map(Iterables.<EEnum>filter(pckg.getEClassifiers(), EEnum.class), _function))); | ||
84 | final Function1<EClass, EList<EReference>> _function_1 = (EClass it) -> { | ||
85 | return it.getEReferences(); | ||
86 | }; | ||
87 | List<EReference> _list_3 = IterableExtensions.<EReference>toList(Iterables.<EReference>concat(IterableExtensions.<EClass, EList<EReference>>map(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class), _function_1))); | ||
88 | final Function1<EClass, EList<EAttribute>> _function_2 = (EClass it) -> { | ||
89 | return it.getEAttributes(); | ||
90 | }; | ||
91 | List<EAttribute> _list_4 = IterableExtensions.<EAttribute>toList(Iterables.<EAttribute>concat(IterableExtensions.<EClass, EList<EAttribute>>map(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class), _function_2))); | ||
92 | final EcoreMetamodelDescriptor metamodel = new EcoreMetamodelDescriptor(_list, _emptySet, | ||
93 | false, _list_1, _list_2, _list_3, _list_4); | ||
94 | Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration(); | ||
95 | final TracedOutput<LogicProblem, Ecore2Logic_Trace> metamodelTransformationOutput = CSERposterSample.ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration); | ||
96 | final PartialInterpretation partialModelOutput = CSERposterSample.partialInterpretation2Logic.transform(metamodelTransformationOutput, model.eResource(), false); | ||
97 | final PrintWriter writer = new PrintWriter((((outputs + "//") + instModName) + "MODEL.gml")); | ||
98 | writer.print(CSERposterSample.partialVisualizer.transform(partialModelOutput)); | ||
99 | writer.close(); | ||
100 | final NeighbourhoodWithTraces<Map<? extends AbstractNodeDescriptor, Integer>, AbstractNodeDescriptor> hood = CSERposterSample.neighbourhoodComputer.createRepresentation(partialModelOutput, CSERposterSample.depth, Integer.MAX_VALUE, Integer.MAX_VALUE); | ||
101 | final PrintWriter w2 = new PrintWriter(((((outputs + "/") + instModName) + Integer.valueOf(CSERposterSample.depth)) + "NEIGHBOURHOOD.gml")); | ||
102 | w2.print(CSERposterSample.neighbourhoodVisualizer.transform(hood, partialModelOutput)); | ||
103 | w2.close(); | ||
104 | InputOutput.<String>println("visualization done"); | ||
105 | } catch (Throwable _e) { | ||
106 | throw Exceptions.sneakyThrow(_e); | ||
107 | } | ||
108 | } | ||
109 | } | ||