diff options
Diffstat (limited to 'Metrics/Metrics-Calculation/SocialNetwork_plugin')
27 files changed, 4265 insertions, 18 deletions
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF b/Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF index cf5154e4..a3f5076e 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF | |||
@@ -7,6 +7,7 @@ Bundle-ClassPath: . | |||
7 | Bundle-Vendor: %providerName | 7 | Bundle-Vendor: %providerName |
8 | Bundle-Localization: plugin | 8 | Bundle-Localization: plugin |
9 | Export-Package: ca.mcgill.ecse.socialnetwork.plugin, | 9 | Export-Package: ca.mcgill.ecse.socialnetwork.plugin, |
10 | ca.mcgill.ecse.socialnetwork.runner, | ||
10 | queries, | 11 | queries, |
11 | socialnetwork, | 12 | socialnetwork, |
12 | socialnetwork.impl, | 13 | socialnetwork.impl, |
@@ -24,8 +25,9 @@ Require-Bundle: org.eclipse.viatra.query.runtime.rete, | |||
24 | hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph;bundle-version="1.0.0", | 25 | hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph;bundle-version="1.0.0", |
25 | ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator;bundle-version="1.0.0", | 26 | ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator;bundle-version="1.0.0", |
26 | hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.validation;bundle-version="0.0.1" | 27 | hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.validation;bundle-version="0.0.1" |
28 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
29 | Bundle-ActivationPolicy: lazy | ||
30 | Main-Class: ca.mcgill.ecse.socialnetwork.runner.Main | ||
31 | Automatic-Module-Name: SocialNetwork_plugin | ||
27 | Import-Package: org.apache.log4j, | 32 | Import-Package: org.apache.log4j, |
28 | org.junit;version="4.12.0" | 33 | org.junit;version="4.12.0" |
29 | Automatic-Module-Name: SocialNetwork_plugin | ||
30 | Bundle-ActivationPolicy: lazy | ||
31 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/build.properties b/Metrics/Metrics-Calculation/SocialNetwork_plugin/build.properties index 63ef0274..b91f214f 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/build.properties +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/build.properties | |||
@@ -2,7 +2,8 @@ bin.includes = .,\ | |||
2 | model/,\ | 2 | model/,\ |
3 | META-INF/,\ | 3 | META-INF/,\ |
4 | plugin.xml,\ | 4 | plugin.xml,\ |
5 | plugin.properties | 5 | plugin.properties,\ |
6 | src/ | ||
6 | jars.compile.order = . | 7 | jars.compile.order = . |
7 | source.. = encore_gen/,\ | 8 | source.. = encore_gen/,\ |
8 | src-gen/ | 9 | src-gen/ |
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/mpc_rep/San.ecore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/mpc_rep/San.ecore new file mode 100644 index 00000000..57088b0c --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/mpc_rep/San.ecore | |||
@@ -0,0 +1,104 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="San" nsURI="http://San/1.0" nsPrefix="San"> | ||
4 | <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//NamedElement"> | ||
5 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
6 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
7 | <eStructuralFeatures xsi:type="ecore:EReference" name="processes" upperBound="-1" | ||
8 | eType="#//Process" containment="true"/> | ||
9 | <eStructuralFeatures xsi:type="ecore:EReference" name="devices" upperBound="-1" | ||
10 | eType="#//Device" containment="true"/> | ||
11 | <eStructuralFeatures xsi:type="ecore:EReference" name="instruments" upperBound="-1" | ||
12 | eType="#//Instrument" containment="true"/> | ||
13 | <eStructuralFeatures xsi:type="ecore:EReference" name="measurands" upperBound="-1" | ||
14 | eType="#//Measurand" containment="true"/> | ||
15 | <eStructuralFeatures xsi:type="ecore:EReference" name="measures" upperBound="-1" | ||
16 | eType="#//Measure" containment="true"/> | ||
17 | <eStructuralFeatures xsi:type="ecore:EReference" name="bindings" upperBound="-1" | ||
18 | eType="#//Binding" containment="true"/> | ||
19 | <eStructuralFeatures xsi:type="ecore:EReference" name="triggers" upperBound="-1" | ||
20 | eType="#//Trigger" containment="true"/> | ||
21 | </eClassifiers> | ||
22 | <eClassifiers xsi:type="ecore:EClass" name="NamedElement"> | ||
23 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
24 | </eClassifiers> | ||
25 | <eClassifiers xsi:type="ecore:EClass" name="Device" eSuperTypes="#//NamedElement"> | ||
26 | <eStructuralFeatures xsi:type="ecore:EReference" name="instrument" lowerBound="1" | ||
27 | eType="#//Instrument"/> | ||
28 | <eStructuralFeatures xsi:type="ecore:EReference" name="arguments" upperBound="-1" | ||
29 | eType="#//Argument" containment="true"/> | ||
30 | </eClassifiers> | ||
31 | <eClassifiers xsi:type="ecore:EClass" name="Instrument" eSuperTypes="#//NamedElement"> | ||
32 | <eStructuralFeatures xsi:type="ecore:EReference" name="features" ordered="false" | ||
33 | upperBound="-1" eType="#//Feature" changeable="false" containment="true"/> | ||
34 | <eStructuralFeatures xsi:type="ecore:EReference" name="parameters" upperBound="-1" | ||
35 | eType="#//Parameter" containment="true"/> | ||
36 | </eClassifiers> | ||
37 | <eClassifiers xsi:type="ecore:EClass" name="Measurand" eSuperTypes="#//NamedElement"> | ||
38 | <eStructuralFeatures xsi:type="ecore:EReference" name="measurand" eType="#//Measurand"/> | ||
39 | </eClassifiers> | ||
40 | <eClassifiers xsi:type="ecore:EClass" name="Binding" eSuperTypes="#//NamedElement"> | ||
41 | <eStructuralFeatures xsi:type="ecore:EReference" name="device" lowerBound="1" | ||
42 | eType="#//Device"/> | ||
43 | <eStructuralFeatures xsi:type="ecore:EReference" name="measurand" lowerBound="1" | ||
44 | eType="#//Measurand"/> | ||
45 | <eStructuralFeatures xsi:type="ecore:EReference" name="feature" lowerBound="1" | ||
46 | eType="#//Feature"/> | ||
47 | </eClassifiers> | ||
48 | <eClassifiers xsi:type="ecore:EClass" name="Measure" eSuperTypes="#//NamedElement"> | ||
49 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="unit" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
50 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="#//Datatype"/> | ||
51 | </eClassifiers> | ||
52 | <eClassifiers xsi:type="ecore:EClass" name="Parameter" eSuperTypes="#//NamedElement"> | ||
53 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" lowerBound="1" eType="#//Datatype"/> | ||
54 | </eClassifiers> | ||
55 | <eClassifiers xsi:type="ecore:EClass" name="Argument" eSuperTypes="#//NamedElement"> | ||
56 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/> | ||
57 | <eStructuralFeatures xsi:type="ecore:EReference" name="parameter" eType="#//Parameter"/> | ||
58 | </eClassifiers> | ||
59 | <eClassifiers xsi:type="ecore:EClass" name="Feature" eSuperTypes="#//NamedElement"> | ||
60 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="factor" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" | ||
61 | defaultValueLiteral="0"/> | ||
62 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="mode" eType="#//Mode" defaultValueLiteral="Input"/> | ||
63 | <eStructuralFeatures xsi:type="ecore:EReference" name="measure" eType="#//Measure"/> | ||
64 | </eClassifiers> | ||
65 | <eClassifiers xsi:type="ecore:EEnum" name="Datatype"> | ||
66 | <eLiterals name="Boolean"/> | ||
67 | <eLiterals name="Date" value="1"/> | ||
68 | <eLiterals name="Double" value="2"/> | ||
69 | <eLiterals name="Float" value="3"/> | ||
70 | <eLiterals name="Integer" value="4"/> | ||
71 | <eLiterals name="Long" value="5"/> | ||
72 | <eLiterals name="String" value="6"/> | ||
73 | <eLiterals name="Time" value="7"/> | ||
74 | <eLiterals name="TimeStamp" value="8"/> | ||
75 | <eLiterals name="Uri" value="9"/> | ||
76 | <eLiterals name="Uuid" value="10"/> | ||
77 | </eClassifiers> | ||
78 | <eClassifiers xsi:type="ecore:EEnum" name="Mode"> | ||
79 | <eLiterals name="Input"/> | ||
80 | <eLiterals name="Output" value="1"/> | ||
81 | </eClassifiers> | ||
82 | <eClassifiers xsi:type="ecore:EClass" name="Process" eSuperTypes="#//NamedElement"> | ||
83 | <eStructuralFeatures xsi:type="ecore:EReference" name="parameters" upperBound="-1" | ||
84 | eType="#//Parameter" containment="true"/> | ||
85 | </eClassifiers> | ||
86 | <eClassifiers xsi:type="ecore:EClass" name="Trigger"> | ||
87 | <eStructuralFeatures xsi:type="ecore:EReference" name="process" lowerBound="1" | ||
88 | eType="#//Process"/> | ||
89 | <eStructuralFeatures xsi:type="ecore:EReference" name="arguments" upperBound="-1" | ||
90 | eType="#//Argument" containment="true"/> | ||
91 | </eClassifiers> | ||
92 | <eClassifiers xsi:type="ecore:EClass" name="Event" eSuperTypes="#//Trigger"> | ||
93 | <eStructuralFeatures xsi:type="ecore:EReference" name="binding" lowerBound="1" | ||
94 | eType="#//Binding"/> | ||
95 | </eClassifiers> | ||
96 | <eClassifiers xsi:type="ecore:EClass" name="Task" eSuperTypes="#//Trigger"> | ||
97 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="period" lowerBound="1" | ||
98 | eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/> | ||
99 | </eClassifiers> | ||
100 | <eClassifiers xsi:type="ecore:EClass" name="Thing" eSuperTypes="#//Trigger"> | ||
101 | <eStructuralFeatures xsi:type="ecore:EReference" name="instrument" lowerBound="1" | ||
102 | eType="#//Instrument"/> | ||
103 | </eClassifiers> | ||
104 | </ecore:EPackage> | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/na_rep/XSHMLMT.ecore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/na_rep/XSHMLMT.ecore new file mode 100644 index 00000000..f741662e --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/na_rep/XSHMLMT.ecore | |||
@@ -0,0 +1,203 @@ | |||
1 | <?xml version="1.0" encoding="ASCII"?> | ||
2 | <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="shml" nsURI="http://ecnu.models.xshml.xshmlmt/shml/" nsPrefix="shml"> | ||
3 | <eClassifiers xsi:type="ecore:EClass" name="System"> | ||
4 | <eOperations name="main"> | ||
5 | <eAnnotations source="aspect"/> | ||
6 | </eOperations> | ||
7 | <eOperations name="doprintconfiguration"> | ||
8 | <eAnnotations source="aspect"/> | ||
9 | </eOperations> | ||
10 | <eOperations name="dojump"> | ||
11 | <eAnnotations source="aspect"/> | ||
12 | </eOperations> | ||
13 | <eOperations name="callscilab"> | ||
14 | <eAnnotations source="aspect"/> | ||
15 | </eOperations> | ||
16 | <eOperations name="RealizeInitializeModel"> | ||
17 | <eAnnotations source="aspect"/> | ||
18 | <eParameters name="arguments" upperBound="-1"> | ||
19 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
20 | </eParameters> | ||
21 | </eOperations> | ||
22 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
23 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
24 | </eStructuralFeatures> | ||
25 | <eStructuralFeatures xsi:type="ecore:EReference" name="tshss" upperBound="-1" eType="//TSHS" containment="true"/> | ||
26 | <eStructuralFeatures xsi:type="ecore:EReference" name="globalvariables" upperBound="-1" eType="//Variable" containment="true"/> | ||
27 | <eStructuralFeatures xsi:type="ecore:EReference" name="globalclocks" upperBound="-1" eType="//Clock" containment="true"/> | ||
28 | <eStructuralFeatures xsi:type="ecore:EReference" name="globalevents" upperBound="-1" eType="//Event" containment="true"/> | ||
29 | </eClassifiers> | ||
30 | <eClassifiers xsi:type="ecore:EClass" name="TSHS"> | ||
31 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
32 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
33 | </eStructuralFeatures> | ||
34 | <eStructuralFeatures xsi:type="ecore:EReference" name="ownedodes" upperBound="-1" eType="//ODE" containment="true"/> | ||
35 | <eStructuralFeatures xsi:type="ecore:EReference" name="ownedstates" upperBound="-1" eType="//State" containment="true"/> | ||
36 | <eStructuralFeatures xsi:type="ecore:EReference" name="ownedtransitions" upperBound="-1" eType="//Transition" containment="true"/> | ||
37 | <eStructuralFeatures xsi:type="ecore:EReference" name="localvariables" upperBound="-1" eType="//Variable" containment="true"/> | ||
38 | <eStructuralFeatures xsi:type="ecore:EReference" name="localclocks" upperBound="-1" eType="//Clock" containment="true"/> | ||
39 | <eStructuralFeatures xsi:type="ecore:EReference" name="localevents" upperBound="-1" eType="//Event" containment="true"/> | ||
40 | <eStructuralFeatures xsi:type="ecore:EReference" name="initialstate" lowerBound="1" eType="//State"/> | ||
41 | <eStructuralFeatures xsi:type="ecore:EReference" name="ownedexpos" upperBound="-1" eType="//ExpoDistribution" containment="true"/> | ||
42 | <eStructuralFeatures xsi:type="ecore:EReference" name="ownedactions" upperBound="-1" eType="//Action" containment="true"/> | ||
43 | <eStructuralFeatures xsi:type="ecore:EReference" name="ownedguards" upperBound="-1" eType="//Guard" containment="true"/> | ||
44 | <eStructuralFeatures xsi:type="ecore:EReference" name="ownedunifs" upperBound="-1" eType="//UnifDistribution" containment="true"/> | ||
45 | </eClassifiers> | ||
46 | <eClassifiers xsi:type="ecore:EClass" name="Variable"> | ||
47 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
48 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
49 | </eStructuralFeatures> | ||
50 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"> | ||
51 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
52 | </eStructuralFeatures> | ||
53 | </eClassifiers> | ||
54 | <eClassifiers xsi:type="ecore:EClass" name="Clock"> | ||
55 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
56 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
57 | </eStructuralFeatures> | ||
58 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="time"> | ||
59 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
60 | </eStructuralFeatures> | ||
61 | </eClassifiers> | ||
62 | <eClassifiers xsi:type="ecore:EClass" name="Event"> | ||
63 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
64 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
65 | </eStructuralFeatures> | ||
66 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="send"> | ||
67 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
68 | </eStructuralFeatures> | ||
69 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="receive"> | ||
70 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
71 | </eStructuralFeatures> | ||
72 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="active"> | ||
73 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
74 | </eStructuralFeatures> | ||
75 | </eClassifiers> | ||
76 | <eClassifiers xsi:type="ecore:EClass" name="Transition" abstract="true"> | ||
77 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
78 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
79 | </eStructuralFeatures> | ||
80 | <eStructuralFeatures xsi:type="ecore:EReference" name="triggerevent" lowerBound="1" eType="//Event"/> | ||
81 | <eStructuralFeatures xsi:type="ecore:EReference" name="taction" lowerBound="1" eType="//Action"/> | ||
82 | <eStructuralFeatures xsi:type="ecore:EReference" name="evaluateguard" lowerBound="1" eType="//EvaluateGuard"/> | ||
83 | <eStructuralFeatures xsi:type="ecore:EReference" name="temporalguard" lowerBound="1" eType="//TemporalGuard"/> | ||
84 | </eClassifiers> | ||
85 | <eClassifiers xsi:type="ecore:EClass" name="Guard" abstract="true"> | ||
86 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
87 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
88 | </eStructuralFeatures> | ||
89 | </eClassifiers> | ||
90 | <eClassifiers xsi:type="ecore:EClass" name="TemporalGuard" eSuperTypes="//Guard"> | ||
91 | <eOperations name="holdstg"> | ||
92 | <eAnnotations source="aspect"/> | ||
93 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> | ||
94 | </eOperations> | ||
95 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="tcondition"> | ||
96 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
97 | </eStructuralFeatures> | ||
98 | <eStructuralFeatures xsi:type="ecore:EReference" name="onclock" lowerBound="1" eType="//Clock"/> | ||
99 | </eClassifiers> | ||
100 | <eClassifiers xsi:type="ecore:EClass" name="EvaluateGuard" eSuperTypes="//Guard"> | ||
101 | <eOperations name="holdseg"> | ||
102 | <eAnnotations source="aspect"/> | ||
103 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> | ||
104 | </eOperations> | ||
105 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="vcondition"> | ||
106 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
107 | </eStructuralFeatures> | ||
108 | <eStructuralFeatures xsi:type="ecore:EReference" name="onvariable" lowerBound="1" eType="//Variable"/> | ||
109 | </eClassifiers> | ||
110 | <eClassifiers xsi:type="ecore:EClass" name="State"> | ||
111 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
112 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
113 | </eStructuralFeatures> | ||
114 | <eStructuralFeatures xsi:type="ecore:EReference" name="slaveode" lowerBound="1" eType="//ODE"/> | ||
115 | <eStructuralFeatures xsi:type="ecore:EReference" name="outgoingct" upperBound="-1" eType="//ComTransition" eOpposite="//ComTransition/csrc"/> | ||
116 | <eStructuralFeatures xsi:type="ecore:EReference" name="incomingct" upperBound="-1" eType="//ComTransition" eOpposite="//ComTransition/ctgt"/> | ||
117 | <eStructuralFeatures xsi:type="ecore:EReference" name="outgoingpt" upperBound="-1" eType="//ProbTransition" eOpposite="//ProbTransition/psrc"/> | ||
118 | <eStructuralFeatures xsi:type="ecore:EReference" name="incomingpt" upperBound="-1" eType="//ProbTransition" eOpposite="//ProbTransition/ptgt"/> | ||
119 | <eStructuralFeatures xsi:type="ecore:EReference" name="subdiagram" lowerBound="1" eType="//TSHS"/> | ||
120 | <eStructuralFeatures xsi:type="ecore:EReference" name="fatherstate" lowerBound="1" eType="//State"/> | ||
121 | <eStructuralFeatures xsi:type="ecore:EReference" name="slavelambda" lowerBound="1" eType="//ExpoDistribution"/> | ||
122 | <eStructuralFeatures xsi:type="ecore:EReference" name="slaveunif" lowerBound="1" eType="//UnifDistribution"/> | ||
123 | </eClassifiers> | ||
124 | <eClassifiers xsi:type="ecore:EClass" name="ComTransition" eSuperTypes="//Transition"> | ||
125 | <eStructuralFeatures xsi:type="ecore:EReference" name="csrc" lowerBound="1" eType="//State" eOpposite="//State/outgoingct"/> | ||
126 | <eStructuralFeatures xsi:type="ecore:EReference" name="ctgt" eType="//State" eOpposite="//State/incomingct"/> | ||
127 | </eClassifiers> | ||
128 | <eClassifiers xsi:type="ecore:EClass" name="ProbTransition" eSuperTypes="//Transition"> | ||
129 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="probability"> | ||
130 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
131 | </eStructuralFeatures> | ||
132 | <eStructuralFeatures xsi:type="ecore:EReference" name="psrc" lowerBound="1" eType="//State" eOpposite="//State/outgoingpt"/> | ||
133 | <eStructuralFeatures xsi:type="ecore:EReference" name="ptgt" lowerBound="1" eType="//State" eOpposite="//State/incomingpt"/> | ||
134 | </eClassifiers> | ||
135 | <eClassifiers xsi:type="ecore:EClass" name="Function"> | ||
136 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
137 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
138 | </eStructuralFeatures> | ||
139 | <eStructuralFeatures xsi:type="ecore:EReference" name="indevariable" lowerBound="1" eType="//IndeVariable" containment="true"/> | ||
140 | <eStructuralFeatures xsi:type="ecore:EReference" name="devariable" lowerBound="1" eType="//DeVariable" containment="true"/> | ||
141 | <eStructuralFeatures xsi:type="ecore:EReference" name="fright" lowerBound="1" eType="//Fright" containment="true"/> | ||
142 | </eClassifiers> | ||
143 | <eClassifiers xsi:type="ecore:EClass" name="IndeVariable"> | ||
144 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
145 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
146 | </eStructuralFeatures> | ||
147 | </eClassifiers> | ||
148 | <eClassifiers xsi:type="ecore:EClass" name="DeVariable"> | ||
149 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
150 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
151 | </eStructuralFeatures> | ||
152 | </eClassifiers> | ||
153 | <eClassifiers xsi:type="ecore:EClass" name="Fright"> | ||
154 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
155 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
156 | </eStructuralFeatures> | ||
157 | </eClassifiers> | ||
158 | <eClassifiers xsi:type="ecore:EClass" name="ODE"> | ||
159 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
160 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
161 | </eStructuralFeatures> | ||
162 | <eStructuralFeatures xsi:type="ecore:EReference" name="condition" lowerBound="1" eType="//Condition" containment="true"/> | ||
163 | <eStructuralFeatures xsi:type="ecore:EReference" name="interval" lowerBound="1" eType="//Interval" containment="true"/> | ||
164 | <eStructuralFeatures xsi:type="ecore:EReference" name="function" lowerBound="1" eType="//Function" containment="true"/> | ||
165 | </eClassifiers> | ||
166 | <eClassifiers xsi:type="ecore:EClass" name="Condition"> | ||
167 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
168 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
169 | </eStructuralFeatures> | ||
170 | </eClassifiers> | ||
171 | <eClassifiers xsi:type="ecore:EClass" name="Interval"> | ||
172 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> | ||
173 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
174 | </eStructuralFeatures> | ||
175 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="left"> | ||
176 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
177 | </eStructuralFeatures> | ||
178 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="right"> | ||
179 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
180 | </eStructuralFeatures> | ||
181 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="subinterval"> | ||
182 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
183 | </eStructuralFeatures> | ||
184 | </eClassifiers> | ||
185 | <eClassifiers xsi:type="ecore:EClass" name="ExpoDistribution"> | ||
186 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="lambda"> | ||
187 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
188 | </eStructuralFeatures> | ||
189 | </eClassifiers> | ||
190 | <eClassifiers xsi:type="ecore:EClass" name="Action"> | ||
191 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"> | ||
192 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
193 | </eStructuralFeatures> | ||
194 | </eClassifiers> | ||
195 | <eClassifiers xsi:type="ecore:EClass" name="UnifDistribution"> | ||
196 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="a"> | ||
197 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
198 | </eStructuralFeatures> | ||
199 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="b"> | ||
200 | <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> | ||
201 | </eStructuralFeatures> | ||
202 | </eClassifiers> | ||
203 | </ecore:EPackage> | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/Sql.ecore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/Sql.ecore new file mode 100644 index 00000000..65d72135 --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/Sql.ecore | |||
@@ -0,0 +1,549 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="sql" nsURI="http://www.com.jaspersoft.studio.data.Sql" nsPrefix="sql"> | ||
4 | <eClassifiers xsi:type="ecore:EClass" name="Model"> | ||
5 | <eStructuralFeatures xsi:type="ecore:EReference" name="wq" eType="#//WithQuery" | ||
6 | containment="true"/> | ||
7 | <eStructuralFeatures xsi:type="ecore:EReference" name="query" eType="#//SelectQuery" | ||
8 | containment="true"/> | ||
9 | </eClassifiers> | ||
10 | <eClassifiers xsi:type="ecore:EClass" name="WithQuery"> | ||
11 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="w" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
12 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="wname" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
13 | <eStructuralFeatures xsi:type="ecore:EReference" name="withCols" eType="#//WithColumns" | ||
14 | containment="true"/> | ||
15 | <eStructuralFeatures xsi:type="ecore:EReference" name="query" eType="#//SelectQuery" | ||
16 | containment="true"/> | ||
17 | </eClassifiers> | ||
18 | <eClassifiers xsi:type="ecore:EClass" name="WithColumns"/> | ||
19 | <eClassifiers xsi:type="ecore:EClass" name="FetchFirst"> | ||
20 | <eStructuralFeatures xsi:type="ecore:EReference" name="fetchFirst" eType="#//UnsignedValue" | ||
21 | containment="true"/> | ||
22 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="row" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
23 | </eClassifiers> | ||
24 | <eClassifiers xsi:type="ecore:EClass" name="Offset"> | ||
25 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="offset" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
26 | </eClassifiers> | ||
27 | <eClassifiers xsi:type="ecore:EClass" name="Limit"> | ||
28 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="l1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
29 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="l2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
30 | </eClassifiers> | ||
31 | <eClassifiers xsi:type="ecore:EClass" name="SelectQuery"/> | ||
32 | <eClassifiers xsi:type="ecore:EClass" name="SelectSubSet"> | ||
33 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="op" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
34 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="all" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
35 | <eStructuralFeatures xsi:type="ecore:EReference" name="query" eType="#//Select" | ||
36 | containment="true"/> | ||
37 | </eClassifiers> | ||
38 | <eClassifiers xsi:type="ecore:EClass" name="Select" eSuperTypes="#//SelectQuery"> | ||
39 | <eStructuralFeatures xsi:type="ecore:EReference" name="op" upperBound="-1" eType="#//SelectSubSet" | ||
40 | containment="true"/> | ||
41 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="select" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
42 | <eStructuralFeatures xsi:type="ecore:EReference" name="cols" eType="#//OrColumn" | ||
43 | containment="true"/> | ||
44 | <eStructuralFeatures xsi:type="ecore:EReference" name="tbl" eType="#//OrTable" | ||
45 | containment="true"/> | ||
46 | <eStructuralFeatures xsi:type="ecore:EReference" name="whereExpression" eType="#//OrExpr" | ||
47 | containment="true"/> | ||
48 | <eStructuralFeatures xsi:type="ecore:EReference" name="groupByEntry" eType="#//OrGroupByColumn" | ||
49 | containment="true"/> | ||
50 | <eStructuralFeatures xsi:type="ecore:EReference" name="havingEntry" eType="#//OrExpr" | ||
51 | containment="true"/> | ||
52 | <eStructuralFeatures xsi:type="ecore:EReference" name="orderByEntry" eType="#//OrOrderByColumn" | ||
53 | containment="true"/> | ||
54 | <eStructuralFeatures xsi:type="ecore:EReference" name="lim" eType="#//Limit" containment="true"/> | ||
55 | <eStructuralFeatures xsi:type="ecore:EReference" name="offset" eType="#//Offset" | ||
56 | containment="true"/> | ||
57 | <eStructuralFeatures xsi:type="ecore:EReference" name="fetchFirst" eType="#//FetchFirst" | ||
58 | containment="true"/> | ||
59 | </eClassifiers> | ||
60 | <eClassifiers xsi:type="ecore:EClass" name="OrColumn" eSuperTypes="#//PivotForClause"> | ||
61 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
62 | eType="#//ColumnOrAlias" containment="true"/> | ||
63 | </eClassifiers> | ||
64 | <eClassifiers xsi:type="ecore:EClass" name="ColumnOrAlias" eSuperTypes="#//OrColumn"> | ||
65 | <eStructuralFeatures xsi:type="ecore:EReference" name="ce" eType="#//Operands" | ||
66 | containment="true"/> | ||
67 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="alias" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
68 | <eStructuralFeatures xsi:type="ecore:EReference" name="colAlias" eType="#//DbObjectName" | ||
69 | containment="true"/> | ||
70 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="allCols" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
71 | <eStructuralFeatures xsi:type="ecore:EReference" name="dbAllCols" eType="#//DbObjectNameAll" | ||
72 | containment="true"/> | ||
73 | </eClassifiers> | ||
74 | <eClassifiers xsi:type="ecore:EClass" name="ColumnFull" eSuperTypes="#//PivotForClause"/> | ||
75 | <eClassifiers xsi:type="ecore:EClass" name="OrTable"> | ||
76 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
77 | eType="#//FromTable" containment="true"/> | ||
78 | </eClassifiers> | ||
79 | <eClassifiers xsi:type="ecore:EClass" name="FromTable" eSuperTypes="#//OrTable"> | ||
80 | <eStructuralFeatures xsi:type="ecore:EReference" name="table" eType="#//TableOrAlias" | ||
81 | containment="true"/> | ||
82 | <eStructuralFeatures xsi:type="ecore:EReference" name="fjoin" upperBound="-1" | ||
83 | eType="#//FromTableJoin" containment="true"/> | ||
84 | </eClassifiers> | ||
85 | <eClassifiers xsi:type="ecore:EClass" name="FromTableJoin"> | ||
86 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="join" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
87 | <eStructuralFeatures xsi:type="ecore:EReference" name="onTable" eType="#//TableOrAlias" | ||
88 | containment="true"/> | ||
89 | <eStructuralFeatures xsi:type="ecore:EReference" name="joinExpr" eType="#//OrExpr" | ||
90 | containment="true"/> | ||
91 | <eStructuralFeatures xsi:type="ecore:EReference" name="joinCond" eType="#//JoinCondition" | ||
92 | containment="true"/> | ||
93 | </eClassifiers> | ||
94 | <eClassifiers xsi:type="ecore:EClass" name="JoinCondition"> | ||
95 | <eStructuralFeatures xsi:type="ecore:EReference" name="useCols" eType="#//UsingCols" | ||
96 | containment="true"/> | ||
97 | </eClassifiers> | ||
98 | <eClassifiers xsi:type="ecore:EClass" name="UsingCols" eSuperTypes="#//WithColumns"> | ||
99 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
100 | eType="#//DbObjectName" containment="true"/> | ||
101 | </eClassifiers> | ||
102 | <eClassifiers xsi:type="ecore:EClass" name="TableOrAlias"> | ||
103 | <eStructuralFeatures xsi:type="ecore:EReference" name="tfull" eType="#//TableFull" | ||
104 | containment="true"/> | ||
105 | <eStructuralFeatures xsi:type="ecore:EReference" name="sq" eType="#//SubQueryOperand" | ||
106 | containment="true"/> | ||
107 | <eStructuralFeatures xsi:type="ecore:EReference" name="values" eType="#//FromValues" | ||
108 | containment="true"/> | ||
109 | <eStructuralFeatures xsi:type="ecore:EReference" name="pivot" eType="#//PivotTable" | ||
110 | containment="true"/> | ||
111 | <eStructuralFeatures xsi:type="ecore:EReference" name="unpivot" eType="#//UnpivotTable" | ||
112 | containment="true"/> | ||
113 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="alias" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
114 | <eStructuralFeatures xsi:type="ecore:EReference" name="tblAlias" eType="#//DbObjectName" | ||
115 | containment="true"/> | ||
116 | </eClassifiers> | ||
117 | <eClassifiers xsi:type="ecore:EClass" name="FromValues"> | ||
118 | <eStructuralFeatures xsi:type="ecore:EReference" name="values" eType="#//Values" | ||
119 | containment="true"/> | ||
120 | <eStructuralFeatures xsi:type="ecore:EReference" name="c" eType="#//FromValuesColumns" | ||
121 | containment="true"/> | ||
122 | </eClassifiers> | ||
123 | <eClassifiers xsi:type="ecore:EClass" name="FromValuesColumns"> | ||
124 | <eStructuralFeatures xsi:type="ecore:EReference" name="fvCols" eType="#//FromValuesColumnNames" | ||
125 | containment="true"/> | ||
126 | </eClassifiers> | ||
127 | <eClassifiers xsi:type="ecore:EClass" name="FromValuesColumnNames"/> | ||
128 | <eClassifiers xsi:type="ecore:EClass" name="ColumnNames" eSuperTypes="#//FromValuesColumnNames"> | ||
129 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="colName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
130 | </eClassifiers> | ||
131 | <eClassifiers xsi:type="ecore:EClass" name="Values"> | ||
132 | <eStructuralFeatures xsi:type="ecore:EReference" name="rows" eType="#//Rows" containment="true"/> | ||
133 | </eClassifiers> | ||
134 | <eClassifiers xsi:type="ecore:EClass" name="Rows"> | ||
135 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
136 | eType="#//Row" containment="true"/> | ||
137 | </eClassifiers> | ||
138 | <eClassifiers xsi:type="ecore:EClass" name="Row" eSuperTypes="#//Rows"> | ||
139 | <eStructuralFeatures xsi:type="ecore:EReference" name="rowValues" eType="#//RowValues" | ||
140 | containment="true"/> | ||
141 | </eClassifiers> | ||
142 | <eClassifiers xsi:type="ecore:EClass" name="RowValues"> | ||
143 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
144 | eType="#//RowValue" containment="true"/> | ||
145 | </eClassifiers> | ||
146 | <eClassifiers xsi:type="ecore:EClass" name="RowValue" eSuperTypes="#//RowValues"> | ||
147 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="null" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
148 | </eClassifiers> | ||
149 | <eClassifiers xsi:type="ecore:EClass" name="PivotTable"> | ||
150 | <eStructuralFeatures xsi:type="ecore:EReference" name="pfun" eType="#//PivotFunctions" | ||
151 | containment="true"/> | ||
152 | <eStructuralFeatures xsi:type="ecore:EReference" name="pfor" eType="#//PivotForClause" | ||
153 | containment="true"/> | ||
154 | <eStructuralFeatures xsi:type="ecore:EReference" name="pin" eType="#//PivotInClause" | ||
155 | containment="true"/> | ||
156 | </eClassifiers> | ||
157 | <eClassifiers xsi:type="ecore:EClass" name="PivotFunctions"> | ||
158 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="abc" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
159 | </eClassifiers> | ||
160 | <eClassifiers xsi:type="ecore:EClass" name="PivotFunction"/> | ||
161 | <eClassifiers xsi:type="ecore:EClass" name="PivotInClause"> | ||
162 | <eStructuralFeatures xsi:type="ecore:EReference" name="sq" eType="#//SubQueryOperand" | ||
163 | containment="true"/> | ||
164 | <eStructuralFeatures xsi:type="ecore:EReference" name="args" eType="#//UnpivotInClauseArgs" | ||
165 | containment="true"/> | ||
166 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="pinany" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
167 | </eClassifiers> | ||
168 | <eClassifiers xsi:type="ecore:EClass" name="UnpivotTable"> | ||
169 | <eStructuralFeatures xsi:type="ecore:EReference" name="pcols" eType="#//PivotColumns" | ||
170 | containment="true"/> | ||
171 | <eStructuralFeatures xsi:type="ecore:EReference" name="pfor" eType="#//PivotForClause" | ||
172 | containment="true"/> | ||
173 | <eStructuralFeatures xsi:type="ecore:EReference" name="inop" eType="#//UnpivotInClause" | ||
174 | containment="true"/> | ||
175 | </eClassifiers> | ||
176 | <eClassifiers xsi:type="ecore:EClass" name="UnpivotInClause"/> | ||
177 | <eClassifiers xsi:type="ecore:EClass" name="UnpivotInClauseArgs"/> | ||
178 | <eClassifiers xsi:type="ecore:EClass" name="UnpivotInClauseArg" eSuperTypes="#//UnpivotInClauseArgs"> | ||
179 | <eStructuralFeatures xsi:type="ecore:EReference" name="pcols" eType="#//PivotColumns" | ||
180 | containment="true"/> | ||
181 | <eStructuralFeatures xsi:type="ecore:EReference" name="cfuls" eType="#//PivotColumns" | ||
182 | containment="true"/> | ||
183 | </eClassifiers> | ||
184 | <eClassifiers xsi:type="ecore:EClass" name="PivotForClause"/> | ||
185 | <eClassifiers xsi:type="ecore:EClass" name="PivotColumns"/> | ||
186 | <eClassifiers xsi:type="ecore:EClass" name="Pivots" eSuperTypes="#//PivotColumns"/> | ||
187 | <eClassifiers xsi:type="ecore:EClass" name="PivotCol" eSuperTypes="#//PivotFunction #//PivotColumns #//Pivots"/> | ||
188 | <eClassifiers xsi:type="ecore:EClass" name="TableFull"/> | ||
189 | <eClassifiers xsi:type="ecore:EClass" name="DbObjectNameAll"> | ||
190 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="dbname" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
191 | </eClassifiers> | ||
192 | <eClassifiers xsi:type="ecore:EClass" name="DbObjectName" eSuperTypes="#//ColumnFull #//UsingCols #//PivotCol #//TableFull"> | ||
193 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="dbname" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
194 | </eClassifiers> | ||
195 | <eClassifiers xsi:type="ecore:EClass" name="OrOrderByColumn"> | ||
196 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
197 | eType="#//OrderByColumnFull" containment="true"/> | ||
198 | </eClassifiers> | ||
199 | <eClassifiers xsi:type="ecore:EClass" name="OrderByColumnFull" eSuperTypes="#//OrOrderByColumn"> | ||
200 | <eStructuralFeatures xsi:type="ecore:EReference" name="colOrder" eType="#//ColumnFull" | ||
201 | containment="true"/> | ||
202 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="colOrderInt" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
203 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="direction" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
204 | </eClassifiers> | ||
205 | <eClassifiers xsi:type="ecore:EClass" name="OrGroupByColumn"> | ||
206 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
207 | eType="#//GroupByColumnFull" containment="true"/> | ||
208 | </eClassifiers> | ||
209 | <eClassifiers xsi:type="ecore:EClass" name="GroupByColumnFull" eSuperTypes="#//OrGroupByColumn"> | ||
210 | <eStructuralFeatures xsi:type="ecore:EReference" name="colGrBy" eType="#//ColumnFull" | ||
211 | containment="true"/> | ||
212 | <eStructuralFeatures xsi:type="ecore:EReference" name="gbFunction" eType="#//OpFunction" | ||
213 | containment="true"/> | ||
214 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="grByInt" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
215 | </eClassifiers> | ||
216 | <eClassifiers xsi:type="ecore:EClass" name="OrExpr"> | ||
217 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
218 | eType="#//FullExpression" containment="true"/> | ||
219 | </eClassifiers> | ||
220 | <eClassifiers xsi:type="ecore:EClass" name="FullExpression" eSuperTypes="#//OrExpr"> | ||
221 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="c" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
222 | <eStructuralFeatures xsi:type="ecore:EReference" name="efrag" eType="#//FullExpression" | ||
223 | containment="true"/> | ||
224 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="notPrm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
225 | <eStructuralFeatures xsi:type="ecore:EReference" name="expgroup" eType="#//ExprGroup" | ||
226 | containment="true"/> | ||
227 | <eStructuralFeatures xsi:type="ecore:EReference" name="exp" eType="#//FullExpression" | ||
228 | containment="true"/> | ||
229 | <eStructuralFeatures xsi:type="ecore:EReference" name="xexp" eType="#//XExpr" | ||
230 | containment="true"/> | ||
231 | <eStructuralFeatures xsi:type="ecore:EReference" name="in" eType="#//InOper" containment="true"/> | ||
232 | <eStructuralFeatures xsi:type="ecore:EReference" name="exists" eType="#//ExistsOper" | ||
233 | containment="true"/> | ||
234 | <eStructuralFeatures xsi:type="ecore:EReference" name="op1" eType="#//Operands" | ||
235 | containment="true"/> | ||
236 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="isnull" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
237 | <eStructuralFeatures xsi:type="ecore:EReference" name="between" eType="#//Between" | ||
238 | containment="true"/> | ||
239 | <eStructuralFeatures xsi:type="ecore:EReference" name="like" eType="#//Like" containment="true"/> | ||
240 | <eStructuralFeatures xsi:type="ecore:EReference" name="comp" eType="#//Comparison" | ||
241 | containment="true"/> | ||
242 | </eClassifiers> | ||
243 | <eClassifiers xsi:type="ecore:EClass" name="ExprGroup"> | ||
244 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="isnot" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
245 | <eStructuralFeatures xsi:type="ecore:EReference" name="expr" eType="#//OrExpr" | ||
246 | containment="true"/> | ||
247 | </eClassifiers> | ||
248 | <eClassifiers xsi:type="ecore:EClass" name="XExpr"> | ||
249 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="xf" eType="#//XFunction"/> | ||
250 | <eStructuralFeatures xsi:type="ecore:EReference" name="col" eType="#//Operands" | ||
251 | containment="true"/> | ||
252 | <eStructuralFeatures xsi:type="ecore:EReference" name="prm" eType="#//Prms" containment="true"/> | ||
253 | </eClassifiers> | ||
254 | <eClassifiers xsi:type="ecore:EEnum" name="XFunction"> | ||
255 | <eLiterals name="xin" literal="{IN"/> | ||
256 | <eLiterals name="xnotin" value="1" literal="{NOTIN"/> | ||
257 | <eLiterals name="xeq" value="2" literal="{EQUAL"/> | ||
258 | <eLiterals name="xnoteq" value="3" literal="{NOTEQUAL"/> | ||
259 | <eLiterals name="xls" value="4" literal="{LESS"/> | ||
260 | <eLiterals name="xlsr" value="5" literal="{LESS]"/> | ||
261 | <eLiterals name="xgtl" value="6" literal="{[GREATER"/> | ||
262 | <eLiterals name="xgt" value="7" literal="{GREATER"/> | ||
263 | <eLiterals name="xbwn" value="8" literal="{BETWEEN"/> | ||
264 | <eLiterals name="xbwnc" value="9" literal="{[BETWEEN]"/> | ||
265 | <eLiterals name="xbwnl" value="10" literal="{[BETWEEN"/> | ||
266 | <eLiterals name="xbwnr" value="11" literal="{BETWEEN]"/> | ||
267 | </eClassifiers> | ||
268 | <eClassifiers xsi:type="ecore:EClass" name="Prms"> | ||
269 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
270 | eType="#//JRParameter" containment="true"/> | ||
271 | </eClassifiers> | ||
272 | <eClassifiers xsi:type="ecore:EClass" name="JRParameter" eSuperTypes="#//Prms"> | ||
273 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="jrprm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
274 | </eClassifiers> | ||
275 | <eClassifiers xsi:type="ecore:EClass" name="Comparison"> | ||
276 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="operator" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
277 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="subOperator" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
278 | <eStructuralFeatures xsi:type="ecore:EReference" name="op2" eType="#//Operands" | ||
279 | containment="true"/> | ||
280 | </eClassifiers> | ||
281 | <eClassifiers xsi:type="ecore:EClass" name="Like"> | ||
282 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="opLike" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
283 | <eStructuralFeatures xsi:type="ecore:EReference" name="op2" eType="#//LikeOperand" | ||
284 | containment="true"/> | ||
285 | </eClassifiers> | ||
286 | <eClassifiers xsi:type="ecore:EClass" name="LikeOperand"> | ||
287 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="op2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
288 | <eStructuralFeatures xsi:type="ecore:EReference" name="fop2" eType="#//OpFunction" | ||
289 | containment="true"/> | ||
290 | <eStructuralFeatures xsi:type="ecore:EReference" name="fcast" eType="#//OpFunctionCast" | ||
291 | containment="true"/> | ||
292 | <eStructuralFeatures xsi:type="ecore:EReference" name="fparam" eType="#//POperand" | ||
293 | containment="true"/> | ||
294 | </eClassifiers> | ||
295 | <eClassifiers xsi:type="ecore:EClass" name="Between"> | ||
296 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="opBetween" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
297 | <eStructuralFeatures xsi:type="ecore:EReference" name="op2" eType="#//Operands" | ||
298 | containment="true"/> | ||
299 | <eStructuralFeatures xsi:type="ecore:EReference" name="op3" eType="#//Operands" | ||
300 | containment="true"/> | ||
301 | </eClassifiers> | ||
302 | <eClassifiers xsi:type="ecore:EClass" name="InOper"> | ||
303 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="op" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
304 | <eStructuralFeatures xsi:type="ecore:EReference" name="subquery" eType="#//SubQueryOperand" | ||
305 | containment="true"/> | ||
306 | <eStructuralFeatures xsi:type="ecore:EReference" name="opList" eType="#//OperandListGroup" | ||
307 | containment="true"/> | ||
308 | </eClassifiers> | ||
309 | <eClassifiers xsi:type="ecore:EClass" name="ExistsOper"> | ||
310 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="op" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
311 | <eStructuralFeatures xsi:type="ecore:EReference" name="subquery" eType="#//SubQueryOperand" | ||
312 | containment="true"/> | ||
313 | <eStructuralFeatures xsi:type="ecore:EReference" name="opList" eType="#//OperandListGroup" | ||
314 | containment="true"/> | ||
315 | </eClassifiers> | ||
316 | <eClassifiers xsi:type="ecore:EClass" name="OperandListGroup"> | ||
317 | <eStructuralFeatures xsi:type="ecore:EReference" name="opGroup" eType="#//OperandList" | ||
318 | containment="true"/> | ||
319 | </eClassifiers> | ||
320 | <eClassifiers xsi:type="ecore:EClass" name="OperandList"/> | ||
321 | <eClassifiers xsi:type="ecore:EClass" name="Operands" eSuperTypes="#//OpFunctionArgAgregate"> | ||
322 | <eStructuralFeatures xsi:type="ecore:EReference" name="op1" eType="#//Operand" | ||
323 | containment="true"/> | ||
324 | <eStructuralFeatures xsi:type="ecore:EReference" name="left" eType="#//Operands" | ||
325 | containment="true"/> | ||
326 | <eStructuralFeatures xsi:type="ecore:EReference" name="right" eType="#//Operand" | ||
327 | containment="true"/> | ||
328 | </eClassifiers> | ||
329 | <eClassifiers xsi:type="ecore:EClass" name="Operand"> | ||
330 | <eStructuralFeatures xsi:type="ecore:EReference" name="column" eType="#//ColumnOperand" | ||
331 | containment="true"/> | ||
332 | <eStructuralFeatures xsi:type="ecore:EReference" name="xop" eType="#//Operand" | ||
333 | containment="true"/> | ||
334 | <eStructuralFeatures xsi:type="ecore:EReference" name="subq" eType="#//SubQueryOperand" | ||
335 | containment="true"/> | ||
336 | <eStructuralFeatures xsi:type="ecore:EReference" name="fcast" eType="#//OpFunctionCast" | ||
337 | containment="true"/> | ||
338 | <eStructuralFeatures xsi:type="ecore:EReference" name="fext" eType="#//FunctionExtract" | ||
339 | containment="true"/> | ||
340 | <eStructuralFeatures xsi:type="ecore:EReference" name="func" eType="#//OpFunction" | ||
341 | containment="true"/> | ||
342 | <eStructuralFeatures xsi:type="ecore:EReference" name="sqlcase" eType="#//SQLCaseOperand" | ||
343 | containment="true"/> | ||
344 | <eStructuralFeatures xsi:type="ecore:EReference" name="param" eType="#//POperand" | ||
345 | containment="true"/> | ||
346 | <eStructuralFeatures xsi:type="ecore:EReference" name="eparam" eType="#//ExpOperand" | ||
347 | containment="true"/> | ||
348 | <eStructuralFeatures xsi:type="ecore:EReference" name="scalar" eType="#//ScalarOperand" | ||
349 | containment="true"/> | ||
350 | </eClassifiers> | ||
351 | <eClassifiers xsi:type="ecore:EClass" name="OpFunction"> | ||
352 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="fname" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
353 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="star" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
354 | <eStructuralFeatures xsi:type="ecore:EReference" name="args" eType="#//OpFunctionArg" | ||
355 | containment="true"/> | ||
356 | <eStructuralFeatures xsi:type="ecore:EReference" name="fan" eType="#//FunctionAnalytical" | ||
357 | containment="true"/> | ||
358 | </eClassifiers> | ||
359 | <eClassifiers xsi:type="ecore:EClass" name="FunctionExtract"> | ||
360 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="v" eType="#//EXTRACT_VALUES"/> | ||
361 | <eStructuralFeatures xsi:type="ecore:EReference" name="operand" eType="#//Operands" | ||
362 | containment="true"/> | ||
363 | </eClassifiers> | ||
364 | <eClassifiers xsi:type="ecore:EClass" name="FunctionAnalytical"> | ||
365 | <eStructuralFeatures xsi:type="ecore:EReference" name="anClause" eType="#//AnalyticClause" | ||
366 | containment="true"/> | ||
367 | </eClassifiers> | ||
368 | <eClassifiers xsi:type="ecore:EClass" name="AnalyticClause"> | ||
369 | <eStructuralFeatures xsi:type="ecore:EReference" name="abc" eType="#//QueryPartitionClause" | ||
370 | containment="true"/> | ||
371 | <eStructuralFeatures xsi:type="ecore:EReference" name="obc" eType="#//OrderByClause" | ||
372 | containment="true"/> | ||
373 | <eStructuralFeatures xsi:type="ecore:EReference" name="winc" eType="#//WindowingClause" | ||
374 | containment="true"/> | ||
375 | </eClassifiers> | ||
376 | <eClassifiers xsi:type="ecore:EClass" name="WindowingClause"/> | ||
377 | <eClassifiers xsi:type="ecore:EClass" name="WindowingClauseBetween" eSuperTypes="#//WindowingClause"> | ||
378 | <eStructuralFeatures xsi:type="ecore:EReference" name="wcoP" eType="#//WindowingClauseOperandPreceding" | ||
379 | containment="true"/> | ||
380 | <eStructuralFeatures xsi:type="ecore:EReference" name="wcoF" eType="#//WindowingClauseOperandFollowing" | ||
381 | containment="true"/> | ||
382 | </eClassifiers> | ||
383 | <eClassifiers xsi:type="ecore:EClass" name="WindowingClauseOperandFollowing"> | ||
384 | <eStructuralFeatures xsi:type="ecore:EReference" name="exp" eType="#//AnalyticExprArg" | ||
385 | containment="true"/> | ||
386 | </eClassifiers> | ||
387 | <eClassifiers xsi:type="ecore:EClass" name="WindowingClauseOperandPreceding" eSuperTypes="#//WindowingClause"> | ||
388 | <eStructuralFeatures xsi:type="ecore:EReference" name="expr" eType="#//AnalyticExprArg" | ||
389 | containment="true"/> | ||
390 | </eClassifiers> | ||
391 | <eClassifiers xsi:type="ecore:EClass" name="OrderByClause"> | ||
392 | <eStructuralFeatures xsi:type="ecore:EReference" name="args" eType="#//OrderByClauseArgs" | ||
393 | containment="true"/> | ||
394 | </eClassifiers> | ||
395 | <eClassifiers xsi:type="ecore:EClass" name="OrderByClauseArgs"/> | ||
396 | <eClassifiers xsi:type="ecore:EClass" name="OrderByClauseArg" eSuperTypes="#//OrderByClauseArgs"> | ||
397 | <eStructuralFeatures xsi:type="ecore:EReference" name="col" eType="#//AnalyticExprArg" | ||
398 | containment="true"/> | ||
399 | </eClassifiers> | ||
400 | <eClassifiers xsi:type="ecore:EClass" name="QueryPartitionClause"> | ||
401 | <eStructuralFeatures xsi:type="ecore:EReference" name="args" eType="#//AnalyticExprArgs" | ||
402 | containment="true"/> | ||
403 | </eClassifiers> | ||
404 | <eClassifiers xsi:type="ecore:EClass" name="AnalyticExprArgs" eSuperTypes="#//QueryPartitionClause"/> | ||
405 | <eClassifiers xsi:type="ecore:EClass" name="AnalyticExprArg" eSuperTypes="#//AnalyticExprArgs"> | ||
406 | <eStructuralFeatures xsi:type="ecore:EReference" name="ce" eType="#//Operands" | ||
407 | containment="true"/> | ||
408 | <eStructuralFeatures xsi:type="ecore:EReference" name="colAlias" eType="#//DbObjectName" | ||
409 | containment="true"/> | ||
410 | </eClassifiers> | ||
411 | <eClassifiers xsi:type="ecore:EClass" name="OpFunctionArg"/> | ||
412 | <eClassifiers xsi:type="ecore:EClass" name="OpFunctionArgOperand" eSuperTypes="#//OpFunctionArg"> | ||
413 | <eStructuralFeatures xsi:type="ecore:EReference" name="op" eType="#//OpFunctionArgAgregate" | ||
414 | containment="true"/> | ||
415 | </eClassifiers> | ||
416 | <eClassifiers xsi:type="ecore:EClass" name="OpFunctionCast"> | ||
417 | <eStructuralFeatures xsi:type="ecore:EReference" name="op" eType="#//Operands" | ||
418 | containment="true"/> | ||
419 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
420 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="p" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
421 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="p2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
422 | </eClassifiers> | ||
423 | <eClassifiers xsi:type="ecore:EClass" name="OpFunctionArgAgregate"/> | ||
424 | <eClassifiers xsi:type="ecore:EClass" name="POperand"> | ||
425 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="prm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
426 | </eClassifiers> | ||
427 | <eClassifiers xsi:type="ecore:EClass" name="ExpOperand"> | ||
428 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="prm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
429 | </eClassifiers> | ||
430 | <eClassifiers xsi:type="ecore:EClass" name="ColumnOperand"> | ||
431 | <eStructuralFeatures xsi:type="ecore:EReference" name="cfull" eType="#//ColumnFull" | ||
432 | containment="true"/> | ||
433 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="ora" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
434 | </eClassifiers> | ||
435 | <eClassifiers xsi:type="ecore:EClass" name="SubQueryOperand"> | ||
436 | <eStructuralFeatures xsi:type="ecore:EReference" name="sel" eType="#//SelectQuery" | ||
437 | containment="true"/> | ||
438 | </eClassifiers> | ||
439 | <eClassifiers xsi:type="ecore:EClass" name="ScalarOperand" eSuperTypes="#//RowValue #//OperandList"> | ||
440 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="sostr" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
441 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="sodbl" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBigDecimal"/> | ||
442 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="sodate" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
443 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="sotime" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
444 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="sodt" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
445 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="soUInt" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
446 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="soint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
447 | </eClassifiers> | ||
448 | <eClassifiers xsi:type="ecore:EClass" name="SQLCaseOperand"> | ||
449 | <eStructuralFeatures xsi:type="ecore:EReference" name="wop" eType="#//Operands" | ||
450 | containment="true"/> | ||
451 | <eStructuralFeatures xsi:type="ecore:EReference" name="expr" eType="#//OrExpr" | ||
452 | containment="true"/> | ||
453 | <eStructuralFeatures xsi:type="ecore:EReference" name="when" eType="#//SQLCaseWhens" | ||
454 | containment="true"/> | ||
455 | </eClassifiers> | ||
456 | <eClassifiers xsi:type="ecore:EClass" name="SQLCaseWhens"/> | ||
457 | <eClassifiers xsi:type="ecore:EClass" name="SqlCaseWhen" eSuperTypes="#//SQLCaseWhens"> | ||
458 | <eStructuralFeatures xsi:type="ecore:EReference" name="wop" eType="#//Operands" | ||
459 | containment="true"/> | ||
460 | <eStructuralFeatures xsi:type="ecore:EReference" name="expr" eType="#//OrExpr" | ||
461 | containment="true"/> | ||
462 | <eStructuralFeatures xsi:type="ecore:EReference" name="texp" eType="#//Operands" | ||
463 | containment="true"/> | ||
464 | <eStructuralFeatures xsi:type="ecore:EReference" name="eexp" eType="#//Operands" | ||
465 | containment="true"/> | ||
466 | </eClassifiers> | ||
467 | <eClassifiers xsi:type="ecore:EEnum" name="EXTRACT_VALUES"> | ||
468 | <eLiterals name="ms" literal="MICROSECOND"/> | ||
469 | <eLiterals name="s" value="1" literal="SECOND"/> | ||
470 | <eLiterals name="m" value="2" literal="MINUTE"/> | ||
471 | <eLiterals name="h" value="3" literal="HOUR"/> | ||
472 | <eLiterals name="day" value="4" literal="DAY"/> | ||
473 | <eLiterals name="week" value="5" literal="WEEK"/> | ||
474 | <eLiterals name="month" value="6" literal="MONTH"/> | ||
475 | <eLiterals name="quart" value="7" literal="QUARTER"/> | ||
476 | <eLiterals name="year" value="8" literal="YEAR"/> | ||
477 | <eLiterals name="micros" value="9" literal="SECOND_MICROSECOND"/> | ||
478 | <eLiterals name="minMicro" value="10" literal="MINUTE_MICROSECOND"/> | ||
479 | <eLiterals name="minSec" value="11" literal="MINUTE_SECOND"/> | ||
480 | <eLiterals name="hms" value="12" literal="HOUR_MICROSECOND"/> | ||
481 | <eLiterals name="hs" value="13" literal="HOUR_SECOND"/> | ||
482 | <eLiterals name="hmin" value="14" literal="HOUR_MINUTE"/> | ||
483 | <eLiterals name="dms" value="15" literal="DAY_MICROSECOND"/> | ||
484 | <eLiterals name="ds" value="16" literal="DAY_SECOND"/> | ||
485 | <eLiterals name="daymin" value="17" literal="DAY_MINUTE"/> | ||
486 | <eLiterals name="dayh" value="18" literal="DAY_HOUR"/> | ||
487 | <eLiterals name="yearMonth" value="19" literal="YEAR_MONTH"/> | ||
488 | </eClassifiers> | ||
489 | <eClassifiers xsi:type="ecore:EClass" name="IntegerValue"> | ||
490 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="integer" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
491 | </eClassifiers> | ||
492 | <eClassifiers xsi:type="ecore:EClass" name="UnsignedValue"> | ||
493 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="integer" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/> | ||
494 | </eClassifiers> | ||
495 | <eClassifiers xsi:type="ecore:EClass" name="Col" eSuperTypes="#//ColumnFull"> | ||
496 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
497 | eType="#//DbObjectName" containment="true"/> | ||
498 | </eClassifiers> | ||
499 | <eClassifiers xsi:type="ecore:EClass" name="abc" eSuperTypes="#//FromValuesColumnNames"> | ||
500 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
501 | eType="#//ColumnNames" containment="true"/> | ||
502 | </eClassifiers> | ||
503 | <eClassifiers xsi:type="ecore:EClass" name="UnipivotInClause" eSuperTypes="#//UnpivotInClause"> | ||
504 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="op" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | ||
505 | <eStructuralFeatures xsi:type="ecore:EReference" name="args" eType="#//UnpivotInClauseArgs" | ||
506 | containment="true"/> | ||
507 | </eClassifiers> | ||
508 | <eClassifiers xsi:type="ecore:EClass" name="uicargs" eSuperTypes="#//UnpivotInClauseArgs"> | ||
509 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
510 | eType="#//UnpivotInClauseArg" containment="true"/> | ||
511 | </eClassifiers> | ||
512 | <eClassifiers xsi:type="ecore:EClass" name="pvcs" eSuperTypes="#//Pivots"> | ||
513 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
514 | eType="#//PivotCol" containment="true"/> | ||
515 | </eClassifiers> | ||
516 | <eClassifiers xsi:type="ecore:EClass" name="pcols" eSuperTypes="#//PivotCol"> | ||
517 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
518 | eType="#//DbObjectName" containment="true"/> | ||
519 | </eClassifiers> | ||
520 | <eClassifiers xsi:type="ecore:EClass" name="tbls" eSuperTypes="#//TableFull"> | ||
521 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
522 | eType="#//DbObjectName" containment="true"/> | ||
523 | </eClassifiers> | ||
524 | <eClassifiers xsi:type="ecore:EClass" name="OpList" eSuperTypes="#//OperandList"> | ||
525 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
526 | eType="#//ScalarOperand" containment="true"/> | ||
527 | </eClassifiers> | ||
528 | <eClassifiers xsi:type="ecore:EClass" name="Plus" eSuperTypes="#//Operands"/> | ||
529 | <eClassifiers xsi:type="ecore:EClass" name="Minus" eSuperTypes="#//Operands"/> | ||
530 | <eClassifiers xsi:type="ecore:EClass" name="Concat" eSuperTypes="#//Operands"/> | ||
531 | <eClassifiers xsi:type="ecore:EClass" name="Multiply" eSuperTypes="#//Operands"/> | ||
532 | <eClassifiers xsi:type="ecore:EClass" name="Division" eSuperTypes="#//Operands"/> | ||
533 | <eClassifiers xsi:type="ecore:EClass" name="OBCArgs" eSuperTypes="#//OrderByClauseArgs"> | ||
534 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
535 | eType="#//OrderByClauseArg" containment="true"/> | ||
536 | </eClassifiers> | ||
537 | <eClassifiers xsi:type="ecore:EClass" name="AExpArgs" eSuperTypes="#//AnalyticExprArgs"> | ||
538 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
539 | eType="#//AnalyticExprArg" containment="true"/> | ||
540 | </eClassifiers> | ||
541 | <eClassifiers xsi:type="ecore:EClass" name="OpFList" eSuperTypes="#//OpFunctionArg"> | ||
542 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
543 | eType="#//OpFunctionArgOperand" containment="true"/> | ||
544 | </eClassifiers> | ||
545 | <eClassifiers xsi:type="ecore:EClass" name="WhenList" eSuperTypes="#//SQLCaseWhens"> | ||
546 | <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1" | ||
547 | eType="#//SqlCaseWhen" containment="true"/> | ||
548 | </eClassifiers> | ||
549 | </ecore:EPackage> | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/mpc_rep.csv b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/mpc_rep.csv index fc39ac54..fc39ac54 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/mpc_rep.csv +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/mpc_rep.csv | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/old/mpc_rep/R_2016324.xmi b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/mpc_rep/R_2016324.xmi index 493a1731..493a1731 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/old/mpc_rep/R_2016324.xmi +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/mpc_rep/R_2016324.xmi | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/na_rep.csv b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/na_rep.csv index 43d411e4..43d411e4 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/na_rep.csv +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/na_rep.csv | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/old/na_rep/R_2017419.xmi b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/na_rep/R_2017419.xmi index 369760bf..369760bf 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/old/na_rep/R_2017419.xmi +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/na_rep/R_2017419.xmi | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/mpc_rep/R_2015194.xmi b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/new/mpc_rep/R_2015194.xmi index 25ff5ce0..25ff5ce0 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/mpc_rep/R_2015194.xmi +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/new/mpc_rep/R_2015194.xmi | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/na_rep/R_2017131.xmi b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/new/na_rep/R_2017131.xmi index 39780f72..39780f72 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/na_rep/R_2017131.xmi +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/new/na_rep/R_2017131.xmi | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/out_d_rep/R_2015248.xmi b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/new/out_d_rep/R_2015248.xmi index e7fe8114..e7fe8114 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/out_d_rep/R_2015248.xmi +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/new/out_d_rep/R_2015248.xmi | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/out_d_rep.csv b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/out_d_rep.csv index 17965018..17965018 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/out_d_rep.csv +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/out_d_rep.csv | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/old/out_d_rep/R_2015225.xmi b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/out_d_rep/R_2015225.xmi index 21fee5a9..21fee5a9 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakinduum/old/out_d_rep/R_2015225.xmi +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Yakindumm/out_d_rep/R_2015225.xmi | |||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/debug/errors.txt b/Metrics/Metrics-Calculation/SocialNetwork_plugin/debug/errors.txt new file mode 100644 index 00000000..e4925b3c --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/debug/errors.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | Error occured (IllegalArgumentException): Class EObject is not translated to logic! | ||
2 | hu.bme.mit.inf.dslreasoner.ecore2logic.EClassMapper_AllElementAsObject.TypeofEClass(EClassMapper_AllElementAsObject.java:63) | ||
3 | hu.bme.mit.inf.dslreasoner.ecore2logic.EReferenceMapper_RelationsOverTypes.createIndicatorDeclarations(EReferenceMapper_RelationsOverTypes.java:88) | ||
4 | hu.bme.mit.inf.dslreasoner.ecore2logic.EReferenceMapper_RelationsOverTypes.transformEReferences(EReferenceMapper_RelationsOverTypes.java:67) | ||
5 | hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic.transformEReferences(Ecore2Logic.java:120) | ||
6 | hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic.transformMetamodel(Ecore2Logic.java:81) | ||
7 | hu.bme.mit.inf.dslreasoner.application.execution.GenerationTaskExecutor.executeGenerationTask(GenerationTaskExecutor.java:189) | ||
8 | hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor._execute(ScriptExecutor.java:129) | ||
9 | hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.execute(ScriptExecutor.java:338) | ||
10 | hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.executeScript(ScriptExecutor.java:110) | ||
11 | hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor.executeScript(StandaloneScriptExecutor.java:149) | ||
12 | ca.mcgill.ecse.socialnetwork.runner.Main.runWithPath(Main.java:25) | ||
13 | ca.mcgill.ecse.socialnetwork.runner.Main.main(Main.java:38) | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig b/Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig index 2c83f94f..7da4f563 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | import viatra "./queries/queries/ecore_pattern.vql" | 1 | import viatra "./queries/queries/Ecore.vql" |
2 | import epackage "http://www.eclipse.org/emf/2002/Ecore" | 2 | import epackage "http://www.eclipse.org/emf/2002/Ecore" |
3 | 3 | ||
4 | generate { | 4 | generate { |
@@ -7,12 +7,20 @@ generate { | |||
7 | EStructuralFeature.derived, ENamedElement.name, EClass.interface, EClass.abstract, EClassifier.instanceTypeName, | 7 | EStructuralFeature.derived, ENamedElement.name, EClass.interface, EClass.abstract, EClassifier.instanceTypeName, |
8 | EClassifier.instanceClassName, EPackage.nsPrefix, EPackage.nsURI, EAnnotation.source, | 8 | EClassifier.instanceClassName, EPackage.nsPrefix, EPackage.nsURI, EAnnotation.source, |
9 | EAttribute.iD, EDataType.serializable, EEnumLiteral.literal, EEnumLiteral.value, | 9 | EAttribute.iD, EDataType.serializable, EEnumLiteral.literal, EEnumLiteral.value, |
10 | EGenericType.eTypeParameter, EReference.resolveProxies, EStringToStringMapEntry.key, | 10 | EReference.resolveProxies, EReference.container, EReference.containment, EStringToStringMapEntry.key, |
11 | EStringToStringMapEntry.value, EStructuralFeature.defaultValueLiteral, EStructuralFeature.transient, | 11 | EStringToStringMapEntry.value, EStructuralFeature.defaultValueLiteral, EStructuralFeature.transient, |
12 | EStructuralFeature.unsettable, EStructuralFeature.volatile, ETypedElement.lowerBound, | 12 | EStructuralFeature.unsettable, EStructuralFeature.volatile, ETypedElement.lowerBound, |
13 | ETypedElement.many, ETypedElement.ordered, ETypedElement.required, ETypedElement.unique,ETypedElement.upperBound, | 13 | ETypedElement.many, ETypedElement.ordered, ETypedElement.required, ETypedElement.unique,ETypedElement.upperBound, |
14 | EPackage.eFactoryInstance}} | 14 | // cannot generate eFactoryInstance |
15 | // metamodel = {EPackage, EClass, EClassifier, EObject, ENamedElement, EModelElement, EReference, EStructuralFeature, ETypedElement} | 15 | EPackage.eFactoryInstance, |
16 | //Derived edges | ||
17 | EClass.eAllSuperTypes, EClass.eAllAttributes, EClass.eAllReferences, EClass.eAllContainments, EClass.eAllGenericSuperTypes, | ||
18 | EClass. eAllOperations, EClass.eAllStructuralFeatures, EClass.eAttributes, EClass.eIDAttribute, EClass.eReferences, | ||
19 | EAttribute.eAttributeType, EGenericType.eRawType, EReference.eReferenceType, | ||
20 | //Generic Types | ||
21 | EClass.eGenericSuperTypes, ETypedElement.eGenericType, EOperation.eGenericExceptions, EObject, EAnnotation.references, EAnnotation.contents | ||
22 | |||
23 | }} | ||
16 | partial-model = { "inputs/ecore.xmi"} | 24 | partial-model = { "inputs/ecore.xmi"} |
17 | constraints = { package queries } | 25 | constraints = { package queries } |
18 | 26 | ||
@@ -20,13 +28,17 @@ generate { | |||
20 | solver = ViatraSolver | 28 | solver = ViatraSolver |
21 | 29 | ||
22 | scope = { | 30 | scope = { |
23 | #node = 75 | 31 | #node = 100 |
24 | } | 32 | } |
25 | 33 | ||
26 | number = 1 | 34 | number = 1 |
27 | runs = 50 | 35 | runs = 1 |
28 | config = { | 36 | config = { |
29 | log-level = none | 37 | log-level = none, |
38 | "optional-wf" = "true", | ||
39 | "realistic-guidance" = "Composite", | ||
40 | "allow-must-violations" = "true", | ||
41 | "domain" = "Ecore" | ||
30 | } | 42 | } |
31 | 43 | ||
32 | debug = "debug" | 44 | debug = "debug" |
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml b/Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml index 6ac719c8..975fd574 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml | |||
@@ -12,6 +12,15 @@ | |||
12 | <query-specification fqn="ca.mcgill.ecse.socialnetwork.plugin.friendship"/> | 12 | <query-specification fqn="ca.mcgill.ecse.socialnetwork.plugin.friendship"/> |
13 | </group> | 13 | </group> |
14 | </extension> | 14 | </extension> |
15 | <extension id="queries.Ecore" point="org.eclipse.viatra.query.runtime.queryspecification"> | ||
16 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.Ecore" id="queries.Ecore"> | ||
17 | <query-specification fqn="queries.directSupertype"/> | ||
18 | <query-specification fqn="queries.loopInInheritence"/> | ||
19 | <query-specification fqn="queries.opposite"/> | ||
20 | <query-specification fqn="queries.oppositeDifferentClass"/> | ||
21 | <query-specification fqn="queries.nonSymmetricOpposite"/> | ||
22 | </group> | ||
23 | </extension> | ||
15 | <extension id="queries.Ecore_pattern" point="org.eclipse.viatra.query.runtime.queryspecification"> | 24 | <extension id="queries.Ecore_pattern" point="org.eclipse.viatra.query.runtime.queryspecification"> |
16 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.Ecore_pattern" id="queries.Ecore_pattern"> | 25 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.Ecore_pattern" id="queries.Ecore_pattern"> |
17 | <query-specification fqn="queries.sameSuperClass"/> | 26 | <query-specification fqn="queries.sameSuperClass"/> |
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/Ecore.vql b/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/Ecore.vql new file mode 100644 index 00000000..3b0e7fd9 --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/Ecore.vql | |||
@@ -0,0 +1,29 @@ | |||
1 | package queries | ||
2 | |||
3 | import epackage "http://www.eclipse.org/emf/2002/Ecore" | ||
4 | |||
5 | pattern directSupertype(a: EClass, b:EClass) { | ||
6 | EClass.eSuperTypes(a,b); | ||
7 | } | ||
8 | |||
9 | @Constraint(key={a}, severity="error", message="error") | ||
10 | pattern loopInInheritence(a: EClass) { | ||
11 | find directSupertype+(a,a); | ||
12 | } | ||
13 | |||
14 | pattern opposite(a:EReference, b: EReference) { | ||
15 | EReference.eOpposite(a,b); | ||
16 | } | ||
17 | @Constraint(key={a}, severity="error", message="error") | ||
18 | pattern oppositeDifferentClass(a:EReference) { | ||
19 | EReference.eOpposite(a,b); | ||
20 | EReference.eContainingClass(a,aContaining); | ||
21 | EReference.eType(b,bTarget); | ||
22 | aContaining != bTarget; | ||
23 | } | ||
24 | |||
25 | @Constraint(key={a}, severity="error", message="error") | ||
26 | pattern nonSymmetricOpposite(a:EReference, b:EReference) { | ||
27 | find opposite(a,b); | ||
28 | neg find opposite(b,a); | ||
29 | } \ No newline at end of file | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore index 121edf31..9ceca817 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore | |||
@@ -1,3 +1,9 @@ | |||
1 | /.Ecore_pattern.java._trace | 1 | /.Ecore_pattern.java._trace |
2 | /.MultipleTransitionFromEntry.java._trace | 2 | /.MultipleTransitionFromEntry.java._trace |
3 | /.SameSuperClass.java._trace | 3 | /.SameSuperClass.java._trace |
4 | /.DirectSupertype.java._trace | ||
5 | /.Ecore.java._trace | ||
6 | /.LoopInInheritence.java._trace | ||
7 | /.NonSymmetricOpposite.java._trace | ||
8 | /.Opposite.java._trace | ||
9 | /.OppositeDifferentClass.java._trace | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/DirectSupertype.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/DirectSupertype.java new file mode 100644 index 00000000..003dbe3f --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/DirectSupertype.java | |||
@@ -0,0 +1,692 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/Ecore.vql | ||
3 | */ | ||
4 | package queries; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import org.apache.log4j.Logger; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
21 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
25 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
38 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
39 | |||
40 | /** | ||
41 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
42 | * | ||
43 | * <p>Original source: | ||
44 | * <code><pre> | ||
45 | * pattern directSupertype(a: EClass, b:EClass) { | ||
46 | * EClass.eSuperTypes(a,b); | ||
47 | * } | ||
48 | * </pre></code> | ||
49 | * | ||
50 | * @see Matcher | ||
51 | * @see Match | ||
52 | * | ||
53 | */ | ||
54 | @SuppressWarnings("all") | ||
55 | public final class DirectSupertype extends BaseGeneratedEMFQuerySpecification<DirectSupertype.Matcher> { | ||
56 | /** | ||
57 | * Pattern-specific match representation of the queries.directSupertype pattern, | ||
58 | * to be used in conjunction with {@link Matcher}. | ||
59 | * | ||
60 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
61 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
62 | * usable to represent a match of the pattern in the result of a query, | ||
63 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
64 | * | ||
65 | * @see Matcher | ||
66 | * | ||
67 | */ | ||
68 | public static abstract class Match extends BasePatternMatch { | ||
69 | private EClass fA; | ||
70 | |||
71 | private EClass fB; | ||
72 | |||
73 | private static List<String> parameterNames = makeImmutableList("a", "b"); | ||
74 | |||
75 | private Match(final EClass pA, final EClass pB) { | ||
76 | this.fA = pA; | ||
77 | this.fB = pB; | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public Object get(final String parameterName) { | ||
82 | if ("a".equals(parameterName)) return this.fA; | ||
83 | if ("b".equals(parameterName)) return this.fB; | ||
84 | return null; | ||
85 | } | ||
86 | |||
87 | public EClass getA() { | ||
88 | return this.fA; | ||
89 | } | ||
90 | |||
91 | public EClass getB() { | ||
92 | return this.fB; | ||
93 | } | ||
94 | |||
95 | @Override | ||
96 | public boolean set(final String parameterName, final Object newValue) { | ||
97 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
98 | if ("a".equals(parameterName) ) { | ||
99 | this.fA = (EClass) newValue; | ||
100 | return true; | ||
101 | } | ||
102 | if ("b".equals(parameterName) ) { | ||
103 | this.fB = (EClass) newValue; | ||
104 | return true; | ||
105 | } | ||
106 | return false; | ||
107 | } | ||
108 | |||
109 | public void setA(final EClass pA) { | ||
110 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
111 | this.fA = pA; | ||
112 | } | ||
113 | |||
114 | public void setB(final EClass pB) { | ||
115 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
116 | this.fB = pB; | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public String patternName() { | ||
121 | return "queries.directSupertype"; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public List<String> parameterNames() { | ||
126 | return DirectSupertype.Match.parameterNames; | ||
127 | } | ||
128 | |||
129 | @Override | ||
130 | public Object[] toArray() { | ||
131 | return new Object[]{fA, fB}; | ||
132 | } | ||
133 | |||
134 | @Override | ||
135 | public DirectSupertype.Match toImmutable() { | ||
136 | return isMutable() ? newMatch(fA, fB) : this; | ||
137 | } | ||
138 | |||
139 | @Override | ||
140 | public String prettyPrint() { | ||
141 | StringBuilder result = new StringBuilder(); | ||
142 | result.append("\"a\"=" + prettyPrintValue(fA) + ", "); | ||
143 | result.append("\"b\"=" + prettyPrintValue(fB)); | ||
144 | return result.toString(); | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | public int hashCode() { | ||
149 | return Objects.hash(fA, fB); | ||
150 | } | ||
151 | |||
152 | @Override | ||
153 | public boolean equals(final Object obj) { | ||
154 | if (this == obj) | ||
155 | return true; | ||
156 | if (obj == null) { | ||
157 | return false; | ||
158 | } | ||
159 | if ((obj instanceof DirectSupertype.Match)) { | ||
160 | DirectSupertype.Match other = (DirectSupertype.Match) obj; | ||
161 | return Objects.equals(fA, other.fA) && Objects.equals(fB, other.fB); | ||
162 | } else { | ||
163 | // this should be infrequent | ||
164 | if (!(obj instanceof IPatternMatch)) { | ||
165 | return false; | ||
166 | } | ||
167 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
168 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | @Override | ||
173 | public DirectSupertype specification() { | ||
174 | return DirectSupertype.instance(); | ||
175 | } | ||
176 | |||
177 | /** | ||
178 | * Returns an empty, mutable match. | ||
179 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
180 | * | ||
181 | * @return the empty match. | ||
182 | * | ||
183 | */ | ||
184 | public static DirectSupertype.Match newEmptyMatch() { | ||
185 | return new Mutable(null, null); | ||
186 | } | ||
187 | |||
188 | /** | ||
189 | * Returns a mutable (partial) match. | ||
190 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
191 | * | ||
192 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
193 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
194 | * @return the new, mutable (partial) match object. | ||
195 | * | ||
196 | */ | ||
197 | public static DirectSupertype.Match newMutableMatch(final EClass pA, final EClass pB) { | ||
198 | return new Mutable(pA, pB); | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * Returns a new (partial) match. | ||
203 | * This can be used e.g. to call the matcher with a partial match. | ||
204 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
205 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
206 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
207 | * @return the (partial) match object. | ||
208 | * | ||
209 | */ | ||
210 | public static DirectSupertype.Match newMatch(final EClass pA, final EClass pB) { | ||
211 | return new Immutable(pA, pB); | ||
212 | } | ||
213 | |||
214 | private static final class Mutable extends DirectSupertype.Match { | ||
215 | Mutable(final EClass pA, final EClass pB) { | ||
216 | super(pA, pB); | ||
217 | } | ||
218 | |||
219 | @Override | ||
220 | public boolean isMutable() { | ||
221 | return true; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | private static final class Immutable extends DirectSupertype.Match { | ||
226 | Immutable(final EClass pA, final EClass pB) { | ||
227 | super(pA, pB); | ||
228 | } | ||
229 | |||
230 | @Override | ||
231 | public boolean isMutable() { | ||
232 | return false; | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | /** | ||
238 | * Generated pattern matcher API of the queries.directSupertype pattern, | ||
239 | * providing pattern-specific query methods. | ||
240 | * | ||
241 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
242 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
243 | * | ||
244 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
245 | * | ||
246 | * <p>Original source: | ||
247 | * <code><pre> | ||
248 | * pattern directSupertype(a: EClass, b:EClass) { | ||
249 | * EClass.eSuperTypes(a,b); | ||
250 | * } | ||
251 | * </pre></code> | ||
252 | * | ||
253 | * @see Match | ||
254 | * @see DirectSupertype | ||
255 | * | ||
256 | */ | ||
257 | public static class Matcher extends BaseMatcher<DirectSupertype.Match> { | ||
258 | /** | ||
259 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
260 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
261 | * | ||
262 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
263 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
264 | * | ||
265 | */ | ||
266 | public static DirectSupertype.Matcher on(final ViatraQueryEngine engine) { | ||
267 | // check if matcher already exists | ||
268 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
269 | if (matcher == null) { | ||
270 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
271 | } | ||
272 | return matcher; | ||
273 | } | ||
274 | |||
275 | /** | ||
276 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
277 | * @return an initialized matcher | ||
278 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
279 | * | ||
280 | */ | ||
281 | public static DirectSupertype.Matcher create() { | ||
282 | return new Matcher(); | ||
283 | } | ||
284 | |||
285 | private static final int POSITION_A = 0; | ||
286 | |||
287 | private static final int POSITION_B = 1; | ||
288 | |||
289 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(DirectSupertype.Matcher.class); | ||
290 | |||
291 | /** | ||
292 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
293 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
294 | * | ||
295 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
296 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
297 | * | ||
298 | */ | ||
299 | private Matcher() { | ||
300 | super(querySpecification()); | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
305 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
306 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
307 | * @return matches represented as a Match object. | ||
308 | * | ||
309 | */ | ||
310 | public Collection<DirectSupertype.Match> getAllMatches(final EClass pA, final EClass pB) { | ||
311 | return rawStreamAllMatches(new Object[]{pA, pB}).collect(Collectors.toSet()); | ||
312 | } | ||
313 | |||
314 | /** | ||
315 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
316 | * </p> | ||
317 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
318 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
319 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
320 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
321 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
322 | * @return a stream of matches represented as a Match object. | ||
323 | * | ||
324 | */ | ||
325 | public Stream<DirectSupertype.Match> streamAllMatches(final EClass pA, final EClass pB) { | ||
326 | return rawStreamAllMatches(new Object[]{pA, pB}); | ||
327 | } | ||
328 | |||
329 | /** | ||
330 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
331 | * Neither determinism nor randomness of selection is guaranteed. | ||
332 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
333 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
334 | * @return a match represented as a Match object, or null if no match is found. | ||
335 | * | ||
336 | */ | ||
337 | public Optional<DirectSupertype.Match> getOneArbitraryMatch(final EClass pA, final EClass pB) { | ||
338 | return rawGetOneArbitraryMatch(new Object[]{pA, pB}); | ||
339 | } | ||
340 | |||
341 | /** | ||
342 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
343 | * under any possible substitution of the unspecified parameters (if any). | ||
344 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
345 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
346 | * @return true if the input is a valid (partial) match of the pattern. | ||
347 | * | ||
348 | */ | ||
349 | public boolean hasMatch(final EClass pA, final EClass pB) { | ||
350 | return rawHasMatch(new Object[]{pA, pB}); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
355 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
356 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
357 | * @return the number of pattern matches found. | ||
358 | * | ||
359 | */ | ||
360 | public int countMatches(final EClass pA, final EClass pB) { | ||
361 | return rawCountMatches(new Object[]{pA, pB}); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
366 | * Neither determinism nor randomness of selection is guaranteed. | ||
367 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
368 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
369 | * @param processor the action that will process the selected match. | ||
370 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
371 | * | ||
372 | */ | ||
373 | public boolean forOneArbitraryMatch(final EClass pA, final EClass pB, final Consumer<? super DirectSupertype.Match> processor) { | ||
374 | return rawForOneArbitraryMatch(new Object[]{pA, pB}, processor); | ||
375 | } | ||
376 | |||
377 | /** | ||
378 | * Returns a new (partial) match. | ||
379 | * This can be used e.g. to call the matcher with a partial match. | ||
380 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
381 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
382 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
383 | * @return the (partial) match object. | ||
384 | * | ||
385 | */ | ||
386 | public DirectSupertype.Match newMatch(final EClass pA, final EClass pB) { | ||
387 | return DirectSupertype.Match.newMatch(pA, pB); | ||
388 | } | ||
389 | |||
390 | /** | ||
391 | * Retrieve the set of values that occur in matches for a. | ||
392 | * @return the Set of all values or empty set if there are no matches | ||
393 | * | ||
394 | */ | ||
395 | protected Stream<EClass> rawStreamAllValuesOfa(final Object[] parameters) { | ||
396 | return rawStreamAllValues(POSITION_A, parameters).map(EClass.class::cast); | ||
397 | } | ||
398 | |||
399 | /** | ||
400 | * Retrieve the set of values that occur in matches for a. | ||
401 | * @return the Set of all values or empty set if there are no matches | ||
402 | * | ||
403 | */ | ||
404 | public Set<EClass> getAllValuesOfa() { | ||
405 | return rawStreamAllValuesOfa(emptyArray()).collect(Collectors.toSet()); | ||
406 | } | ||
407 | |||
408 | /** | ||
409 | * Retrieve the set of values that occur in matches for a. | ||
410 | * @return the Set of all values or empty set if there are no matches | ||
411 | * | ||
412 | */ | ||
413 | public Stream<EClass> streamAllValuesOfa() { | ||
414 | return rawStreamAllValuesOfa(emptyArray()); | ||
415 | } | ||
416 | |||
417 | /** | ||
418 | * Retrieve the set of values that occur in matches for a. | ||
419 | * </p> | ||
420 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
421 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
422 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
423 | * | ||
424 | * @return the Stream of all values or empty set if there are no matches | ||
425 | * | ||
426 | */ | ||
427 | public Stream<EClass> streamAllValuesOfa(final DirectSupertype.Match partialMatch) { | ||
428 | return rawStreamAllValuesOfa(partialMatch.toArray()); | ||
429 | } | ||
430 | |||
431 | /** | ||
432 | * Retrieve the set of values that occur in matches for a. | ||
433 | * </p> | ||
434 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
435 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
436 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
437 | * | ||
438 | * @return the Stream of all values or empty set if there are no matches | ||
439 | * | ||
440 | */ | ||
441 | public Stream<EClass> streamAllValuesOfa(final EClass pB) { | ||
442 | return rawStreamAllValuesOfa(new Object[]{null, pB}); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * Retrieve the set of values that occur in matches for a. | ||
447 | * @return the Set of all values or empty set if there are no matches | ||
448 | * | ||
449 | */ | ||
450 | public Set<EClass> getAllValuesOfa(final DirectSupertype.Match partialMatch) { | ||
451 | return rawStreamAllValuesOfa(partialMatch.toArray()).collect(Collectors.toSet()); | ||
452 | } | ||
453 | |||
454 | /** | ||
455 | * Retrieve the set of values that occur in matches for a. | ||
456 | * @return the Set of all values or empty set if there are no matches | ||
457 | * | ||
458 | */ | ||
459 | public Set<EClass> getAllValuesOfa(final EClass pB) { | ||
460 | return rawStreamAllValuesOfa(new Object[]{null, pB}).collect(Collectors.toSet()); | ||
461 | } | ||
462 | |||
463 | /** | ||
464 | * Retrieve the set of values that occur in matches for b. | ||
465 | * @return the Set of all values or empty set if there are no matches | ||
466 | * | ||
467 | */ | ||
468 | protected Stream<EClass> rawStreamAllValuesOfb(final Object[] parameters) { | ||
469 | return rawStreamAllValues(POSITION_B, parameters).map(EClass.class::cast); | ||
470 | } | ||
471 | |||
472 | /** | ||
473 | * Retrieve the set of values that occur in matches for b. | ||
474 | * @return the Set of all values or empty set if there are no matches | ||
475 | * | ||
476 | */ | ||
477 | public Set<EClass> getAllValuesOfb() { | ||
478 | return rawStreamAllValuesOfb(emptyArray()).collect(Collectors.toSet()); | ||
479 | } | ||
480 | |||
481 | /** | ||
482 | * Retrieve the set of values that occur in matches for b. | ||
483 | * @return the Set of all values or empty set if there are no matches | ||
484 | * | ||
485 | */ | ||
486 | public Stream<EClass> streamAllValuesOfb() { | ||
487 | return rawStreamAllValuesOfb(emptyArray()); | ||
488 | } | ||
489 | |||
490 | /** | ||
491 | * Retrieve the set of values that occur in matches for b. | ||
492 | * </p> | ||
493 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
494 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
495 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
496 | * | ||
497 | * @return the Stream of all values or empty set if there are no matches | ||
498 | * | ||
499 | */ | ||
500 | public Stream<EClass> streamAllValuesOfb(final DirectSupertype.Match partialMatch) { | ||
501 | return rawStreamAllValuesOfb(partialMatch.toArray()); | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * Retrieve the set of values that occur in matches for b. | ||
506 | * </p> | ||
507 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
508 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
509 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
510 | * | ||
511 | * @return the Stream of all values or empty set if there are no matches | ||
512 | * | ||
513 | */ | ||
514 | public Stream<EClass> streamAllValuesOfb(final EClass pA) { | ||
515 | return rawStreamAllValuesOfb(new Object[]{pA, null}); | ||
516 | } | ||
517 | |||
518 | /** | ||
519 | * Retrieve the set of values that occur in matches for b. | ||
520 | * @return the Set of all values or empty set if there are no matches | ||
521 | * | ||
522 | */ | ||
523 | public Set<EClass> getAllValuesOfb(final DirectSupertype.Match partialMatch) { | ||
524 | return rawStreamAllValuesOfb(partialMatch.toArray()).collect(Collectors.toSet()); | ||
525 | } | ||
526 | |||
527 | /** | ||
528 | * Retrieve the set of values that occur in matches for b. | ||
529 | * @return the Set of all values or empty set if there are no matches | ||
530 | * | ||
531 | */ | ||
532 | public Set<EClass> getAllValuesOfb(final EClass pA) { | ||
533 | return rawStreamAllValuesOfb(new Object[]{pA, null}).collect(Collectors.toSet()); | ||
534 | } | ||
535 | |||
536 | @Override | ||
537 | protected DirectSupertype.Match tupleToMatch(final Tuple t) { | ||
538 | try { | ||
539 | return DirectSupertype.Match.newMatch((EClass) t.get(POSITION_A), (EClass) t.get(POSITION_B)); | ||
540 | } catch(ClassCastException e) { | ||
541 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
542 | return null; | ||
543 | } | ||
544 | } | ||
545 | |||
546 | @Override | ||
547 | protected DirectSupertype.Match arrayToMatch(final Object[] match) { | ||
548 | try { | ||
549 | return DirectSupertype.Match.newMatch((EClass) match[POSITION_A], (EClass) match[POSITION_B]); | ||
550 | } catch(ClassCastException e) { | ||
551 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
552 | return null; | ||
553 | } | ||
554 | } | ||
555 | |||
556 | @Override | ||
557 | protected DirectSupertype.Match arrayToMatchMutable(final Object[] match) { | ||
558 | try { | ||
559 | return DirectSupertype.Match.newMutableMatch((EClass) match[POSITION_A], (EClass) match[POSITION_B]); | ||
560 | } catch(ClassCastException e) { | ||
561 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
562 | return null; | ||
563 | } | ||
564 | } | ||
565 | |||
566 | /** | ||
567 | * @return the singleton instance of the query specification of this pattern | ||
568 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
569 | * | ||
570 | */ | ||
571 | public static IQuerySpecification<DirectSupertype.Matcher> querySpecification() { | ||
572 | return DirectSupertype.instance(); | ||
573 | } | ||
574 | } | ||
575 | |||
576 | private DirectSupertype() { | ||
577 | super(GeneratedPQuery.INSTANCE); | ||
578 | } | ||
579 | |||
580 | /** | ||
581 | * @return the singleton instance of the query specification | ||
582 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
583 | * | ||
584 | */ | ||
585 | public static DirectSupertype instance() { | ||
586 | try{ | ||
587 | return LazyHolder.INSTANCE; | ||
588 | } catch (ExceptionInInitializerError err) { | ||
589 | throw processInitializerError(err); | ||
590 | } | ||
591 | } | ||
592 | |||
593 | @Override | ||
594 | protected DirectSupertype.Matcher instantiate(final ViatraQueryEngine engine) { | ||
595 | return DirectSupertype.Matcher.on(engine); | ||
596 | } | ||
597 | |||
598 | @Override | ||
599 | public DirectSupertype.Matcher instantiate() { | ||
600 | return DirectSupertype.Matcher.create(); | ||
601 | } | ||
602 | |||
603 | @Override | ||
604 | public DirectSupertype.Match newEmptyMatch() { | ||
605 | return DirectSupertype.Match.newEmptyMatch(); | ||
606 | } | ||
607 | |||
608 | @Override | ||
609 | public DirectSupertype.Match newMatch(final Object... parameters) { | ||
610 | return DirectSupertype.Match.newMatch((org.eclipse.emf.ecore.EClass) parameters[0], (org.eclipse.emf.ecore.EClass) parameters[1]); | ||
611 | } | ||
612 | |||
613 | /** | ||
614 | * Inner class allowing the singleton instance of {@link JvmGenericType: queries.DirectSupertype (visibility: PUBLIC, simpleName: DirectSupertype, identifier: queries.DirectSupertype, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
615 | * <b>not</b> at the class load time of the outer class, | ||
616 | * but rather at the first call to {@link JvmGenericType: queries.DirectSupertype (visibility: PUBLIC, simpleName: DirectSupertype, identifier: queries.DirectSupertype, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
617 | * | ||
618 | * <p> This workaround is required e.g. to support recursion. | ||
619 | * | ||
620 | */ | ||
621 | private static class LazyHolder { | ||
622 | private static final DirectSupertype INSTANCE = new DirectSupertype(); | ||
623 | |||
624 | /** | ||
625 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
626 | * This initialization order is required to support indirect recursion. | ||
627 | * | ||
628 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
629 | * | ||
630 | */ | ||
631 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
632 | |||
633 | public static Object ensureInitialized() { | ||
634 | INSTANCE.ensureInitializedInternal(); | ||
635 | return null; | ||
636 | } | ||
637 | } | ||
638 | |||
639 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
640 | private static final DirectSupertype.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
641 | |||
642 | private final PParameter parameter_a = new PParameter("a", "org.eclipse.emf.ecore.EClass", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EClass")), PParameterDirection.INOUT); | ||
643 | |||
644 | private final PParameter parameter_b = new PParameter("b", "org.eclipse.emf.ecore.EClass", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EClass")), PParameterDirection.INOUT); | ||
645 | |||
646 | private final List<PParameter> parameters = Arrays.asList(parameter_a, parameter_b); | ||
647 | |||
648 | private GeneratedPQuery() { | ||
649 | super(PVisibility.PUBLIC); | ||
650 | } | ||
651 | |||
652 | @Override | ||
653 | public String getFullyQualifiedName() { | ||
654 | return "queries.directSupertype"; | ||
655 | } | ||
656 | |||
657 | @Override | ||
658 | public List<String> getParameterNames() { | ||
659 | return Arrays.asList("a","b"); | ||
660 | } | ||
661 | |||
662 | @Override | ||
663 | public List<PParameter> getParameters() { | ||
664 | return parameters; | ||
665 | } | ||
666 | |||
667 | @Override | ||
668 | public Set<PBody> doGetContainedBodies() { | ||
669 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
670 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
671 | { | ||
672 | PBody body = new PBody(this); | ||
673 | PVariable var_a = body.getOrCreateVariableByName("a"); | ||
674 | PVariable var_b = body.getOrCreateVariableByName("b"); | ||
675 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass"))); | ||
676 | new TypeConstraint(body, Tuples.flatTupleOf(var_b), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass"))); | ||
677 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
678 | new ExportedParameter(body, var_a, parameter_a), | ||
679 | new ExportedParameter(body, var_b, parameter_b) | ||
680 | )); | ||
681 | // EClass.eSuperTypes(a,b) | ||
682 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass"))); | ||
683 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
684 | new TypeConstraint(body, Tuples.flatTupleOf(var_a, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass", "eSuperTypes"))); | ||
685 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass"))); | ||
686 | new Equality(body, var__virtual_0_, var_b); | ||
687 | bodies.add(body); | ||
688 | } | ||
689 | return bodies; | ||
690 | } | ||
691 | } | ||
692 | } | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore.java new file mode 100644 index 00000000..e4f254d3 --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore.java | |||
@@ -0,0 +1,97 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/Ecore.vql | ||
3 | */ | ||
4 | package queries; | ||
5 | |||
6 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
7 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | ||
8 | import queries.DirectSupertype; | ||
9 | import queries.LoopInInheritence; | ||
10 | import queries.NonSymmetricOpposite; | ||
11 | import queries.Opposite; | ||
12 | import queries.OppositeDifferentClass; | ||
13 | |||
14 | /** | ||
15 | * A pattern group formed of all public patterns defined in Ecore.vql. | ||
16 | * | ||
17 | * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare | ||
18 | * a VIATRA Query engine for matching all patterns originally defined in file Ecore.vql, | ||
19 | * in order to achieve better performance than one-by-one on-demand matcher initialization. | ||
20 | * | ||
21 | * <p> From package queries, the group contains the definition of the following patterns: <ul> | ||
22 | * <li>directSupertype</li> | ||
23 | * <li>loopInInheritence</li> | ||
24 | * <li>opposite</li> | ||
25 | * <li>oppositeDifferentClass</li> | ||
26 | * <li>nonSymmetricOpposite</li> | ||
27 | * </ul> | ||
28 | * | ||
29 | * @see IQueryGroup | ||
30 | * | ||
31 | */ | ||
32 | @SuppressWarnings("all") | ||
33 | public final class Ecore extends BaseGeneratedPatternGroup { | ||
34 | /** | ||
35 | * Access the pattern group. | ||
36 | * | ||
37 | * @return the singleton instance of the group | ||
38 | * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications | ||
39 | * | ||
40 | */ | ||
41 | public static Ecore instance() { | ||
42 | if (INSTANCE == null) { | ||
43 | INSTANCE = new Ecore(); | ||
44 | } | ||
45 | return INSTANCE; | ||
46 | } | ||
47 | |||
48 | private static Ecore INSTANCE; | ||
49 | |||
50 | private Ecore() { | ||
51 | querySpecifications.add(DirectSupertype.instance()); | ||
52 | querySpecifications.add(LoopInInheritence.instance()); | ||
53 | querySpecifications.add(Opposite.instance()); | ||
54 | querySpecifications.add(OppositeDifferentClass.instance()); | ||
55 | querySpecifications.add(NonSymmetricOpposite.instance()); | ||
56 | } | ||
57 | |||
58 | public DirectSupertype getDirectSupertype() { | ||
59 | return DirectSupertype.instance(); | ||
60 | } | ||
61 | |||
62 | public DirectSupertype.Matcher getDirectSupertype(final ViatraQueryEngine engine) { | ||
63 | return DirectSupertype.Matcher.on(engine); | ||
64 | } | ||
65 | |||
66 | public LoopInInheritence getLoopInInheritence() { | ||
67 | return LoopInInheritence.instance(); | ||
68 | } | ||
69 | |||
70 | public LoopInInheritence.Matcher getLoopInInheritence(final ViatraQueryEngine engine) { | ||
71 | return LoopInInheritence.Matcher.on(engine); | ||
72 | } | ||
73 | |||
74 | public Opposite getOpposite() { | ||
75 | return Opposite.instance(); | ||
76 | } | ||
77 | |||
78 | public Opposite.Matcher getOpposite(final ViatraQueryEngine engine) { | ||
79 | return Opposite.Matcher.on(engine); | ||
80 | } | ||
81 | |||
82 | public OppositeDifferentClass getOppositeDifferentClass() { | ||
83 | return OppositeDifferentClass.instance(); | ||
84 | } | ||
85 | |||
86 | public OppositeDifferentClass.Matcher getOppositeDifferentClass(final ViatraQueryEngine engine) { | ||
87 | return OppositeDifferentClass.Matcher.on(engine); | ||
88 | } | ||
89 | |||
90 | public NonSymmetricOpposite getNonSymmetricOpposite() { | ||
91 | return NonSymmetricOpposite.instance(); | ||
92 | } | ||
93 | |||
94 | public NonSymmetricOpposite.Matcher getNonSymmetricOpposite(final ViatraQueryEngine engine) { | ||
95 | return NonSymmetricOpposite.Matcher.on(engine); | ||
96 | } | ||
97 | } | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/LoopInInheritence.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/LoopInInheritence.java new file mode 100644 index 00000000..18ef65f0 --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/LoopInInheritence.java | |||
@@ -0,0 +1,548 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/Ecore.vql | ||
3 | */ | ||
4 | package queries; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import org.apache.log4j.Logger; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
21 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
25 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | import queries.DirectSupertype; | ||
41 | |||
42 | /** | ||
43 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
44 | * | ||
45 | * <p>Original source: | ||
46 | * <code><pre> | ||
47 | * {@literal @}Constraint(key={a}, severity="error", message="error") | ||
48 | * pattern loopInInheritence(a: EClass) { | ||
49 | * find directSupertype+(a,a); | ||
50 | * } | ||
51 | * </pre></code> | ||
52 | * | ||
53 | * @see Matcher | ||
54 | * @see Match | ||
55 | * | ||
56 | */ | ||
57 | @SuppressWarnings("all") | ||
58 | public final class LoopInInheritence extends BaseGeneratedEMFQuerySpecification<LoopInInheritence.Matcher> { | ||
59 | /** | ||
60 | * Pattern-specific match representation of the queries.loopInInheritence pattern, | ||
61 | * to be used in conjunction with {@link Matcher}. | ||
62 | * | ||
63 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
64 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
65 | * usable to represent a match of the pattern in the result of a query, | ||
66 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
67 | * | ||
68 | * @see Matcher | ||
69 | * | ||
70 | */ | ||
71 | public static abstract class Match extends BasePatternMatch { | ||
72 | private EClass fA; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("a"); | ||
75 | |||
76 | private Match(final EClass pA) { | ||
77 | this.fA = pA; | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public Object get(final String parameterName) { | ||
82 | if ("a".equals(parameterName)) return this.fA; | ||
83 | return null; | ||
84 | } | ||
85 | |||
86 | public EClass getA() { | ||
87 | return this.fA; | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public boolean set(final String parameterName, final Object newValue) { | ||
92 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
93 | if ("a".equals(parameterName) ) { | ||
94 | this.fA = (EClass) newValue; | ||
95 | return true; | ||
96 | } | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public void setA(final EClass pA) { | ||
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
102 | this.fA = pA; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String patternName() { | ||
107 | return "queries.loopInInheritence"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> parameterNames() { | ||
112 | return LoopInInheritence.Match.parameterNames; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Object[] toArray() { | ||
117 | return new Object[]{fA}; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public LoopInInheritence.Match toImmutable() { | ||
122 | return isMutable() ? newMatch(fA) : this; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String prettyPrint() { | ||
127 | StringBuilder result = new StringBuilder(); | ||
128 | result.append("\"a\"=" + prettyPrintValue(fA)); | ||
129 | return result.toString(); | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public int hashCode() { | ||
134 | return Objects.hash(fA); | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public boolean equals(final Object obj) { | ||
139 | if (this == obj) | ||
140 | return true; | ||
141 | if (obj == null) { | ||
142 | return false; | ||
143 | } | ||
144 | if ((obj instanceof LoopInInheritence.Match)) { | ||
145 | LoopInInheritence.Match other = (LoopInInheritence.Match) obj; | ||
146 | return Objects.equals(fA, other.fA); | ||
147 | } else { | ||
148 | // this should be infrequent | ||
149 | if (!(obj instanceof IPatternMatch)) { | ||
150 | return false; | ||
151 | } | ||
152 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
153 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public LoopInInheritence specification() { | ||
159 | return LoopInInheritence.instance(); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * Returns an empty, mutable match. | ||
164 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
165 | * | ||
166 | * @return the empty match. | ||
167 | * | ||
168 | */ | ||
169 | public static LoopInInheritence.Match newEmptyMatch() { | ||
170 | return new Mutable(null); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * Returns a mutable (partial) match. | ||
175 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
176 | * | ||
177 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
178 | * @return the new, mutable (partial) match object. | ||
179 | * | ||
180 | */ | ||
181 | public static LoopInInheritence.Match newMutableMatch(final EClass pA) { | ||
182 | return new Mutable(pA); | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * Returns a new (partial) match. | ||
187 | * This can be used e.g. to call the matcher with a partial match. | ||
188 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
189 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
190 | * @return the (partial) match object. | ||
191 | * | ||
192 | */ | ||
193 | public static LoopInInheritence.Match newMatch(final EClass pA) { | ||
194 | return new Immutable(pA); | ||
195 | } | ||
196 | |||
197 | private static final class Mutable extends LoopInInheritence.Match { | ||
198 | Mutable(final EClass pA) { | ||
199 | super(pA); | ||
200 | } | ||
201 | |||
202 | @Override | ||
203 | public boolean isMutable() { | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | private static final class Immutable extends LoopInInheritence.Match { | ||
209 | Immutable(final EClass pA) { | ||
210 | super(pA); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | public boolean isMutable() { | ||
215 | return false; | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * Generated pattern matcher API of the queries.loopInInheritence pattern, | ||
222 | * providing pattern-specific query methods. | ||
223 | * | ||
224 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
225 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
226 | * | ||
227 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
228 | * | ||
229 | * <p>Original source: | ||
230 | * <code><pre> | ||
231 | * {@literal @}Constraint(key={a}, severity="error", message="error") | ||
232 | * pattern loopInInheritence(a: EClass) { | ||
233 | * find directSupertype+(a,a); | ||
234 | * } | ||
235 | * </pre></code> | ||
236 | * | ||
237 | * @see Match | ||
238 | * @see LoopInInheritence | ||
239 | * | ||
240 | */ | ||
241 | public static class Matcher extends BaseMatcher<LoopInInheritence.Match> { | ||
242 | /** | ||
243 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
244 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
245 | * | ||
246 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
247 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
248 | * | ||
249 | */ | ||
250 | public static LoopInInheritence.Matcher on(final ViatraQueryEngine engine) { | ||
251 | // check if matcher already exists | ||
252 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
253 | if (matcher == null) { | ||
254 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
255 | } | ||
256 | return matcher; | ||
257 | } | ||
258 | |||
259 | /** | ||
260 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
261 | * @return an initialized matcher | ||
262 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
263 | * | ||
264 | */ | ||
265 | public static LoopInInheritence.Matcher create() { | ||
266 | return new Matcher(); | ||
267 | } | ||
268 | |||
269 | private static final int POSITION_A = 0; | ||
270 | |||
271 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(LoopInInheritence.Matcher.class); | ||
272 | |||
273 | /** | ||
274 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
275 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
276 | * | ||
277 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
278 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
279 | * | ||
280 | */ | ||
281 | private Matcher() { | ||
282 | super(querySpecification()); | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
287 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
288 | * @return matches represented as a Match object. | ||
289 | * | ||
290 | */ | ||
291 | public Collection<LoopInInheritence.Match> getAllMatches(final EClass pA) { | ||
292 | return rawStreamAllMatches(new Object[]{pA}).collect(Collectors.toSet()); | ||
293 | } | ||
294 | |||
295 | /** | ||
296 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
297 | * </p> | ||
298 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
299 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
300 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
301 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
302 | * @return a stream of matches represented as a Match object. | ||
303 | * | ||
304 | */ | ||
305 | public Stream<LoopInInheritence.Match> streamAllMatches(final EClass pA) { | ||
306 | return rawStreamAllMatches(new Object[]{pA}); | ||
307 | } | ||
308 | |||
309 | /** | ||
310 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
311 | * Neither determinism nor randomness of selection is guaranteed. | ||
312 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
313 | * @return a match represented as a Match object, or null if no match is found. | ||
314 | * | ||
315 | */ | ||
316 | public Optional<LoopInInheritence.Match> getOneArbitraryMatch(final EClass pA) { | ||
317 | return rawGetOneArbitraryMatch(new Object[]{pA}); | ||
318 | } | ||
319 | |||
320 | /** | ||
321 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
322 | * under any possible substitution of the unspecified parameters (if any). | ||
323 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
324 | * @return true if the input is a valid (partial) match of the pattern. | ||
325 | * | ||
326 | */ | ||
327 | public boolean hasMatch(final EClass pA) { | ||
328 | return rawHasMatch(new Object[]{pA}); | ||
329 | } | ||
330 | |||
331 | /** | ||
332 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
333 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
334 | * @return the number of pattern matches found. | ||
335 | * | ||
336 | */ | ||
337 | public int countMatches(final EClass pA) { | ||
338 | return rawCountMatches(new Object[]{pA}); | ||
339 | } | ||
340 | |||
341 | /** | ||
342 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
343 | * Neither determinism nor randomness of selection is guaranteed. | ||
344 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
345 | * @param processor the action that will process the selected match. | ||
346 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
347 | * | ||
348 | */ | ||
349 | public boolean forOneArbitraryMatch(final EClass pA, final Consumer<? super LoopInInheritence.Match> processor) { | ||
350 | return rawForOneArbitraryMatch(new Object[]{pA}, processor); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Returns a new (partial) match. | ||
355 | * This can be used e.g. to call the matcher with a partial match. | ||
356 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
357 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
358 | * @return the (partial) match object. | ||
359 | * | ||
360 | */ | ||
361 | public LoopInInheritence.Match newMatch(final EClass pA) { | ||
362 | return LoopInInheritence.Match.newMatch(pA); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * Retrieve the set of values that occur in matches for a. | ||
367 | * @return the Set of all values or empty set if there are no matches | ||
368 | * | ||
369 | */ | ||
370 | protected Stream<EClass> rawStreamAllValuesOfa(final Object[] parameters) { | ||
371 | return rawStreamAllValues(POSITION_A, parameters).map(EClass.class::cast); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Retrieve the set of values that occur in matches for a. | ||
376 | * @return the Set of all values or empty set if there are no matches | ||
377 | * | ||
378 | */ | ||
379 | public Set<EClass> getAllValuesOfa() { | ||
380 | return rawStreamAllValuesOfa(emptyArray()).collect(Collectors.toSet()); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Retrieve the set of values that occur in matches for a. | ||
385 | * @return the Set of all values or empty set if there are no matches | ||
386 | * | ||
387 | */ | ||
388 | public Stream<EClass> streamAllValuesOfa() { | ||
389 | return rawStreamAllValuesOfa(emptyArray()); | ||
390 | } | ||
391 | |||
392 | @Override | ||
393 | protected LoopInInheritence.Match tupleToMatch(final Tuple t) { | ||
394 | try { | ||
395 | return LoopInInheritence.Match.newMatch((EClass) t.get(POSITION_A)); | ||
396 | } catch(ClassCastException e) { | ||
397 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
398 | return null; | ||
399 | } | ||
400 | } | ||
401 | |||
402 | @Override | ||
403 | protected LoopInInheritence.Match arrayToMatch(final Object[] match) { | ||
404 | try { | ||
405 | return LoopInInheritence.Match.newMatch((EClass) match[POSITION_A]); | ||
406 | } catch(ClassCastException e) { | ||
407 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
408 | return null; | ||
409 | } | ||
410 | } | ||
411 | |||
412 | @Override | ||
413 | protected LoopInInheritence.Match arrayToMatchMutable(final Object[] match) { | ||
414 | try { | ||
415 | return LoopInInheritence.Match.newMutableMatch((EClass) match[POSITION_A]); | ||
416 | } catch(ClassCastException e) { | ||
417 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
418 | return null; | ||
419 | } | ||
420 | } | ||
421 | |||
422 | /** | ||
423 | * @return the singleton instance of the query specification of this pattern | ||
424 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
425 | * | ||
426 | */ | ||
427 | public static IQuerySpecification<LoopInInheritence.Matcher> querySpecification() { | ||
428 | return LoopInInheritence.instance(); | ||
429 | } | ||
430 | } | ||
431 | |||
432 | private LoopInInheritence() { | ||
433 | super(GeneratedPQuery.INSTANCE); | ||
434 | } | ||
435 | |||
436 | /** | ||
437 | * @return the singleton instance of the query specification | ||
438 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
439 | * | ||
440 | */ | ||
441 | public static LoopInInheritence instance() { | ||
442 | try{ | ||
443 | return LazyHolder.INSTANCE; | ||
444 | } catch (ExceptionInInitializerError err) { | ||
445 | throw processInitializerError(err); | ||
446 | } | ||
447 | } | ||
448 | |||
449 | @Override | ||
450 | protected LoopInInheritence.Matcher instantiate(final ViatraQueryEngine engine) { | ||
451 | return LoopInInheritence.Matcher.on(engine); | ||
452 | } | ||
453 | |||
454 | @Override | ||
455 | public LoopInInheritence.Matcher instantiate() { | ||
456 | return LoopInInheritence.Matcher.create(); | ||
457 | } | ||
458 | |||
459 | @Override | ||
460 | public LoopInInheritence.Match newEmptyMatch() { | ||
461 | return LoopInInheritence.Match.newEmptyMatch(); | ||
462 | } | ||
463 | |||
464 | @Override | ||
465 | public LoopInInheritence.Match newMatch(final Object... parameters) { | ||
466 | return LoopInInheritence.Match.newMatch((org.eclipse.emf.ecore.EClass) parameters[0]); | ||
467 | } | ||
468 | |||
469 | /** | ||
470 | * Inner class allowing the singleton instance of {@link JvmGenericType: queries.LoopInInheritence (visibility: PUBLIC, simpleName: LoopInInheritence, identifier: queries.LoopInInheritence, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
471 | * <b>not</b> at the class load time of the outer class, | ||
472 | * but rather at the first call to {@link JvmGenericType: queries.LoopInInheritence (visibility: PUBLIC, simpleName: LoopInInheritence, identifier: queries.LoopInInheritence, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
473 | * | ||
474 | * <p> This workaround is required e.g. to support recursion. | ||
475 | * | ||
476 | */ | ||
477 | private static class LazyHolder { | ||
478 | private static final LoopInInheritence INSTANCE = new LoopInInheritence(); | ||
479 | |||
480 | /** | ||
481 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
482 | * This initialization order is required to support indirect recursion. | ||
483 | * | ||
484 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
485 | * | ||
486 | */ | ||
487 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
488 | |||
489 | public static Object ensureInitialized() { | ||
490 | INSTANCE.ensureInitializedInternal(); | ||
491 | return null; | ||
492 | } | ||
493 | } | ||
494 | |||
495 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
496 | private static final LoopInInheritence.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
497 | |||
498 | private final PParameter parameter_a = new PParameter("a", "org.eclipse.emf.ecore.EClass", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EClass")), PParameterDirection.INOUT); | ||
499 | |||
500 | private final List<PParameter> parameters = Arrays.asList(parameter_a); | ||
501 | |||
502 | private GeneratedPQuery() { | ||
503 | super(PVisibility.PUBLIC); | ||
504 | } | ||
505 | |||
506 | @Override | ||
507 | public String getFullyQualifiedName() { | ||
508 | return "queries.loopInInheritence"; | ||
509 | } | ||
510 | |||
511 | @Override | ||
512 | public List<String> getParameterNames() { | ||
513 | return Arrays.asList("a"); | ||
514 | } | ||
515 | |||
516 | @Override | ||
517 | public List<PParameter> getParameters() { | ||
518 | return parameters; | ||
519 | } | ||
520 | |||
521 | @Override | ||
522 | public Set<PBody> doGetContainedBodies() { | ||
523 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
524 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
525 | { | ||
526 | PBody body = new PBody(this); | ||
527 | PVariable var_a = body.getOrCreateVariableByName("a"); | ||
528 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass"))); | ||
529 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
530 | new ExportedParameter(body, var_a, parameter_a) | ||
531 | )); | ||
532 | // find directSupertype+(a,a) | ||
533 | new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_a, var_a), DirectSupertype.instance().getInternalQueryRepresentation()); | ||
534 | bodies.add(body); | ||
535 | } | ||
536 | { | ||
537 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
538 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
539 | new ParameterReference("a") | ||
540 | })); | ||
541 | annotation.addAttribute("severity", "error"); | ||
542 | annotation.addAttribute("message", "error"); | ||
543 | addAnnotation(annotation); | ||
544 | } | ||
545 | return bodies; | ||
546 | } | ||
547 | } | ||
548 | } | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/NonSymmetricOpposite.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/NonSymmetricOpposite.java new file mode 100644 index 00000000..cecbe2d8 --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/NonSymmetricOpposite.java | |||
@@ -0,0 +1,707 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/Ecore.vql | ||
3 | */ | ||
4 | package queries; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import org.apache.log4j.Logger; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.EReference; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
41 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
42 | import queries.Opposite; | ||
43 | |||
44 | /** | ||
45 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
46 | * | ||
47 | * <p>Original source: | ||
48 | * <code><pre> | ||
49 | * {@literal @}Constraint(key={a}, severity="error", message="error") | ||
50 | * pattern nonSymmetricOpposite(a:EReference, b:EReference) { | ||
51 | * find opposite(a,b); | ||
52 | * neg find opposite(b,a); | ||
53 | * } | ||
54 | * </pre></code> | ||
55 | * | ||
56 | * @see Matcher | ||
57 | * @see Match | ||
58 | * | ||
59 | */ | ||
60 | @SuppressWarnings("all") | ||
61 | public final class NonSymmetricOpposite extends BaseGeneratedEMFQuerySpecification<NonSymmetricOpposite.Matcher> { | ||
62 | /** | ||
63 | * Pattern-specific match representation of the queries.nonSymmetricOpposite pattern, | ||
64 | * to be used in conjunction with {@link Matcher}. | ||
65 | * | ||
66 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
67 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
68 | * usable to represent a match of the pattern in the result of a query, | ||
69 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
70 | * | ||
71 | * @see Matcher | ||
72 | * | ||
73 | */ | ||
74 | public static abstract class Match extends BasePatternMatch { | ||
75 | private EReference fA; | ||
76 | |||
77 | private EReference fB; | ||
78 | |||
79 | private static List<String> parameterNames = makeImmutableList("a", "b"); | ||
80 | |||
81 | private Match(final EReference pA, final EReference pB) { | ||
82 | this.fA = pA; | ||
83 | this.fB = pB; | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | public Object get(final String parameterName) { | ||
88 | if ("a".equals(parameterName)) return this.fA; | ||
89 | if ("b".equals(parameterName)) return this.fB; | ||
90 | return null; | ||
91 | } | ||
92 | |||
93 | public EReference getA() { | ||
94 | return this.fA; | ||
95 | } | ||
96 | |||
97 | public EReference getB() { | ||
98 | return this.fB; | ||
99 | } | ||
100 | |||
101 | @Override | ||
102 | public boolean set(final String parameterName, final Object newValue) { | ||
103 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
104 | if ("a".equals(parameterName) ) { | ||
105 | this.fA = (EReference) newValue; | ||
106 | return true; | ||
107 | } | ||
108 | if ("b".equals(parameterName) ) { | ||
109 | this.fB = (EReference) newValue; | ||
110 | return true; | ||
111 | } | ||
112 | return false; | ||
113 | } | ||
114 | |||
115 | public void setA(final EReference pA) { | ||
116 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
117 | this.fA = pA; | ||
118 | } | ||
119 | |||
120 | public void setB(final EReference pB) { | ||
121 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
122 | this.fB = pB; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String patternName() { | ||
127 | return "queries.nonSymmetricOpposite"; | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public List<String> parameterNames() { | ||
132 | return NonSymmetricOpposite.Match.parameterNames; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public Object[] toArray() { | ||
137 | return new Object[]{fA, fB}; | ||
138 | } | ||
139 | |||
140 | @Override | ||
141 | public NonSymmetricOpposite.Match toImmutable() { | ||
142 | return isMutable() ? newMatch(fA, fB) : this; | ||
143 | } | ||
144 | |||
145 | @Override | ||
146 | public String prettyPrint() { | ||
147 | StringBuilder result = new StringBuilder(); | ||
148 | result.append("\"a\"=" + prettyPrintValue(fA) + ", "); | ||
149 | result.append("\"b\"=" + prettyPrintValue(fB)); | ||
150 | return result.toString(); | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public int hashCode() { | ||
155 | return Objects.hash(fA, fB); | ||
156 | } | ||
157 | |||
158 | @Override | ||
159 | public boolean equals(final Object obj) { | ||
160 | if (this == obj) | ||
161 | return true; | ||
162 | if (obj == null) { | ||
163 | return false; | ||
164 | } | ||
165 | if ((obj instanceof NonSymmetricOpposite.Match)) { | ||
166 | NonSymmetricOpposite.Match other = (NonSymmetricOpposite.Match) obj; | ||
167 | return Objects.equals(fA, other.fA) && Objects.equals(fB, other.fB); | ||
168 | } else { | ||
169 | // this should be infrequent | ||
170 | if (!(obj instanceof IPatternMatch)) { | ||
171 | return false; | ||
172 | } | ||
173 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
174 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | @Override | ||
179 | public NonSymmetricOpposite specification() { | ||
180 | return NonSymmetricOpposite.instance(); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * Returns an empty, mutable match. | ||
185 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
186 | * | ||
187 | * @return the empty match. | ||
188 | * | ||
189 | */ | ||
190 | public static NonSymmetricOpposite.Match newEmptyMatch() { | ||
191 | return new Mutable(null, null); | ||
192 | } | ||
193 | |||
194 | /** | ||
195 | * Returns a mutable (partial) match. | ||
196 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
197 | * | ||
198 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
199 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
200 | * @return the new, mutable (partial) match object. | ||
201 | * | ||
202 | */ | ||
203 | public static NonSymmetricOpposite.Match newMutableMatch(final EReference pA, final EReference pB) { | ||
204 | return new Mutable(pA, pB); | ||
205 | } | ||
206 | |||
207 | /** | ||
208 | * Returns a new (partial) match. | ||
209 | * This can be used e.g. to call the matcher with a partial match. | ||
210 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
211 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
212 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
213 | * @return the (partial) match object. | ||
214 | * | ||
215 | */ | ||
216 | public static NonSymmetricOpposite.Match newMatch(final EReference pA, final EReference pB) { | ||
217 | return new Immutable(pA, pB); | ||
218 | } | ||
219 | |||
220 | private static final class Mutable extends NonSymmetricOpposite.Match { | ||
221 | Mutable(final EReference pA, final EReference pB) { | ||
222 | super(pA, pB); | ||
223 | } | ||
224 | |||
225 | @Override | ||
226 | public boolean isMutable() { | ||
227 | return true; | ||
228 | } | ||
229 | } | ||
230 | |||
231 | private static final class Immutable extends NonSymmetricOpposite.Match { | ||
232 | Immutable(final EReference pA, final EReference pB) { | ||
233 | super(pA, pB); | ||
234 | } | ||
235 | |||
236 | @Override | ||
237 | public boolean isMutable() { | ||
238 | return false; | ||
239 | } | ||
240 | } | ||
241 | } | ||
242 | |||
243 | /** | ||
244 | * Generated pattern matcher API of the queries.nonSymmetricOpposite pattern, | ||
245 | * providing pattern-specific query methods. | ||
246 | * | ||
247 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
248 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
249 | * | ||
250 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
251 | * | ||
252 | * <p>Original source: | ||
253 | * <code><pre> | ||
254 | * {@literal @}Constraint(key={a}, severity="error", message="error") | ||
255 | * pattern nonSymmetricOpposite(a:EReference, b:EReference) { | ||
256 | * find opposite(a,b); | ||
257 | * neg find opposite(b,a); | ||
258 | * } | ||
259 | * </pre></code> | ||
260 | * | ||
261 | * @see Match | ||
262 | * @see NonSymmetricOpposite | ||
263 | * | ||
264 | */ | ||
265 | public static class Matcher extends BaseMatcher<NonSymmetricOpposite.Match> { | ||
266 | /** | ||
267 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
268 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
269 | * | ||
270 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
271 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
272 | * | ||
273 | */ | ||
274 | public static NonSymmetricOpposite.Matcher on(final ViatraQueryEngine engine) { | ||
275 | // check if matcher already exists | ||
276 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
277 | if (matcher == null) { | ||
278 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
279 | } | ||
280 | return matcher; | ||
281 | } | ||
282 | |||
283 | /** | ||
284 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
285 | * @return an initialized matcher | ||
286 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
287 | * | ||
288 | */ | ||
289 | public static NonSymmetricOpposite.Matcher create() { | ||
290 | return new Matcher(); | ||
291 | } | ||
292 | |||
293 | private static final int POSITION_A = 0; | ||
294 | |||
295 | private static final int POSITION_B = 1; | ||
296 | |||
297 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NonSymmetricOpposite.Matcher.class); | ||
298 | |||
299 | /** | ||
300 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
301 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
302 | * | ||
303 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
304 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
305 | * | ||
306 | */ | ||
307 | private Matcher() { | ||
308 | super(querySpecification()); | ||
309 | } | ||
310 | |||
311 | /** | ||
312 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
313 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
314 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
315 | * @return matches represented as a Match object. | ||
316 | * | ||
317 | */ | ||
318 | public Collection<NonSymmetricOpposite.Match> getAllMatches(final EReference pA, final EReference pB) { | ||
319 | return rawStreamAllMatches(new Object[]{pA, pB}).collect(Collectors.toSet()); | ||
320 | } | ||
321 | |||
322 | /** | ||
323 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
324 | * </p> | ||
325 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
326 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
327 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
328 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
329 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
330 | * @return a stream of matches represented as a Match object. | ||
331 | * | ||
332 | */ | ||
333 | public Stream<NonSymmetricOpposite.Match> streamAllMatches(final EReference pA, final EReference pB) { | ||
334 | return rawStreamAllMatches(new Object[]{pA, pB}); | ||
335 | } | ||
336 | |||
337 | /** | ||
338 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
339 | * Neither determinism nor randomness of selection is guaranteed. | ||
340 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
341 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
342 | * @return a match represented as a Match object, or null if no match is found. | ||
343 | * | ||
344 | */ | ||
345 | public Optional<NonSymmetricOpposite.Match> getOneArbitraryMatch(final EReference pA, final EReference pB) { | ||
346 | return rawGetOneArbitraryMatch(new Object[]{pA, pB}); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
351 | * under any possible substitution of the unspecified parameters (if any). | ||
352 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
353 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
354 | * @return true if the input is a valid (partial) match of the pattern. | ||
355 | * | ||
356 | */ | ||
357 | public boolean hasMatch(final EReference pA, final EReference pB) { | ||
358 | return rawHasMatch(new Object[]{pA, pB}); | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
363 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
364 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
365 | * @return the number of pattern matches found. | ||
366 | * | ||
367 | */ | ||
368 | public int countMatches(final EReference pA, final EReference pB) { | ||
369 | return rawCountMatches(new Object[]{pA, pB}); | ||
370 | } | ||
371 | |||
372 | /** | ||
373 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
374 | * Neither determinism nor randomness of selection is guaranteed. | ||
375 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
376 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
377 | * @param processor the action that will process the selected match. | ||
378 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
379 | * | ||
380 | */ | ||
381 | public boolean forOneArbitraryMatch(final EReference pA, final EReference pB, final Consumer<? super NonSymmetricOpposite.Match> processor) { | ||
382 | return rawForOneArbitraryMatch(new Object[]{pA, pB}, processor); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * Returns a new (partial) match. | ||
387 | * This can be used e.g. to call the matcher with a partial match. | ||
388 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
389 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
390 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
391 | * @return the (partial) match object. | ||
392 | * | ||
393 | */ | ||
394 | public NonSymmetricOpposite.Match newMatch(final EReference pA, final EReference pB) { | ||
395 | return NonSymmetricOpposite.Match.newMatch(pA, pB); | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * Retrieve the set of values that occur in matches for a. | ||
400 | * @return the Set of all values or empty set if there are no matches | ||
401 | * | ||
402 | */ | ||
403 | protected Stream<EReference> rawStreamAllValuesOfa(final Object[] parameters) { | ||
404 | return rawStreamAllValues(POSITION_A, parameters).map(EReference.class::cast); | ||
405 | } | ||
406 | |||
407 | /** | ||
408 | * Retrieve the set of values that occur in matches for a. | ||
409 | * @return the Set of all values or empty set if there are no matches | ||
410 | * | ||
411 | */ | ||
412 | public Set<EReference> getAllValuesOfa() { | ||
413 | return rawStreamAllValuesOfa(emptyArray()).collect(Collectors.toSet()); | ||
414 | } | ||
415 | |||
416 | /** | ||
417 | * Retrieve the set of values that occur in matches for a. | ||
418 | * @return the Set of all values or empty set if there are no matches | ||
419 | * | ||
420 | */ | ||
421 | public Stream<EReference> streamAllValuesOfa() { | ||
422 | return rawStreamAllValuesOfa(emptyArray()); | ||
423 | } | ||
424 | |||
425 | /** | ||
426 | * Retrieve the set of values that occur in matches for a. | ||
427 | * </p> | ||
428 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
429 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
430 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
431 | * | ||
432 | * @return the Stream of all values or empty set if there are no matches | ||
433 | * | ||
434 | */ | ||
435 | public Stream<EReference> streamAllValuesOfa(final NonSymmetricOpposite.Match partialMatch) { | ||
436 | return rawStreamAllValuesOfa(partialMatch.toArray()); | ||
437 | } | ||
438 | |||
439 | /** | ||
440 | * Retrieve the set of values that occur in matches for a. | ||
441 | * </p> | ||
442 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
443 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
444 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
445 | * | ||
446 | * @return the Stream of all values or empty set if there are no matches | ||
447 | * | ||
448 | */ | ||
449 | public Stream<EReference> streamAllValuesOfa(final EReference pB) { | ||
450 | return rawStreamAllValuesOfa(new Object[]{null, pB}); | ||
451 | } | ||
452 | |||
453 | /** | ||
454 | * Retrieve the set of values that occur in matches for a. | ||
455 | * @return the Set of all values or empty set if there are no matches | ||
456 | * | ||
457 | */ | ||
458 | public Set<EReference> getAllValuesOfa(final NonSymmetricOpposite.Match partialMatch) { | ||
459 | return rawStreamAllValuesOfa(partialMatch.toArray()).collect(Collectors.toSet()); | ||
460 | } | ||
461 | |||
462 | /** | ||
463 | * Retrieve the set of values that occur in matches for a. | ||
464 | * @return the Set of all values or empty set if there are no matches | ||
465 | * | ||
466 | */ | ||
467 | public Set<EReference> getAllValuesOfa(final EReference pB) { | ||
468 | return rawStreamAllValuesOfa(new Object[]{null, pB}).collect(Collectors.toSet()); | ||
469 | } | ||
470 | |||
471 | /** | ||
472 | * Retrieve the set of values that occur in matches for b. | ||
473 | * @return the Set of all values or empty set if there are no matches | ||
474 | * | ||
475 | */ | ||
476 | protected Stream<EReference> rawStreamAllValuesOfb(final Object[] parameters) { | ||
477 | return rawStreamAllValues(POSITION_B, parameters).map(EReference.class::cast); | ||
478 | } | ||
479 | |||
480 | /** | ||
481 | * Retrieve the set of values that occur in matches for b. | ||
482 | * @return the Set of all values or empty set if there are no matches | ||
483 | * | ||
484 | */ | ||
485 | public Set<EReference> getAllValuesOfb() { | ||
486 | return rawStreamAllValuesOfb(emptyArray()).collect(Collectors.toSet()); | ||
487 | } | ||
488 | |||
489 | /** | ||
490 | * Retrieve the set of values that occur in matches for b. | ||
491 | * @return the Set of all values or empty set if there are no matches | ||
492 | * | ||
493 | */ | ||
494 | public Stream<EReference> streamAllValuesOfb() { | ||
495 | return rawStreamAllValuesOfb(emptyArray()); | ||
496 | } | ||
497 | |||
498 | /** | ||
499 | * Retrieve the set of values that occur in matches for b. | ||
500 | * </p> | ||
501 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
502 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
503 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
504 | * | ||
505 | * @return the Stream of all values or empty set if there are no matches | ||
506 | * | ||
507 | */ | ||
508 | public Stream<EReference> streamAllValuesOfb(final NonSymmetricOpposite.Match partialMatch) { | ||
509 | return rawStreamAllValuesOfb(partialMatch.toArray()); | ||
510 | } | ||
511 | |||
512 | /** | ||
513 | * Retrieve the set of values that occur in matches for b. | ||
514 | * </p> | ||
515 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
516 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
517 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
518 | * | ||
519 | * @return the Stream of all values or empty set if there are no matches | ||
520 | * | ||
521 | */ | ||
522 | public Stream<EReference> streamAllValuesOfb(final EReference pA) { | ||
523 | return rawStreamAllValuesOfb(new Object[]{pA, null}); | ||
524 | } | ||
525 | |||
526 | /** | ||
527 | * Retrieve the set of values that occur in matches for b. | ||
528 | * @return the Set of all values or empty set if there are no matches | ||
529 | * | ||
530 | */ | ||
531 | public Set<EReference> getAllValuesOfb(final NonSymmetricOpposite.Match partialMatch) { | ||
532 | return rawStreamAllValuesOfb(partialMatch.toArray()).collect(Collectors.toSet()); | ||
533 | } | ||
534 | |||
535 | /** | ||
536 | * Retrieve the set of values that occur in matches for b. | ||
537 | * @return the Set of all values or empty set if there are no matches | ||
538 | * | ||
539 | */ | ||
540 | public Set<EReference> getAllValuesOfb(final EReference pA) { | ||
541 | return rawStreamAllValuesOfb(new Object[]{pA, null}).collect(Collectors.toSet()); | ||
542 | } | ||
543 | |||
544 | @Override | ||
545 | protected NonSymmetricOpposite.Match tupleToMatch(final Tuple t) { | ||
546 | try { | ||
547 | return NonSymmetricOpposite.Match.newMatch((EReference) t.get(POSITION_A), (EReference) t.get(POSITION_B)); | ||
548 | } catch(ClassCastException e) { | ||
549 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
550 | return null; | ||
551 | } | ||
552 | } | ||
553 | |||
554 | @Override | ||
555 | protected NonSymmetricOpposite.Match arrayToMatch(final Object[] match) { | ||
556 | try { | ||
557 | return NonSymmetricOpposite.Match.newMatch((EReference) match[POSITION_A], (EReference) match[POSITION_B]); | ||
558 | } catch(ClassCastException e) { | ||
559 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
560 | return null; | ||
561 | } | ||
562 | } | ||
563 | |||
564 | @Override | ||
565 | protected NonSymmetricOpposite.Match arrayToMatchMutable(final Object[] match) { | ||
566 | try { | ||
567 | return NonSymmetricOpposite.Match.newMutableMatch((EReference) match[POSITION_A], (EReference) match[POSITION_B]); | ||
568 | } catch(ClassCastException e) { | ||
569 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
570 | return null; | ||
571 | } | ||
572 | } | ||
573 | |||
574 | /** | ||
575 | * @return the singleton instance of the query specification of this pattern | ||
576 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
577 | * | ||
578 | */ | ||
579 | public static IQuerySpecification<NonSymmetricOpposite.Matcher> querySpecification() { | ||
580 | return NonSymmetricOpposite.instance(); | ||
581 | } | ||
582 | } | ||
583 | |||
584 | private NonSymmetricOpposite() { | ||
585 | super(GeneratedPQuery.INSTANCE); | ||
586 | } | ||
587 | |||
588 | /** | ||
589 | * @return the singleton instance of the query specification | ||
590 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
591 | * | ||
592 | */ | ||
593 | public static NonSymmetricOpposite instance() { | ||
594 | try{ | ||
595 | return LazyHolder.INSTANCE; | ||
596 | } catch (ExceptionInInitializerError err) { | ||
597 | throw processInitializerError(err); | ||
598 | } | ||
599 | } | ||
600 | |||
601 | @Override | ||
602 | protected NonSymmetricOpposite.Matcher instantiate(final ViatraQueryEngine engine) { | ||
603 | return NonSymmetricOpposite.Matcher.on(engine); | ||
604 | } | ||
605 | |||
606 | @Override | ||
607 | public NonSymmetricOpposite.Matcher instantiate() { | ||
608 | return NonSymmetricOpposite.Matcher.create(); | ||
609 | } | ||
610 | |||
611 | @Override | ||
612 | public NonSymmetricOpposite.Match newEmptyMatch() { | ||
613 | return NonSymmetricOpposite.Match.newEmptyMatch(); | ||
614 | } | ||
615 | |||
616 | @Override | ||
617 | public NonSymmetricOpposite.Match newMatch(final Object... parameters) { | ||
618 | return NonSymmetricOpposite.Match.newMatch((org.eclipse.emf.ecore.EReference) parameters[0], (org.eclipse.emf.ecore.EReference) parameters[1]); | ||
619 | } | ||
620 | |||
621 | /** | ||
622 | * Inner class allowing the singleton instance of {@link JvmGenericType: queries.NonSymmetricOpposite (visibility: PUBLIC, simpleName: NonSymmetricOpposite, identifier: queries.NonSymmetricOpposite, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
623 | * <b>not</b> at the class load time of the outer class, | ||
624 | * but rather at the first call to {@link JvmGenericType: queries.NonSymmetricOpposite (visibility: PUBLIC, simpleName: NonSymmetricOpposite, identifier: queries.NonSymmetricOpposite, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
625 | * | ||
626 | * <p> This workaround is required e.g. to support recursion. | ||
627 | * | ||
628 | */ | ||
629 | private static class LazyHolder { | ||
630 | private static final NonSymmetricOpposite INSTANCE = new NonSymmetricOpposite(); | ||
631 | |||
632 | /** | ||
633 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
634 | * This initialization order is required to support indirect recursion. | ||
635 | * | ||
636 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
637 | * | ||
638 | */ | ||
639 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
640 | |||
641 | public static Object ensureInitialized() { | ||
642 | INSTANCE.ensureInitializedInternal(); | ||
643 | return null; | ||
644 | } | ||
645 | } | ||
646 | |||
647 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
648 | private static final NonSymmetricOpposite.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
649 | |||
650 | private final PParameter parameter_a = new PParameter("a", "org.eclipse.emf.ecore.EReference", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EReference")), PParameterDirection.INOUT); | ||
651 | |||
652 | private final PParameter parameter_b = new PParameter("b", "org.eclipse.emf.ecore.EReference", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EReference")), PParameterDirection.INOUT); | ||
653 | |||
654 | private final List<PParameter> parameters = Arrays.asList(parameter_a, parameter_b); | ||
655 | |||
656 | private GeneratedPQuery() { | ||
657 | super(PVisibility.PUBLIC); | ||
658 | } | ||
659 | |||
660 | @Override | ||
661 | public String getFullyQualifiedName() { | ||
662 | return "queries.nonSymmetricOpposite"; | ||
663 | } | ||
664 | |||
665 | @Override | ||
666 | public List<String> getParameterNames() { | ||
667 | return Arrays.asList("a","b"); | ||
668 | } | ||
669 | |||
670 | @Override | ||
671 | public List<PParameter> getParameters() { | ||
672 | return parameters; | ||
673 | } | ||
674 | |||
675 | @Override | ||
676 | public Set<PBody> doGetContainedBodies() { | ||
677 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
678 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
679 | { | ||
680 | PBody body = new PBody(this); | ||
681 | PVariable var_a = body.getOrCreateVariableByName("a"); | ||
682 | PVariable var_b = body.getOrCreateVariableByName("b"); | ||
683 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
684 | new TypeConstraint(body, Tuples.flatTupleOf(var_b), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
685 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
686 | new ExportedParameter(body, var_a, parameter_a), | ||
687 | new ExportedParameter(body, var_b, parameter_b) | ||
688 | )); | ||
689 | // find opposite(a,b) | ||
690 | new PositivePatternCall(body, Tuples.flatTupleOf(var_a, var_b), Opposite.instance().getInternalQueryRepresentation()); | ||
691 | // neg find opposite(b,a) | ||
692 | new NegativePatternCall(body, Tuples.flatTupleOf(var_b, var_a), Opposite.instance().getInternalQueryRepresentation()); | ||
693 | bodies.add(body); | ||
694 | } | ||
695 | { | ||
696 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
697 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
698 | new ParameterReference("a") | ||
699 | })); | ||
700 | annotation.addAttribute("severity", "error"); | ||
701 | annotation.addAttribute("message", "error"); | ||
702 | addAnnotation(annotation); | ||
703 | } | ||
704 | return bodies; | ||
705 | } | ||
706 | } | ||
707 | } | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Opposite.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Opposite.java new file mode 100644 index 00000000..8c501b8e --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Opposite.java | |||
@@ -0,0 +1,693 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/Ecore.vql | ||
3 | */ | ||
4 | package queries; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import org.apache.log4j.Logger; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.EReference; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | |||
41 | /** | ||
42 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
43 | * | ||
44 | * <p>Original source: | ||
45 | * <code><pre> | ||
46 | * pattern opposite(a:EReference, b: EReference) { | ||
47 | * EReference.eOpposite(a,b); | ||
48 | * } | ||
49 | * </pre></code> | ||
50 | * | ||
51 | * @see Matcher | ||
52 | * @see Match | ||
53 | * | ||
54 | */ | ||
55 | @SuppressWarnings("all") | ||
56 | public final class Opposite extends BaseGeneratedEMFQuerySpecification<Opposite.Matcher> { | ||
57 | /** | ||
58 | * Pattern-specific match representation of the queries.opposite pattern, | ||
59 | * to be used in conjunction with {@link Matcher}. | ||
60 | * | ||
61 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
62 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
63 | * usable to represent a match of the pattern in the result of a query, | ||
64 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
65 | * | ||
66 | * @see Matcher | ||
67 | * | ||
68 | */ | ||
69 | public static abstract class Match extends BasePatternMatch { | ||
70 | private EReference fA; | ||
71 | |||
72 | private EReference fB; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("a", "b"); | ||
75 | |||
76 | private Match(final EReference pA, final EReference pB) { | ||
77 | this.fA = pA; | ||
78 | this.fB = pB; | ||
79 | } | ||
80 | |||
81 | @Override | ||
82 | public Object get(final String parameterName) { | ||
83 | if ("a".equals(parameterName)) return this.fA; | ||
84 | if ("b".equals(parameterName)) return this.fB; | ||
85 | return null; | ||
86 | } | ||
87 | |||
88 | public EReference getA() { | ||
89 | return this.fA; | ||
90 | } | ||
91 | |||
92 | public EReference getB() { | ||
93 | return this.fB; | ||
94 | } | ||
95 | |||
96 | @Override | ||
97 | public boolean set(final String parameterName, final Object newValue) { | ||
98 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
99 | if ("a".equals(parameterName) ) { | ||
100 | this.fA = (EReference) newValue; | ||
101 | return true; | ||
102 | } | ||
103 | if ("b".equals(parameterName) ) { | ||
104 | this.fB = (EReference) newValue; | ||
105 | return true; | ||
106 | } | ||
107 | return false; | ||
108 | } | ||
109 | |||
110 | public void setA(final EReference pA) { | ||
111 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
112 | this.fA = pA; | ||
113 | } | ||
114 | |||
115 | public void setB(final EReference pB) { | ||
116 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
117 | this.fB = pB; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public String patternName() { | ||
122 | return "queries.opposite"; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public List<String> parameterNames() { | ||
127 | return Opposite.Match.parameterNames; | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public Object[] toArray() { | ||
132 | return new Object[]{fA, fB}; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public Opposite.Match toImmutable() { | ||
137 | return isMutable() ? newMatch(fA, fB) : this; | ||
138 | } | ||
139 | |||
140 | @Override | ||
141 | public String prettyPrint() { | ||
142 | StringBuilder result = new StringBuilder(); | ||
143 | result.append("\"a\"=" + prettyPrintValue(fA) + ", "); | ||
144 | result.append("\"b\"=" + prettyPrintValue(fB)); | ||
145 | return result.toString(); | ||
146 | } | ||
147 | |||
148 | @Override | ||
149 | public int hashCode() { | ||
150 | return Objects.hash(fA, fB); | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public boolean equals(final Object obj) { | ||
155 | if (this == obj) | ||
156 | return true; | ||
157 | if (obj == null) { | ||
158 | return false; | ||
159 | } | ||
160 | if ((obj instanceof Opposite.Match)) { | ||
161 | Opposite.Match other = (Opposite.Match) obj; | ||
162 | return Objects.equals(fA, other.fA) && Objects.equals(fB, other.fB); | ||
163 | } else { | ||
164 | // this should be infrequent | ||
165 | if (!(obj instanceof IPatternMatch)) { | ||
166 | return false; | ||
167 | } | ||
168 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
169 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | @Override | ||
174 | public Opposite specification() { | ||
175 | return Opposite.instance(); | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * Returns an empty, mutable match. | ||
180 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
181 | * | ||
182 | * @return the empty match. | ||
183 | * | ||
184 | */ | ||
185 | public static Opposite.Match newEmptyMatch() { | ||
186 | return new Mutable(null, null); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * Returns a mutable (partial) match. | ||
191 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
192 | * | ||
193 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
194 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
195 | * @return the new, mutable (partial) match object. | ||
196 | * | ||
197 | */ | ||
198 | public static Opposite.Match newMutableMatch(final EReference pA, final EReference pB) { | ||
199 | return new Mutable(pA, pB); | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * Returns a new (partial) match. | ||
204 | * This can be used e.g. to call the matcher with a partial match. | ||
205 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
206 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
207 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
208 | * @return the (partial) match object. | ||
209 | * | ||
210 | */ | ||
211 | public static Opposite.Match newMatch(final EReference pA, final EReference pB) { | ||
212 | return new Immutable(pA, pB); | ||
213 | } | ||
214 | |||
215 | private static final class Mutable extends Opposite.Match { | ||
216 | Mutable(final EReference pA, final EReference pB) { | ||
217 | super(pA, pB); | ||
218 | } | ||
219 | |||
220 | @Override | ||
221 | public boolean isMutable() { | ||
222 | return true; | ||
223 | } | ||
224 | } | ||
225 | |||
226 | private static final class Immutable extends Opposite.Match { | ||
227 | Immutable(final EReference pA, final EReference pB) { | ||
228 | super(pA, pB); | ||
229 | } | ||
230 | |||
231 | @Override | ||
232 | public boolean isMutable() { | ||
233 | return false; | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | |||
238 | /** | ||
239 | * Generated pattern matcher API of the queries.opposite pattern, | ||
240 | * providing pattern-specific query methods. | ||
241 | * | ||
242 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
243 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
244 | * | ||
245 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
246 | * | ||
247 | * <p>Original source: | ||
248 | * <code><pre> | ||
249 | * pattern opposite(a:EReference, b: EReference) { | ||
250 | * EReference.eOpposite(a,b); | ||
251 | * } | ||
252 | * </pre></code> | ||
253 | * | ||
254 | * @see Match | ||
255 | * @see Opposite | ||
256 | * | ||
257 | */ | ||
258 | public static class Matcher extends BaseMatcher<Opposite.Match> { | ||
259 | /** | ||
260 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
261 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
262 | * | ||
263 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
264 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
265 | * | ||
266 | */ | ||
267 | public static Opposite.Matcher on(final ViatraQueryEngine engine) { | ||
268 | // check if matcher already exists | ||
269 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
270 | if (matcher == null) { | ||
271 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
272 | } | ||
273 | return matcher; | ||
274 | } | ||
275 | |||
276 | /** | ||
277 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
278 | * @return an initialized matcher | ||
279 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
280 | * | ||
281 | */ | ||
282 | public static Opposite.Matcher create() { | ||
283 | return new Matcher(); | ||
284 | } | ||
285 | |||
286 | private static final int POSITION_A = 0; | ||
287 | |||
288 | private static final int POSITION_B = 1; | ||
289 | |||
290 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Opposite.Matcher.class); | ||
291 | |||
292 | /** | ||
293 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
294 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
295 | * | ||
296 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
297 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
298 | * | ||
299 | */ | ||
300 | private Matcher() { | ||
301 | super(querySpecification()); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
306 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
307 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
308 | * @return matches represented as a Match object. | ||
309 | * | ||
310 | */ | ||
311 | public Collection<Opposite.Match> getAllMatches(final EReference pA, final EReference pB) { | ||
312 | return rawStreamAllMatches(new Object[]{pA, pB}).collect(Collectors.toSet()); | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
317 | * </p> | ||
318 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
319 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
320 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
321 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
322 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
323 | * @return a stream of matches represented as a Match object. | ||
324 | * | ||
325 | */ | ||
326 | public Stream<Opposite.Match> streamAllMatches(final EReference pA, final EReference pB) { | ||
327 | return rawStreamAllMatches(new Object[]{pA, pB}); | ||
328 | } | ||
329 | |||
330 | /** | ||
331 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
332 | * Neither determinism nor randomness of selection is guaranteed. | ||
333 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
334 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
335 | * @return a match represented as a Match object, or null if no match is found. | ||
336 | * | ||
337 | */ | ||
338 | public Optional<Opposite.Match> getOneArbitraryMatch(final EReference pA, final EReference pB) { | ||
339 | return rawGetOneArbitraryMatch(new Object[]{pA, pB}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
344 | * under any possible substitution of the unspecified parameters (if any). | ||
345 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
346 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
347 | * @return true if the input is a valid (partial) match of the pattern. | ||
348 | * | ||
349 | */ | ||
350 | public boolean hasMatch(final EReference pA, final EReference pB) { | ||
351 | return rawHasMatch(new Object[]{pA, pB}); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
356 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
357 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
358 | * @return the number of pattern matches found. | ||
359 | * | ||
360 | */ | ||
361 | public int countMatches(final EReference pA, final EReference pB) { | ||
362 | return rawCountMatches(new Object[]{pA, pB}); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
367 | * Neither determinism nor randomness of selection is guaranteed. | ||
368 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
369 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
370 | * @param processor the action that will process the selected match. | ||
371 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
372 | * | ||
373 | */ | ||
374 | public boolean forOneArbitraryMatch(final EReference pA, final EReference pB, final Consumer<? super Opposite.Match> processor) { | ||
375 | return rawForOneArbitraryMatch(new Object[]{pA, pB}, processor); | ||
376 | } | ||
377 | |||
378 | /** | ||
379 | * Returns a new (partial) match. | ||
380 | * This can be used e.g. to call the matcher with a partial match. | ||
381 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
382 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
383 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
384 | * @return the (partial) match object. | ||
385 | * | ||
386 | */ | ||
387 | public Opposite.Match newMatch(final EReference pA, final EReference pB) { | ||
388 | return Opposite.Match.newMatch(pA, pB); | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * Retrieve the set of values that occur in matches for a. | ||
393 | * @return the Set of all values or empty set if there are no matches | ||
394 | * | ||
395 | */ | ||
396 | protected Stream<EReference> rawStreamAllValuesOfa(final Object[] parameters) { | ||
397 | return rawStreamAllValues(POSITION_A, parameters).map(EReference.class::cast); | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * Retrieve the set of values that occur in matches for a. | ||
402 | * @return the Set of all values or empty set if there are no matches | ||
403 | * | ||
404 | */ | ||
405 | public Set<EReference> getAllValuesOfa() { | ||
406 | return rawStreamAllValuesOfa(emptyArray()).collect(Collectors.toSet()); | ||
407 | } | ||
408 | |||
409 | /** | ||
410 | * Retrieve the set of values that occur in matches for a. | ||
411 | * @return the Set of all values or empty set if there are no matches | ||
412 | * | ||
413 | */ | ||
414 | public Stream<EReference> streamAllValuesOfa() { | ||
415 | return rawStreamAllValuesOfa(emptyArray()); | ||
416 | } | ||
417 | |||
418 | /** | ||
419 | * Retrieve the set of values that occur in matches for a. | ||
420 | * </p> | ||
421 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
422 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
423 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
424 | * | ||
425 | * @return the Stream of all values or empty set if there are no matches | ||
426 | * | ||
427 | */ | ||
428 | public Stream<EReference> streamAllValuesOfa(final Opposite.Match partialMatch) { | ||
429 | return rawStreamAllValuesOfa(partialMatch.toArray()); | ||
430 | } | ||
431 | |||
432 | /** | ||
433 | * Retrieve the set of values that occur in matches for a. | ||
434 | * </p> | ||
435 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
436 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
437 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
438 | * | ||
439 | * @return the Stream of all values or empty set if there are no matches | ||
440 | * | ||
441 | */ | ||
442 | public Stream<EReference> streamAllValuesOfa(final EReference pB) { | ||
443 | return rawStreamAllValuesOfa(new Object[]{null, pB}); | ||
444 | } | ||
445 | |||
446 | /** | ||
447 | * Retrieve the set of values that occur in matches for a. | ||
448 | * @return the Set of all values or empty set if there are no matches | ||
449 | * | ||
450 | */ | ||
451 | public Set<EReference> getAllValuesOfa(final Opposite.Match partialMatch) { | ||
452 | return rawStreamAllValuesOfa(partialMatch.toArray()).collect(Collectors.toSet()); | ||
453 | } | ||
454 | |||
455 | /** | ||
456 | * Retrieve the set of values that occur in matches for a. | ||
457 | * @return the Set of all values or empty set if there are no matches | ||
458 | * | ||
459 | */ | ||
460 | public Set<EReference> getAllValuesOfa(final EReference pB) { | ||
461 | return rawStreamAllValuesOfa(new Object[]{null, pB}).collect(Collectors.toSet()); | ||
462 | } | ||
463 | |||
464 | /** | ||
465 | * Retrieve the set of values that occur in matches for b. | ||
466 | * @return the Set of all values or empty set if there are no matches | ||
467 | * | ||
468 | */ | ||
469 | protected Stream<EReference> rawStreamAllValuesOfb(final Object[] parameters) { | ||
470 | return rawStreamAllValues(POSITION_B, parameters).map(EReference.class::cast); | ||
471 | } | ||
472 | |||
473 | /** | ||
474 | * Retrieve the set of values that occur in matches for b. | ||
475 | * @return the Set of all values or empty set if there are no matches | ||
476 | * | ||
477 | */ | ||
478 | public Set<EReference> getAllValuesOfb() { | ||
479 | return rawStreamAllValuesOfb(emptyArray()).collect(Collectors.toSet()); | ||
480 | } | ||
481 | |||
482 | /** | ||
483 | * Retrieve the set of values that occur in matches for b. | ||
484 | * @return the Set of all values or empty set if there are no matches | ||
485 | * | ||
486 | */ | ||
487 | public Stream<EReference> streamAllValuesOfb() { | ||
488 | return rawStreamAllValuesOfb(emptyArray()); | ||
489 | } | ||
490 | |||
491 | /** | ||
492 | * Retrieve the set of values that occur in matches for b. | ||
493 | * </p> | ||
494 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
495 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
496 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
497 | * | ||
498 | * @return the Stream of all values or empty set if there are no matches | ||
499 | * | ||
500 | */ | ||
501 | public Stream<EReference> streamAllValuesOfb(final Opposite.Match partialMatch) { | ||
502 | return rawStreamAllValuesOfb(partialMatch.toArray()); | ||
503 | } | ||
504 | |||
505 | /** | ||
506 | * Retrieve the set of values that occur in matches for b. | ||
507 | * </p> | ||
508 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
509 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
510 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
511 | * | ||
512 | * @return the Stream of all values or empty set if there are no matches | ||
513 | * | ||
514 | */ | ||
515 | public Stream<EReference> streamAllValuesOfb(final EReference pA) { | ||
516 | return rawStreamAllValuesOfb(new Object[]{pA, null}); | ||
517 | } | ||
518 | |||
519 | /** | ||
520 | * Retrieve the set of values that occur in matches for b. | ||
521 | * @return the Set of all values or empty set if there are no matches | ||
522 | * | ||
523 | */ | ||
524 | public Set<EReference> getAllValuesOfb(final Opposite.Match partialMatch) { | ||
525 | return rawStreamAllValuesOfb(partialMatch.toArray()).collect(Collectors.toSet()); | ||
526 | } | ||
527 | |||
528 | /** | ||
529 | * Retrieve the set of values that occur in matches for b. | ||
530 | * @return the Set of all values or empty set if there are no matches | ||
531 | * | ||
532 | */ | ||
533 | public Set<EReference> getAllValuesOfb(final EReference pA) { | ||
534 | return rawStreamAllValuesOfb(new Object[]{pA, null}).collect(Collectors.toSet()); | ||
535 | } | ||
536 | |||
537 | @Override | ||
538 | protected Opposite.Match tupleToMatch(final Tuple t) { | ||
539 | try { | ||
540 | return Opposite.Match.newMatch((EReference) t.get(POSITION_A), (EReference) t.get(POSITION_B)); | ||
541 | } catch(ClassCastException e) { | ||
542 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
543 | return null; | ||
544 | } | ||
545 | } | ||
546 | |||
547 | @Override | ||
548 | protected Opposite.Match arrayToMatch(final Object[] match) { | ||
549 | try { | ||
550 | return Opposite.Match.newMatch((EReference) match[POSITION_A], (EReference) match[POSITION_B]); | ||
551 | } catch(ClassCastException e) { | ||
552 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
553 | return null; | ||
554 | } | ||
555 | } | ||
556 | |||
557 | @Override | ||
558 | protected Opposite.Match arrayToMatchMutable(final Object[] match) { | ||
559 | try { | ||
560 | return Opposite.Match.newMutableMatch((EReference) match[POSITION_A], (EReference) match[POSITION_B]); | ||
561 | } catch(ClassCastException e) { | ||
562 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
563 | return null; | ||
564 | } | ||
565 | } | ||
566 | |||
567 | /** | ||
568 | * @return the singleton instance of the query specification of this pattern | ||
569 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
570 | * | ||
571 | */ | ||
572 | public static IQuerySpecification<Opposite.Matcher> querySpecification() { | ||
573 | return Opposite.instance(); | ||
574 | } | ||
575 | } | ||
576 | |||
577 | private Opposite() { | ||
578 | super(GeneratedPQuery.INSTANCE); | ||
579 | } | ||
580 | |||
581 | /** | ||
582 | * @return the singleton instance of the query specification | ||
583 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
584 | * | ||
585 | */ | ||
586 | public static Opposite instance() { | ||
587 | try{ | ||
588 | return LazyHolder.INSTANCE; | ||
589 | } catch (ExceptionInInitializerError err) { | ||
590 | throw processInitializerError(err); | ||
591 | } | ||
592 | } | ||
593 | |||
594 | @Override | ||
595 | protected Opposite.Matcher instantiate(final ViatraQueryEngine engine) { | ||
596 | return Opposite.Matcher.on(engine); | ||
597 | } | ||
598 | |||
599 | @Override | ||
600 | public Opposite.Matcher instantiate() { | ||
601 | return Opposite.Matcher.create(); | ||
602 | } | ||
603 | |||
604 | @Override | ||
605 | public Opposite.Match newEmptyMatch() { | ||
606 | return Opposite.Match.newEmptyMatch(); | ||
607 | } | ||
608 | |||
609 | @Override | ||
610 | public Opposite.Match newMatch(final Object... parameters) { | ||
611 | return Opposite.Match.newMatch((org.eclipse.emf.ecore.EReference) parameters[0], (org.eclipse.emf.ecore.EReference) parameters[1]); | ||
612 | } | ||
613 | |||
614 | /** | ||
615 | * Inner class allowing the singleton instance of {@link JvmGenericType: queries.Opposite (visibility: PUBLIC, simpleName: Opposite, identifier: queries.Opposite, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
616 | * <b>not</b> at the class load time of the outer class, | ||
617 | * but rather at the first call to {@link JvmGenericType: queries.Opposite (visibility: PUBLIC, simpleName: Opposite, identifier: queries.Opposite, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
618 | * | ||
619 | * <p> This workaround is required e.g. to support recursion. | ||
620 | * | ||
621 | */ | ||
622 | private static class LazyHolder { | ||
623 | private static final Opposite INSTANCE = new Opposite(); | ||
624 | |||
625 | /** | ||
626 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
627 | * This initialization order is required to support indirect recursion. | ||
628 | * | ||
629 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
630 | * | ||
631 | */ | ||
632 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
633 | |||
634 | public static Object ensureInitialized() { | ||
635 | INSTANCE.ensureInitializedInternal(); | ||
636 | return null; | ||
637 | } | ||
638 | } | ||
639 | |||
640 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
641 | private static final Opposite.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
642 | |||
643 | private final PParameter parameter_a = new PParameter("a", "org.eclipse.emf.ecore.EReference", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EReference")), PParameterDirection.INOUT); | ||
644 | |||
645 | private final PParameter parameter_b = new PParameter("b", "org.eclipse.emf.ecore.EReference", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EReference")), PParameterDirection.INOUT); | ||
646 | |||
647 | private final List<PParameter> parameters = Arrays.asList(parameter_a, parameter_b); | ||
648 | |||
649 | private GeneratedPQuery() { | ||
650 | super(PVisibility.PUBLIC); | ||
651 | } | ||
652 | |||
653 | @Override | ||
654 | public String getFullyQualifiedName() { | ||
655 | return "queries.opposite"; | ||
656 | } | ||
657 | |||
658 | @Override | ||
659 | public List<String> getParameterNames() { | ||
660 | return Arrays.asList("a","b"); | ||
661 | } | ||
662 | |||
663 | @Override | ||
664 | public List<PParameter> getParameters() { | ||
665 | return parameters; | ||
666 | } | ||
667 | |||
668 | @Override | ||
669 | public Set<PBody> doGetContainedBodies() { | ||
670 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
671 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
672 | { | ||
673 | PBody body = new PBody(this); | ||
674 | PVariable var_a = body.getOrCreateVariableByName("a"); | ||
675 | PVariable var_b = body.getOrCreateVariableByName("b"); | ||
676 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
677 | new TypeConstraint(body, Tuples.flatTupleOf(var_b), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
678 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
679 | new ExportedParameter(body, var_a, parameter_a), | ||
680 | new ExportedParameter(body, var_b, parameter_b) | ||
681 | )); | ||
682 | // EReference.eOpposite(a,b) | ||
683 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
684 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
685 | new TypeConstraint(body, Tuples.flatTupleOf(var_a, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference", "eOpposite"))); | ||
686 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
687 | new Equality(body, var__virtual_0_, var_b); | ||
688 | bodies.add(body); | ||
689 | } | ||
690 | return bodies; | ||
691 | } | ||
692 | } | ||
693 | } | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/OppositeDifferentClass.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/OppositeDifferentClass.java new file mode 100644 index 00000000..05f3a312 --- /dev/null +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/OppositeDifferentClass.java | |||
@@ -0,0 +1,577 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/Ecore.vql | ||
3 | */ | ||
4 | package queries; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import org.apache.log4j.Logger; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.EReference; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
42 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
43 | |||
44 | /** | ||
45 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
46 | * | ||
47 | * <p>Original source: | ||
48 | * <code><pre> | ||
49 | * {@literal @}Constraint(key={a}, severity="error", message="error") | ||
50 | * pattern oppositeDifferentClass(a:EReference) { | ||
51 | * EReference.eOpposite(a,b); | ||
52 | * EReference.eContainingClass(a,aContaining); | ||
53 | * EReference.eType(b,bTarget); | ||
54 | * aContaining != bTarget; | ||
55 | * } | ||
56 | * </pre></code> | ||
57 | * | ||
58 | * @see Matcher | ||
59 | * @see Match | ||
60 | * | ||
61 | */ | ||
62 | @SuppressWarnings("all") | ||
63 | public final class OppositeDifferentClass extends BaseGeneratedEMFQuerySpecification<OppositeDifferentClass.Matcher> { | ||
64 | /** | ||
65 | * Pattern-specific match representation of the queries.oppositeDifferentClass pattern, | ||
66 | * to be used in conjunction with {@link Matcher}. | ||
67 | * | ||
68 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
69 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
70 | * usable to represent a match of the pattern in the result of a query, | ||
71 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
72 | * | ||
73 | * @see Matcher | ||
74 | * | ||
75 | */ | ||
76 | public static abstract class Match extends BasePatternMatch { | ||
77 | private EReference fA; | ||
78 | |||
79 | private static List<String> parameterNames = makeImmutableList("a"); | ||
80 | |||
81 | private Match(final EReference pA) { | ||
82 | this.fA = pA; | ||
83 | } | ||
84 | |||
85 | @Override | ||
86 | public Object get(final String parameterName) { | ||
87 | if ("a".equals(parameterName)) return this.fA; | ||
88 | return null; | ||
89 | } | ||
90 | |||
91 | public EReference getA() { | ||
92 | return this.fA; | ||
93 | } | ||
94 | |||
95 | @Override | ||
96 | public boolean set(final String parameterName, final Object newValue) { | ||
97 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
98 | if ("a".equals(parameterName) ) { | ||
99 | this.fA = (EReference) newValue; | ||
100 | return true; | ||
101 | } | ||
102 | return false; | ||
103 | } | ||
104 | |||
105 | public void setA(final EReference pA) { | ||
106 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
107 | this.fA = pA; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public String patternName() { | ||
112 | return "queries.oppositeDifferentClass"; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<String> parameterNames() { | ||
117 | return OppositeDifferentClass.Match.parameterNames; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public Object[] toArray() { | ||
122 | return new Object[]{fA}; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public OppositeDifferentClass.Match toImmutable() { | ||
127 | return isMutable() ? newMatch(fA) : this; | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public String prettyPrint() { | ||
132 | StringBuilder result = new StringBuilder(); | ||
133 | result.append("\"a\"=" + prettyPrintValue(fA)); | ||
134 | return result.toString(); | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public int hashCode() { | ||
139 | return Objects.hash(fA); | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public boolean equals(final Object obj) { | ||
144 | if (this == obj) | ||
145 | return true; | ||
146 | if (obj == null) { | ||
147 | return false; | ||
148 | } | ||
149 | if ((obj instanceof OppositeDifferentClass.Match)) { | ||
150 | OppositeDifferentClass.Match other = (OppositeDifferentClass.Match) obj; | ||
151 | return Objects.equals(fA, other.fA); | ||
152 | } else { | ||
153 | // this should be infrequent | ||
154 | if (!(obj instanceof IPatternMatch)) { | ||
155 | return false; | ||
156 | } | ||
157 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
158 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
159 | } | ||
160 | } | ||
161 | |||
162 | @Override | ||
163 | public OppositeDifferentClass specification() { | ||
164 | return OppositeDifferentClass.instance(); | ||
165 | } | ||
166 | |||
167 | /** | ||
168 | * Returns an empty, mutable match. | ||
169 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
170 | * | ||
171 | * @return the empty match. | ||
172 | * | ||
173 | */ | ||
174 | public static OppositeDifferentClass.Match newEmptyMatch() { | ||
175 | return new Mutable(null); | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * Returns a mutable (partial) match. | ||
180 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
181 | * | ||
182 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
183 | * @return the new, mutable (partial) match object. | ||
184 | * | ||
185 | */ | ||
186 | public static OppositeDifferentClass.Match newMutableMatch(final EReference pA) { | ||
187 | return new Mutable(pA); | ||
188 | } | ||
189 | |||
190 | /** | ||
191 | * Returns a new (partial) match. | ||
192 | * This can be used e.g. to call the matcher with a partial match. | ||
193 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
194 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
195 | * @return the (partial) match object. | ||
196 | * | ||
197 | */ | ||
198 | public static OppositeDifferentClass.Match newMatch(final EReference pA) { | ||
199 | return new Immutable(pA); | ||
200 | } | ||
201 | |||
202 | private static final class Mutable extends OppositeDifferentClass.Match { | ||
203 | Mutable(final EReference pA) { | ||
204 | super(pA); | ||
205 | } | ||
206 | |||
207 | @Override | ||
208 | public boolean isMutable() { | ||
209 | return true; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | private static final class Immutable extends OppositeDifferentClass.Match { | ||
214 | Immutable(final EReference pA) { | ||
215 | super(pA); | ||
216 | } | ||
217 | |||
218 | @Override | ||
219 | public boolean isMutable() { | ||
220 | return false; | ||
221 | } | ||
222 | } | ||
223 | } | ||
224 | |||
225 | /** | ||
226 | * Generated pattern matcher API of the queries.oppositeDifferentClass pattern, | ||
227 | * providing pattern-specific query methods. | ||
228 | * | ||
229 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
230 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
231 | * | ||
232 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
233 | * | ||
234 | * <p>Original source: | ||
235 | * <code><pre> | ||
236 | * {@literal @}Constraint(key={a}, severity="error", message="error") | ||
237 | * pattern oppositeDifferentClass(a:EReference) { | ||
238 | * EReference.eOpposite(a,b); | ||
239 | * EReference.eContainingClass(a,aContaining); | ||
240 | * EReference.eType(b,bTarget); | ||
241 | * aContaining != bTarget; | ||
242 | * } | ||
243 | * </pre></code> | ||
244 | * | ||
245 | * @see Match | ||
246 | * @see OppositeDifferentClass | ||
247 | * | ||
248 | */ | ||
249 | public static class Matcher extends BaseMatcher<OppositeDifferentClass.Match> { | ||
250 | /** | ||
251 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
252 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
253 | * | ||
254 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
255 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
256 | * | ||
257 | */ | ||
258 | public static OppositeDifferentClass.Matcher on(final ViatraQueryEngine engine) { | ||
259 | // check if matcher already exists | ||
260 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
261 | if (matcher == null) { | ||
262 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
263 | } | ||
264 | return matcher; | ||
265 | } | ||
266 | |||
267 | /** | ||
268 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
269 | * @return an initialized matcher | ||
270 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
271 | * | ||
272 | */ | ||
273 | public static OppositeDifferentClass.Matcher create() { | ||
274 | return new Matcher(); | ||
275 | } | ||
276 | |||
277 | private static final int POSITION_A = 0; | ||
278 | |||
279 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(OppositeDifferentClass.Matcher.class); | ||
280 | |||
281 | /** | ||
282 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
283 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
284 | * | ||
285 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
286 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
287 | * | ||
288 | */ | ||
289 | private Matcher() { | ||
290 | super(querySpecification()); | ||
291 | } | ||
292 | |||
293 | /** | ||
294 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
295 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
296 | * @return matches represented as a Match object. | ||
297 | * | ||
298 | */ | ||
299 | public Collection<OppositeDifferentClass.Match> getAllMatches(final EReference pA) { | ||
300 | return rawStreamAllMatches(new Object[]{pA}).collect(Collectors.toSet()); | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
305 | * </p> | ||
306 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
307 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
308 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
309 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
310 | * @return a stream of matches represented as a Match object. | ||
311 | * | ||
312 | */ | ||
313 | public Stream<OppositeDifferentClass.Match> streamAllMatches(final EReference pA) { | ||
314 | return rawStreamAllMatches(new Object[]{pA}); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
319 | * Neither determinism nor randomness of selection is guaranteed. | ||
320 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
321 | * @return a match represented as a Match object, or null if no match is found. | ||
322 | * | ||
323 | */ | ||
324 | public Optional<OppositeDifferentClass.Match> getOneArbitraryMatch(final EReference pA) { | ||
325 | return rawGetOneArbitraryMatch(new Object[]{pA}); | ||
326 | } | ||
327 | |||
328 | /** | ||
329 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
330 | * under any possible substitution of the unspecified parameters (if any). | ||
331 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
332 | * @return true if the input is a valid (partial) match of the pattern. | ||
333 | * | ||
334 | */ | ||
335 | public boolean hasMatch(final EReference pA) { | ||
336 | return rawHasMatch(new Object[]{pA}); | ||
337 | } | ||
338 | |||
339 | /** | ||
340 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
341 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
342 | * @return the number of pattern matches found. | ||
343 | * | ||
344 | */ | ||
345 | public int countMatches(final EReference pA) { | ||
346 | return rawCountMatches(new Object[]{pA}); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
351 | * Neither determinism nor randomness of selection is guaranteed. | ||
352 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
353 | * @param processor the action that will process the selected match. | ||
354 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
355 | * | ||
356 | */ | ||
357 | public boolean forOneArbitraryMatch(final EReference pA, final Consumer<? super OppositeDifferentClass.Match> processor) { | ||
358 | return rawForOneArbitraryMatch(new Object[]{pA}, processor); | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * Returns a new (partial) match. | ||
363 | * This can be used e.g. to call the matcher with a partial match. | ||
364 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
365 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
366 | * @return the (partial) match object. | ||
367 | * | ||
368 | */ | ||
369 | public OppositeDifferentClass.Match newMatch(final EReference pA) { | ||
370 | return OppositeDifferentClass.Match.newMatch(pA); | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * Retrieve the set of values that occur in matches for a. | ||
375 | * @return the Set of all values or empty set if there are no matches | ||
376 | * | ||
377 | */ | ||
378 | protected Stream<EReference> rawStreamAllValuesOfa(final Object[] parameters) { | ||
379 | return rawStreamAllValues(POSITION_A, parameters).map(EReference.class::cast); | ||
380 | } | ||
381 | |||
382 | /** | ||
383 | * Retrieve the set of values that occur in matches for a. | ||
384 | * @return the Set of all values or empty set if there are no matches | ||
385 | * | ||
386 | */ | ||
387 | public Set<EReference> getAllValuesOfa() { | ||
388 | return rawStreamAllValuesOfa(emptyArray()).collect(Collectors.toSet()); | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * Retrieve the set of values that occur in matches for a. | ||
393 | * @return the Set of all values or empty set if there are no matches | ||
394 | * | ||
395 | */ | ||
396 | public Stream<EReference> streamAllValuesOfa() { | ||
397 | return rawStreamAllValuesOfa(emptyArray()); | ||
398 | } | ||
399 | |||
400 | @Override | ||
401 | protected OppositeDifferentClass.Match tupleToMatch(final Tuple t) { | ||
402 | try { | ||
403 | return OppositeDifferentClass.Match.newMatch((EReference) t.get(POSITION_A)); | ||
404 | } catch(ClassCastException e) { | ||
405 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
406 | return null; | ||
407 | } | ||
408 | } | ||
409 | |||
410 | @Override | ||
411 | protected OppositeDifferentClass.Match arrayToMatch(final Object[] match) { | ||
412 | try { | ||
413 | return OppositeDifferentClass.Match.newMatch((EReference) match[POSITION_A]); | ||
414 | } catch(ClassCastException e) { | ||
415 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
416 | return null; | ||
417 | } | ||
418 | } | ||
419 | |||
420 | @Override | ||
421 | protected OppositeDifferentClass.Match arrayToMatchMutable(final Object[] match) { | ||
422 | try { | ||
423 | return OppositeDifferentClass.Match.newMutableMatch((EReference) match[POSITION_A]); | ||
424 | } catch(ClassCastException e) { | ||
425 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
426 | return null; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | /** | ||
431 | * @return the singleton instance of the query specification of this pattern | ||
432 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
433 | * | ||
434 | */ | ||
435 | public static IQuerySpecification<OppositeDifferentClass.Matcher> querySpecification() { | ||
436 | return OppositeDifferentClass.instance(); | ||
437 | } | ||
438 | } | ||
439 | |||
440 | private OppositeDifferentClass() { | ||
441 | super(GeneratedPQuery.INSTANCE); | ||
442 | } | ||
443 | |||
444 | /** | ||
445 | * @return the singleton instance of the query specification | ||
446 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
447 | * | ||
448 | */ | ||
449 | public static OppositeDifferentClass instance() { | ||
450 | try{ | ||
451 | return LazyHolder.INSTANCE; | ||
452 | } catch (ExceptionInInitializerError err) { | ||
453 | throw processInitializerError(err); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | @Override | ||
458 | protected OppositeDifferentClass.Matcher instantiate(final ViatraQueryEngine engine) { | ||
459 | return OppositeDifferentClass.Matcher.on(engine); | ||
460 | } | ||
461 | |||
462 | @Override | ||
463 | public OppositeDifferentClass.Matcher instantiate() { | ||
464 | return OppositeDifferentClass.Matcher.create(); | ||
465 | } | ||
466 | |||
467 | @Override | ||
468 | public OppositeDifferentClass.Match newEmptyMatch() { | ||
469 | return OppositeDifferentClass.Match.newEmptyMatch(); | ||
470 | } | ||
471 | |||
472 | @Override | ||
473 | public OppositeDifferentClass.Match newMatch(final Object... parameters) { | ||
474 | return OppositeDifferentClass.Match.newMatch((org.eclipse.emf.ecore.EReference) parameters[0]); | ||
475 | } | ||
476 | |||
477 | /** | ||
478 | * Inner class allowing the singleton instance of {@link JvmGenericType: queries.OppositeDifferentClass (visibility: PUBLIC, simpleName: OppositeDifferentClass, identifier: queries.OppositeDifferentClass, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
479 | * <b>not</b> at the class load time of the outer class, | ||
480 | * but rather at the first call to {@link JvmGenericType: queries.OppositeDifferentClass (visibility: PUBLIC, simpleName: OppositeDifferentClass, identifier: queries.OppositeDifferentClass, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
481 | * | ||
482 | * <p> This workaround is required e.g. to support recursion. | ||
483 | * | ||
484 | */ | ||
485 | private static class LazyHolder { | ||
486 | private static final OppositeDifferentClass INSTANCE = new OppositeDifferentClass(); | ||
487 | |||
488 | /** | ||
489 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
490 | * This initialization order is required to support indirect recursion. | ||
491 | * | ||
492 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
493 | * | ||
494 | */ | ||
495 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
496 | |||
497 | public static Object ensureInitialized() { | ||
498 | INSTANCE.ensureInitializedInternal(); | ||
499 | return null; | ||
500 | } | ||
501 | } | ||
502 | |||
503 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
504 | private static final OppositeDifferentClass.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
505 | |||
506 | private final PParameter parameter_a = new PParameter("a", "org.eclipse.emf.ecore.EReference", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EReference")), PParameterDirection.INOUT); | ||
507 | |||
508 | private final List<PParameter> parameters = Arrays.asList(parameter_a); | ||
509 | |||
510 | private GeneratedPQuery() { | ||
511 | super(PVisibility.PUBLIC); | ||
512 | } | ||
513 | |||
514 | @Override | ||
515 | public String getFullyQualifiedName() { | ||
516 | return "queries.oppositeDifferentClass"; | ||
517 | } | ||
518 | |||
519 | @Override | ||
520 | public List<String> getParameterNames() { | ||
521 | return Arrays.asList("a"); | ||
522 | } | ||
523 | |||
524 | @Override | ||
525 | public List<PParameter> getParameters() { | ||
526 | return parameters; | ||
527 | } | ||
528 | |||
529 | @Override | ||
530 | public Set<PBody> doGetContainedBodies() { | ||
531 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
532 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
533 | { | ||
534 | PBody body = new PBody(this); | ||
535 | PVariable var_a = body.getOrCreateVariableByName("a"); | ||
536 | PVariable var_b = body.getOrCreateVariableByName("b"); | ||
537 | PVariable var_aContaining = body.getOrCreateVariableByName("aContaining"); | ||
538 | PVariable var_bTarget = body.getOrCreateVariableByName("bTarget"); | ||
539 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
540 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
541 | new ExportedParameter(body, var_a, parameter_a) | ||
542 | )); | ||
543 | // EReference.eOpposite(a,b) | ||
544 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
545 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
546 | new TypeConstraint(body, Tuples.flatTupleOf(var_a, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference", "eOpposite"))); | ||
547 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
548 | new Equality(body, var__virtual_0_, var_b); | ||
549 | // EReference.eContainingClass(a,aContaining) | ||
550 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
551 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
552 | new TypeConstraint(body, Tuples.flatTupleOf(var_a, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EStructuralFeature", "eContainingClass"))); | ||
553 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass"))); | ||
554 | new Equality(body, var__virtual_1_, var_aContaining); | ||
555 | // EReference.eType(b,bTarget) | ||
556 | new TypeConstraint(body, Tuples.flatTupleOf(var_b), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EReference"))); | ||
557 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
558 | new TypeConstraint(body, Tuples.flatTupleOf(var_b, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "ETypedElement", "eType"))); | ||
559 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClassifier"))); | ||
560 | new Equality(body, var__virtual_2_, var_bTarget); | ||
561 | // aContaining != bTarget | ||
562 | new Inequality(body, var_aContaining, var_bTarget); | ||
563 | bodies.add(body); | ||
564 | } | ||
565 | { | ||
566 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
567 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
568 | new ParameterReference("a") | ||
569 | })); | ||
570 | annotation.addAttribute("severity", "error"); | ||
571 | annotation.addAttribute("message", "error"); | ||
572 | addAnnotation(annotation); | ||
573 | } | ||
574 | return bodies; | ||
575 | } | ||
576 | } | ||
577 | } | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src/ca/mcgill/ecse/socialnetwork/runner/Main.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src/ca/mcgill/ecse/socialnetwork/runner/Main.java index 9b426200..383852f1 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src/ca/mcgill/ecse/socialnetwork/runner/Main.java +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src/ca/mcgill/ecse/socialnetwork/runner/Main.java | |||
@@ -5,6 +5,7 @@ import java.io.FileNotFoundException; | |||
5 | import java.io.PrintStream; | 5 | import java.io.PrintStream; |
6 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
7 | import java.util.Map; | 7 | import java.util.Map; |
8 | import java.util.Scanner; | ||
8 | 9 | ||
9 | import ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator.app.Domain; | 10 | import ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator.app.Domain; |
10 | import ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator.distance.KSDistance; | 11 | import ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator.distance.KSDistance; |
@@ -28,13 +29,13 @@ public class Main { | |||
28 | private static String configFolder = "yakinduum/config22/"; | 29 | private static String configFolder = "yakinduum/config22/"; |
29 | private static String configFileName = configFolder + "info_old_metric.csv"; | 30 | private static String configFileName = configFolder + "info_old_metric.csv"; |
30 | private static String aggregateViolationMeasureFileName = configFolder + "aggregateInfo.csv"; | 31 | private static String aggregateViolationMeasureFileName = configFolder + "aggregateInfo.csv"; |
31 | private static String fileReadFolder = "output/Viatra_100/"; | 32 | private static String fileReadFolder = "output/Ecore_100/"; |
32 | 33 | ||
33 | public static void main(String args[]) { | 34 | public static void main(String args[]) { |
34 | 35 | String ecoreFile = args[0]; | |
35 | 36 | System.out.println("Generation Started"); | |
36 | long begin = System.currentTimeMillis(); | 37 | long begin = System.currentTimeMillis(); |
37 | String message = runWithPath("ecore.vsconfig"); | 38 | String message = runWithPath(ecoreFile); |
38 | long elapsed = System.currentTimeMillis() - begin; | 39 | long elapsed = System.currentTimeMillis() - begin; |
39 | 40 | ||
40 | if(message != null) { | 41 | if(message != null) { |
@@ -147,7 +148,7 @@ public class Main { | |||
147 | ArrayList<String> output = new ArrayList<String>(); | 148 | ArrayList<String> output = new ArrayList<String>(); |
148 | GraphReader reader = new GraphReader(YakindummPackage.eINSTANCE, ".xmi"); | 149 | GraphReader reader = new GraphReader(YakindummPackage.eINSTANCE, ".xmi"); |
149 | EMFGraph graph = reader.readModel(fileReadFolder+"/run"+run, run + "_1.xmi"); | 150 | EMFGraph graph = reader.readModel(fileReadFolder+"/run"+run, run + "_1.xmi"); |
150 | MetricSampleGroup metrics = RepMetricsReader.read(Domain.Yakinduum); | 151 | MetricSampleGroup metrics = RepMetricsReader.read(Domain.Yakindumm); |
151 | //KS distance | 152 | //KS distance |
152 | KSDistance ks = new KSDistance(metrics); | 153 | KSDistance ks = new KSDistance(metrics); |
153 | 154 | ||
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig b/Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig index d2414e87..4ce9da27 100644 --- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig +++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig | |||
@@ -9,13 +9,17 @@ generate { | |||
9 | solver = ViatraSolver | 9 | solver = ViatraSolver |
10 | 10 | ||
11 | scope = { | 11 | scope = { |
12 | #node = 1 | 12 | #node = 98 |
13 | } | 13 | } |
14 | 14 | ||
15 | number = 1 | 15 | number = 1 |
16 | runs = 1 | 16 | runs = 1 |
17 | config = { | 17 | config = { |
18 | log-level = none | 18 | log-level = none, |
19 | "optional-wf" = "true", | ||
20 | "realistic-guidance" = "Composite", | ||
21 | "allow-must-violations" = "true", | ||
22 | "domain" = "Yakindumm" | ||
19 | } | 23 | } |
20 | 24 | ||
21 | debug = "debug" | 25 | debug = "debug" |