aboutsummaryrefslogtreecommitdiffstats
path: root/Metrics/Metrics-Calculation/SocialNetwork_plugin
diff options
context:
space:
mode:
Diffstat (limited to 'Metrics/Metrics-Calculation/SocialNetwork_plugin')
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF2
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/bin/.gitignore2
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/mpc_rep/San.ecore104
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/mpc_rep/Sql.ecore (renamed from Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/Sql.ecore)0
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/rdm.ecore178
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/debug/errors.txt16
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig2
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml15
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/Ecore.vql26
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/ecore_pattern.vql8
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/constraints/ecore/.gitignore8
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/ecore/.gitignore8
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore4
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore.java22
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore_pattern.java53
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/MoreThenFiveSuperTypes.java611
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/SameSuperClass.java824
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/SuperTypes.java692
-rw-r--r--Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig10
19 files changed, 1571 insertions, 1014 deletions
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF b/Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF
index a3f5076e..833b6fd8 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/META-INF/MANIFEST.MF
@@ -8,6 +8,8 @@ Bundle-Vendor: %providerName
8Bundle-Localization: plugin 8Bundle-Localization: plugin
9Export-Package: ca.mcgill.ecse.socialnetwork.plugin, 9Export-Package: ca.mcgill.ecse.socialnetwork.plugin,
10 ca.mcgill.ecse.socialnetwork.runner, 10 ca.mcgill.ecse.socialnetwork.runner,
11 constraints.ecore,
12 ecore,
11 queries, 13 queries,
12 socialnetwork, 14 socialnetwork,
13 socialnetwork.impl, 15 socialnetwork.impl,
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/bin/.gitignore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/bin/.gitignore
index 8b962bcf..464c03f5 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/bin/.gitignore
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/bin/.gitignore
@@ -1,5 +1,7 @@
1/ca/ 1/ca/
2/constraints/
2/ecore.ecore 3/ecore.ecore
4/ecore/
3/queries/ 5/queries/
4/socialnetwork.aird 6/socialnetwork.aird
5/socialnetwork.ecore 7/socialnetwork.ecore
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
deleted file mode 100644
index 57088b0c..00000000
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/mpc_rep/San.ecore
+++ /dev/null
@@ -1,104 +0,0 @@
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/out_d_rep/Sql.ecore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/mpc_rep/Sql.ecore
index 65d72135..65d72135 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/Sql.ecore
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/mpc_rep/Sql.ecore
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/rdm.ecore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/rdm.ecore
new file mode 100644
index 00000000..5c01ab01
--- /dev/null
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/data/Ecore/out_d_rep/rdm.ecore
@@ -0,0 +1,178 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xmi:XMI 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">
3 <ecore:EPackage name="PrimitiveTypes">
4 <eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
5 <eClassifiers xsi:type="ecore:EDataType" name="Long"/>
6 <eClassifiers xsi:type="ecore:EDataType" name="Float"/>
7 <eClassifiers xsi:type="ecore:EDataType" name="Double"/>
8 <eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
9 <eClassifiers xsi:type="ecore:EDataType" name="String"/>
10 </ecore:EPackage>
11 <ecore:EPackage name="RDM">
12 <eClassifiers xsi:type="ecore:EClass" name="DifferentFrom" eSuperTypes="/1/PredicateSymbol"/>
13 <eClassifiers xsi:type="ecore:EClass" name="SameAs" eSuperTypes="/1/PredicateSymbol"/>
14 <eClassifiers xsi:type="ecore:EClass" name="IndividualVariable" eSuperTypes="/1/Variable">
15 <eStructuralFeatures xsi:type="ecore:EReference" name="classRef" ordered="false" eType="/1/ODM/Class"/>
16 </eClassifiers>
17 <eClassifiers xsi:type="ecore:EClass" name="DataVariable" eSuperTypes="/1/Variable"/>
18 <eClassifiers xsi:type="ecore:EClass" name="Constant" eSuperTypes="/1/Term"/>
19 <eClassifiers xsi:type="ecore:EClass" name="Variable" eSuperTypes="/1/Term">
20 <eStructuralFeatures xsi:type="ecore:EReference" name="type" ordered="false" eType="/1/ODM/Datatype"/>
21 <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
22 </eClassifiers>
23 <eClassifiers xsi:type="ecore:EClass" name="Term" abstract="true"/>
24 <eClassifiers xsi:type="ecore:EClass" name="BuiltIn" eSuperTypes="/1/PredicateSymbol">
25 <eStructuralFeatures xsi:type="ecore:EAttribute" name="buildInID" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
26 </eClassifiers>
27 <eClassifiers xsi:type="ecore:EClass" name="PredicateSymbol"/>
28 <eClassifiers xsi:type="ecore:EClass" name="Atom">
29 <eStructuralFeatures xsi:type="ecore:EReference" name="hasPredicateSymbol" ordered="false" lowerBound="1" eType="/1/PredicateSymbol"/>
30 <eStructuralFeatures xsi:type="ecore:EReference" name="terms" upperBound="-1" eType="/1/Term"/>
31 <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
32 </eClassifiers>
33 <eClassifiers xsi:type="ecore:EClass" name="Consequent">
34 <eStructuralFeatures xsi:type="ecore:EReference" name="containsAtom" ordered="false" upperBound="-1" eType="/1/Atom"/>
35 </eClassifiers>
36 <eClassifiers xsi:type="ecore:EClass" name="Antecedent">
37 <eStructuralFeatures xsi:type="ecore:EReference" name="containsAtom" ordered="false" upperBound="-1" eType="/1/Atom"/>
38 </eClassifiers>
39 <eClassifiers xsi:type="ecore:EClass" name="Rule" eSuperTypes="/1/ODM/OntologyElement">
40 <eStructuralFeatures xsi:type="ecore:EReference" name="hasAntecedent" ordered="false" lowerBound="1" eType="/1/Antecedent"/>
41 <eStructuralFeatures xsi:type="ecore:EReference" name="hasConsequent" ordered="false" lowerBound="1" eType="/1/Consequent"/>
42 </eClassifiers>
43 <eSubpackages name="ODM">
44 <eClassifiers xsi:type="ecore:EClass" name="MinCardinalityRestriction" eSuperTypes="/1/ODM/Restriction">
45 <eStructuralFeatures xsi:type="ecore:EReference" name="minCardinality" ordered="false" lowerBound="1" eType="/1/ODM/TypedLiteral"/>
46 </eClassifiers>
47 <eClassifiers xsi:type="ecore:EClass" name="MaxCardinalityRestriction" eSuperTypes="/1/ODM/Restriction">
48 <eStructuralFeatures xsi:type="ecore:EReference" name="maxCardinality" ordered="false" lowerBound="1" eType="/1/ODM/TypedLiteral"/>
49 </eClassifiers>
50 <eClassifiers xsi:type="ecore:EClass" name="CardinalityRestriction" eSuperTypes="/1/ODM/Restriction">
51 <eStructuralFeatures xsi:type="ecore:EReference" name="cardinality" ordered="false" lowerBound="1" eType="/1/ODM/TypedLiteral"/>
52 </eClassifiers>
53 <eClassifiers xsi:type="ecore:EClass" name="TransitiveProperty" eSuperTypes="/1/ODM/ObjectProperty"/>
54 <eClassifiers xsi:type="ecore:EClass" name="SymmetricProperty" eSuperTypes="/1/ODM/ObjectProperty"/>
55 <eClassifiers xsi:type="ecore:EClass" name="InverseFunctionalProperty" eSuperTypes="/1/ODM/ObjectProperty"/>
56 <eClassifiers xsi:type="ecore:EClass" name="FunctionalProperty" eSuperTypes="/1/ODM/Property"/>
57 <eClassifiers xsi:type="ecore:EClass" name="PlainLiteral" eSuperTypes="/1/ODM/Literal">
58 <eStructuralFeatures xsi:type="ecore:EAttribute" name="language" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
59 </eClassifiers>
60 <eClassifiers xsi:type="ecore:EClass" name="TypedLiteral" eSuperTypes="/1/ODM/Literal">
61 <eStructuralFeatures xsi:type="ecore:EAttribute" name="theType" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
62 </eClassifiers>
63 <eClassifiers xsi:type="ecore:EClass" name="Literal" abstract="true" eSuperTypes="/1/ODM/Datatype">
64 <eStructuralFeatures xsi:type="ecore:EAttribute" name="lexicalForm" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
65 </eClassifiers>
66 <eClassifiers xsi:type="ecore:EClass" name="Datatype" abstract="true" eSuperTypes="/1/ODM/OntologyElement"/>
67 <eClassifiers xsi:type="ecore:EClass" name="DataRange" eSuperTypes="/1/ODM/Class">
68 <eStructuralFeatures xsi:type="ecore:EReference" name="datatype" ordered="false" eType="/1/ODM/Datatype"/>
69 <eStructuralFeatures xsi:type="ecore:EReference" name="oneOf" ordered="false" upperBound="-1" eType="/1/ODM/Literal"/>
70 </eClassifiers>
71 <eClassifiers xsi:type="ecore:EClass" name="AllValuesFromRestriction" eSuperTypes="/1/ODM/Restriction">
72 <eStructuralFeatures xsi:type="ecore:EReference" name="allValuesFromRange" ordered="false" eType="/1/ODM/DataRange"/>
73 <eStructuralFeatures xsi:type="ecore:EReference" name="allValuesFromClass" ordered="false" eType="/1/ODM/Class"/>
74 </eClassifiers>
75 <eClassifiers xsi:type="ecore:EClass" name="SomeValuesFromRestriction" eSuperTypes="/1/ODM/Restriction">
76 <eStructuralFeatures xsi:type="ecore:EReference" name="someValuesFromClass" ordered="false" eType="/1/ODM/Class"/>
77 <eStructuralFeatures xsi:type="ecore:EReference" name="someValuesFromRange" ordered="false" eType="/1/ODM/DataRange"/>
78 </eClassifiers>
79 <eClassifiers xsi:type="ecore:EClass" name="OntologyPropertyValue" eSuperTypes="/1/ODM/OntologyProperty"/>
80 <eClassifiers xsi:type="ecore:EClass" name="URI" eSuperTypes="/1/ODM/Annotation"/>
81 <eClassifiers xsi:type="ecore:EClass" name="Annotation" abstract="true"/>
82 <eClassifiers xsi:type="ecore:EClass" name="AnnotationPropertyValue">
83 <eStructuralFeatures xsi:type="ecore:EReference" name="object" ordered="false" lowerBound="1" eType="/1/ODM/Annotation"/>
84 <eStructuralFeatures xsi:type="ecore:EReference" name="subject" ordered="false" lowerBound="1" eType="/1/ODM/AnnotatableElement"/>
85 <eStructuralFeatures xsi:type="ecore:EReference" name="type" ordered="false" lowerBound="1" eType="/1/ODM/AnnotationProperty"/>
86 </eClassifiers>
87 <eClassifiers xsi:type="ecore:EClass" name="EnumeratedDatatype" eSuperTypes="/1/ODM/Datatype">
88 <eStructuralFeatures xsi:type="ecore:EReference" name="collectionOf" ordered="false" upperBound="-1" eType="/1/ODM/DataValue"/>
89 </eClassifiers>
90 <eClassifiers xsi:type="ecore:EClass" name="PrimitiveType" eSuperTypes="/1/ODM/Datatype"/>
91 <eClassifiers xsi:type="ecore:EClass" name="HasValueRestriction" eSuperTypes="/1/ODM/Restriction">
92 <eStructuralFeatures xsi:type="ecore:EReference" name="hasLiteralValue" ordered="false" eType="/1/ODM/Literal"/>
93 <eStructuralFeatures xsi:type="ecore:EReference" name="hasValue" ordered="false" eType="/1/ODM/Individual"/>
94 </eClassifiers>
95 <eClassifiers xsi:type="ecore:EClass" name="Restriction" abstract="true" eSuperTypes="/1/ODM/Class">
96 <eStructuralFeatures xsi:type="ecore:EReference" name="onProperty" ordered="false" upperBound="-1" eType="/1/ODM/Property"/>
97 <eStructuralFeatures xsi:type="ecore:EReference" name="toDatatype" ordered="false" eType="/1/ODM/Datatype"/>
98 </eClassifiers>
99 <eClassifiers xsi:type="ecore:EClass" name="AllDiferent" eSuperTypes="/1/ODM/Class">
100 <eStructuralFeatures xsi:type="ecore:EReference" name="distinctMembers" ordered="false" upperBound="-1" eType="/1/ODM/Individual"/>
101 </eClassifiers>
102 <eClassifiers xsi:type="ecore:EClass" name="DataValue" eSuperTypes="/1/Constant /1/ODM/Annotation">
103 <eStructuralFeatures xsi:type="ecore:EReference" name="type" ordered="false" lowerBound="1" eType="/1/ODM/Datatype"/>
104 <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
105 </eClassifiers>
106 <eClassifiers xsi:type="ecore:EClass" name="DatatypePropertyValue" eSuperTypes="/1/ODM/PropertyValue">
107 <eStructuralFeatures xsi:type="ecore:EReference" name="object" ordered="false" lowerBound="1" eType="/1/ODM/DataValue"/>
108 </eClassifiers>
109 <eClassifiers xsi:type="ecore:EClass" name="ObjectPropertyValue" eSuperTypes="/1/ODM/PropertyValue">
110 <eStructuralFeatures xsi:type="ecore:EReference" name="object" ordered="false" lowerBound="1" eType="/1/ODM/Individual"/>
111 </eClassifiers>
112 <eClassifiers xsi:type="ecore:EClass" name="PropertyValue" abstract="true">
113 <eStructuralFeatures xsi:type="ecore:EReference" name="subject" ordered="false" lowerBound="1" eType="/1/ODM/Individual"/>
114 </eClassifiers>
115 <eClassifiers xsi:type="ecore:EClass" name="UnionClass" eSuperTypes="/1/ODM/Class">
116 <eStructuralFeatures xsi:type="ecore:EReference" name="unionOf" ordered="false" upperBound="-1" eType="/1/ODM/Class"/>
117 </eClassifiers>
118 <eClassifiers xsi:type="ecore:EClass" name="IntersectionClass" eSuperTypes="/1/ODM/Class">
119 <eStructuralFeatures xsi:type="ecore:EReference" name="intersectionOf" ordered="false" upperBound="-1" eType="/1/ODM/Class"/>
120 </eClassifiers>
121 <eClassifiers xsi:type="ecore:EClass" name="ComplementClass" eSuperTypes="/1/ODM/Class">
122 <eStructuralFeatures xsi:type="ecore:EReference" name="complementOf" ordered="false" lowerBound="1" eType="/1/ODM/Class"/>
123 </eClassifiers>
124 <eClassifiers xsi:type="ecore:EClass" name="EnumeratedClass" eSuperTypes="/1/ODM/Class">
125 <eStructuralFeatures xsi:type="ecore:EReference" name="oneOf" ordered="false" upperBound="-1" eType="/1/ODM/Individual"/>
126 </eClassifiers>
127 <eClassifiers xsi:type="ecore:EClass" name="Namespace">
128 <eStructuralFeatures xsi:type="ecore:EReference" name="members" ordered="false" upperBound="-1" eType="/1/ODM/NamedElement" containment="true"/>
129 <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
130 <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
131 </eClassifiers>
132 <eClassifiers xsi:type="ecore:EClass" name="DatatypeProperty" eSuperTypes="/1/ODM/Property">
133 <eStructuralFeatures xsi:type="ecore:EReference" name="range" ordered="false" upperBound="-1" eType="/1/ODM/DataRange"/>
134 </eClassifiers>
135 <eClassifiers xsi:type="ecore:EClass" name="ObjectProperty" eSuperTypes="/1/ODM/Property">
136 <eStructuralFeatures xsi:type="ecore:EReference" name="range" ordered="false" upperBound="-1" eType="/1/ODM/Class"/>
137 <eStructuralFeatures xsi:type="ecore:EReference" name="inverseOf" ordered="false" upperBound="-1" eType="/1/ODM/ObjectProperty"/>
138 <eStructuralFeatures xsi:type="ecore:EAttribute" name="transitive" ordered="false" unique="false" lowerBound="1" eType="/0/Boolean"/>
139 <eStructuralFeatures xsi:type="ecore:EAttribute" name="symmetric" ordered="false" unique="false" lowerBound="1" eType="/0/Boolean"/>
140 <eStructuralFeatures xsi:type="ecore:EAttribute" name="inverseFunctional" ordered="false" unique="false" lowerBound="1" eType="/0/Boolean"/>
141 <eStructuralFeatures xsi:type="ecore:EAttribute" name="complex" ordered="false" unique="false" lowerBound="1" eType="/0/Boolean"/>
142 </eClassifiers>
143 <eClassifiers xsi:type="ecore:EClass" name="Individual" eSuperTypes="/1/Constant /1/ODM/Annotation /1/ODM/Class">
144 <eStructuralFeatures xsi:type="ecore:EReference" name="sameAs" ordered="false" upperBound="-1" eType="/1/ODM/Individual"/>
145 <eStructuralFeatures xsi:type="ecore:EReference" name="differentFrom" ordered="false" upperBound="-1" eType="/1/ODM/Individual"/>
146 <eStructuralFeatures xsi:type="ecore:EReference" name="type" ordered="false" lowerBound="1" eType="/1/ODM/Class"/>
147 </eClassifiers>
148 <eClassifiers xsi:type="ecore:EClass" name="Class" eSuperTypes="/1/PredicateSymbol /1/ODM/OntologyElement">
149 <eStructuralFeatures xsi:type="ecore:EReference" name="disjointWith" ordered="false" upperBound="-1" eType="/1/ODM/Class"/>
150 <eStructuralFeatures xsi:type="ecore:EReference" name="subClassOf" ordered="false" upperBound="-1" eType="/1/ODM/Class"/>
151 <eStructuralFeatures xsi:type="ecore:EReference" name="equivalentClass" ordered="false" upperBound="-1" eType="/1/ODM/Class"/>
152 </eClassifiers>
153 <eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true" eSuperTypes="/1/PredicateSymbol /1/ODM/OntologyElement">
154 <eStructuralFeatures xsi:type="ecore:EReference" name="domain" ordered="false" upperBound="-1" eType="/1/ODM/Class"/>
155 <eStructuralFeatures xsi:type="ecore:EReference" name="equivalentProperty" ordered="false" upperBound="-1" eType="/1/ODM/Property"/>
156 <eStructuralFeatures xsi:type="ecore:EReference" name="subPropertyOf" ordered="false" upperBound="-1" eType="/1/ODM/Property"/>
157 <eStructuralFeatures xsi:type="ecore:EAttribute" name="deprecated" ordered="false" unique="false" lowerBound="1" eType="/0/Boolean"/>
158 <eStructuralFeatures xsi:type="ecore:EAttribute" name="functional" ordered="false" unique="false" lowerBound="1" eType="/0/Boolean"/>
159 </eClassifiers>
160 <eClassifiers xsi:type="ecore:EClass" name="AnnotationProperty" eSuperTypes="/1/ODM/OntologyElement"/>
161 <eClassifiers xsi:type="ecore:EClass" name="OntologyProperty" abstract="true" eSuperTypes="/1/ODM/OntologyElement"/>
162 <eClassifiers xsi:type="ecore:EClass" name="OntologyElement" eSuperTypes="/1/ODM/NamedElement /1/ODM/AnnotatableElement"/>
163 <eClassifiers xsi:type="ecore:EClass" name="Ontology" eSuperTypes="/1/ODM/AnnotatableElement">
164 <eStructuralFeatures xsi:type="ecore:EReference" name="imports" ordered="false" upperBound="-1" eType="/1/ODM/Ontology"/>
165 <eStructuralFeatures xsi:type="ecore:EReference" name="priorVersion" ordered="false" eType="/1/ODM/Ontology"/>
166 <eStructuralFeatures xsi:type="ecore:EReference" name="elements" ordered="false" upperBound="-1" eType="/1/ODM/NamedElement" containment="true"/>
167 <eStructuralFeatures xsi:type="ecore:EReference" name="incompatibleWith" ordered="false" upperBound="-1" eType="/1/ODM/Ontology"/>
168 <eStructuralFeatures xsi:type="ecore:EReference" name="reference" ordered="false" upperBound="-1" eType="/1/ODM/OntologyPropertyValue"/>
169 </eClassifiers>
170 <eClassifiers xsi:type="ecore:EClass" name="AnnotatableElement" abstract="true"/>
171 <eClassifiers xsi:type="ecore:EClass" name="NamedElement">
172 <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
173 <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
174 <eStructuralFeatures xsi:type="ecore:EAttribute" name="qualifiedName" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
175 </eClassifiers>
176 </eSubpackages>
177 </ecore:EPackage>
178</xmi:XMI>
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/debug/errors.txt b/Metrics/Metrics-Calculation/SocialNetwork_plugin/debug/errors.txt
index e4925b3c..fb05996a 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/debug/errors.txt
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/debug/errors.txt
@@ -1,10 +1,12 @@
1Error occured (IllegalArgumentException): Class EObject is not translated to logic! 1Error occured (NullPointerException):
2 hu.bme.mit.inf.dslreasoner.ecore2logic.EClassMapper_AllElementAsObject.TypeofEClass(EClassMapper_AllElementAsObject.java:63) 2 hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder.toTypeReference(LogicProblemBuilder.java:302)
3 hu.bme.mit.inf.dslreasoner.ecore2logic.EReferenceMapper_RelationsOverTypes.createIndicatorDeclarations(EReferenceMapper_RelationsOverTypes.java:88) 3 hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder.lambda$11(LogicProblemBuilder.java:313)
4 hu.bme.mit.inf.dslreasoner.ecore2logic.EReferenceMapper_RelationsOverTypes.transformEReferences(EReferenceMapper_RelationsOverTypes.java:67) 4 org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_doubleArrow(ObjectExtensions.java:139)
5 hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic.transformEReferences(Ecore2Logic.java:120) 5 hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder.createVar(LogicProblemBuilder.java:315)
6 hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic.transformMetamodel(Ecore2Logic.java:81) 6 hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic.transformBody(Viatra2Logic.java:335)
7 hu.bme.mit.inf.dslreasoner.application.execution.GenerationTaskExecutor.executeGenerationTask(GenerationTaskExecutor.java:189) 7 hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic.transformQuerySpecification(Viatra2Logic.java:237)
8 hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic.transformQueries(Viatra2Logic.java:149)
9 hu.bme.mit.inf.dslreasoner.application.execution.GenerationTaskExecutor.executeGenerationTask(GenerationTaskExecutor.java:196)
8 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor._execute(ScriptExecutor.java:129) 10 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) 11 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) 12 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.executeScript(ScriptExecutor.java:110)
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig b/Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig
index 7da4f563..ff9155a4 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/ecore.vsconfig
@@ -32,7 +32,7 @@ generate {
32 } 32 }
33 33
34 number = 1 34 number = 1
35 runs = 1 35 runs = 30
36 config = { 36 config = {
37 log-level = none, 37 log-level = none,
38 "optional-wf" = "true", 38 "optional-wf" = "true",
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml b/Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml
index 975fd574..269d4b7b 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/plugin.xml
@@ -4,14 +4,6 @@
4 <!-- @generated socialnetwork --> 4 <!-- @generated socialnetwork -->
5 <package class="socialnetwork.SocialnetworkPackage" genModel="model/socialnetwork.genmodel" uri="http://ecse.mcgill.ca/socialnetwork"/> 5 <package class="socialnetwork.SocialnetworkPackage" genModel="model/socialnetwork.genmodel" uri="http://ecse.mcgill.ca/socialnetwork"/>
6 </extension> 6 </extension>
7 <extension id="ca.mcgill.ecse.socialnetwork.plugin.Queries" point="org.eclipse.viatra.query.runtime.queryspecification">
8 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:ca.mcgill.ecse.socialnetwork.plugin.Queries" id="ca.mcgill.ecse.socialnetwork.plugin.Queries">
9 <query-specification fqn="ca.mcgill.ecse.socialnetwork.plugin.singleFriendship"/>
10 <query-specification fqn="ca.mcgill.ecse.socialnetwork.plugin.noFriend"/>
11 <query-specification fqn="ca.mcgill.ecse.socialnetwork.plugin.selfFriend"/>
12 <query-specification fqn="ca.mcgill.ecse.socialnetwork.plugin.friendship"/>
13 </group>
14 </extension>
15 <extension id="queries.Ecore" point="org.eclipse.viatra.query.runtime.queryspecification"> 7 <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"> 8 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.Ecore" id="queries.Ecore">
17 <query-specification fqn="queries.directSupertype"/> 9 <query-specification fqn="queries.directSupertype"/>
@@ -19,11 +11,8 @@
19 <query-specification fqn="queries.opposite"/> 11 <query-specification fqn="queries.opposite"/>
20 <query-specification fqn="queries.oppositeDifferentClass"/> 12 <query-specification fqn="queries.oppositeDifferentClass"/>
21 <query-specification fqn="queries.nonSymmetricOpposite"/> 13 <query-specification fqn="queries.nonSymmetricOpposite"/>
22 </group> 14 <query-specification fqn="queries.superTypes"/>
23 </extension> 15 <query-specification fqn="queries.moreThenFiveSuperTypes"/>
24 <extension id="queries.Ecore_pattern" point="org.eclipse.viatra.query.runtime.queryspecification">
25 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.Ecore_pattern" id="queries.Ecore_pattern">
26 <query-specification fqn="queries.sameSuperClass"/>
27 </group> 16 </group>
28 </extension> 17 </extension>
29</plugin> 18</plugin>
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/Ecore.vql b/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/Ecore.vql
index 3b0e7fd9..315e7d34 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/Ecore.vql
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/Ecore.vql
@@ -26,4 +26,28 @@ pattern oppositeDifferentClass(a:EReference) {
26pattern nonSymmetricOpposite(a:EReference, b:EReference) { 26pattern nonSymmetricOpposite(a:EReference, b:EReference) {
27 find opposite(a,b); 27 find opposite(a,b);
28 neg find opposite(b,a); 28 neg find opposite(b,a);
29} \ No newline at end of file 29}
30
31pattern superTypes(c1:EClass, c2:EClass){
32 EClass.eSuperTypes(c1,c2);
33}
34
35@Constraint(severity="error", message="error", key = {c})
36pattern moreThenFiveSuperTypes(c: EClass){
37 find superTypes(c1, s1);
38 find superTypes(c1, s2);
39 find superTypes(c1, s3);
40 find superTypes(c1, s4);
41 find superTypes(c1, s5);
42 s1 != s2;
43 s1 != s3;
44 s1 != s4;
45 s1 != s5;
46 s2 != s3;
47 s2 != s4;
48 s2 != s5;
49 s3 != s4;
50 s3 != s5;
51 s4 != s5;
52}
53
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/ecore_pattern.vql b/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/ecore_pattern.vql
index a6f384d9..7e51dc69 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/ecore_pattern.vql
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/queries/queries/ecore_pattern.vql
@@ -1,9 +1,9 @@
1package queries 1package queries
2import epackage "http://www.eclipse.org/emf/2002/Ecore" 2import epackage "http://www.eclipse.org/emf/2002/Ecore"
3 3
4
4@Constraint(severity="error", message="error", key = {c}) 5@Constraint(severity="error", message="error", key = {c})
5pattern sameSuperClass(c : EClass, s1 : EClass, s2: EClass) { 6pattern moreThenFiveSuperTypes(c: EClass){
6 EClass.eSuperTypes(c, s1); 7 m == count EClass.eSuperTypes(c,_);
7 EClass.eSuperTypes(c, s2); 8 check(m >= 5);
8 s1 == s2;
9} \ No newline at end of file 9} \ No newline at end of file
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/constraints/ecore/.gitignore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/constraints/ecore/.gitignore
new file mode 100644
index 00000000..c42ca056
--- /dev/null
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/constraints/ecore/.gitignore
@@ -0,0 +1,8 @@
1/.Ecore_pattern.java._trace
2/.MoreThenFiveSuperTypes.java._trace
3/.DirectSupertype.java._trace
4/.Ecore.java._trace
5/.LoopInInheritence.java._trace
6/.NonSymmetricOpposite.java._trace
7/.Opposite.java._trace
8/.OppositeDifferentClass.java._trace
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/ecore/.gitignore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/ecore/.gitignore
new file mode 100644
index 00000000..c42ca056
--- /dev/null
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/ecore/.gitignore
@@ -0,0 +1,8 @@
1/.Ecore_pattern.java._trace
2/.MoreThenFiveSuperTypes.java._trace
3/.DirectSupertype.java._trace
4/.Ecore.java._trace
5/.LoopInInheritence.java._trace
6/.NonSymmetricOpposite.java._trace
7/.Opposite.java._trace
8/.OppositeDifferentClass.java._trace
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore
index 9ceca817..e9d711d4 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/.gitignore
@@ -1,9 +1,9 @@
1/.Ecore_pattern.java._trace 1/.Ecore_pattern.java._trace
2/.MultipleTransitionFromEntry.java._trace 2/.MoreThenFiveSuperTypes.java._trace
3/.SameSuperClass.java._trace
4/.DirectSupertype.java._trace 3/.DirectSupertype.java._trace
5/.Ecore.java._trace 4/.Ecore.java._trace
6/.LoopInInheritence.java._trace 5/.LoopInInheritence.java._trace
7/.NonSymmetricOpposite.java._trace 6/.NonSymmetricOpposite.java._trace
8/.Opposite.java._trace 7/.Opposite.java._trace
9/.OppositeDifferentClass.java._trace 8/.OppositeDifferentClass.java._trace
9/.SuperTypes.java._trace
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore.java
index e4f254d3..ebafb74b 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore.java
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore.java
@@ -7,9 +7,11 @@ import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
7import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; 7import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
8import queries.DirectSupertype; 8import queries.DirectSupertype;
9import queries.LoopInInheritence; 9import queries.LoopInInheritence;
10import queries.MoreThenFiveSuperTypes;
10import queries.NonSymmetricOpposite; 11import queries.NonSymmetricOpposite;
11import queries.Opposite; 12import queries.Opposite;
12import queries.OppositeDifferentClass; 13import queries.OppositeDifferentClass;
14import queries.SuperTypes;
13 15
14/** 16/**
15 * A pattern group formed of all public patterns defined in Ecore.vql. 17 * A pattern group formed of all public patterns defined in Ecore.vql.
@@ -24,6 +26,8 @@ import queries.OppositeDifferentClass;
24 * <li>opposite</li> 26 * <li>opposite</li>
25 * <li>oppositeDifferentClass</li> 27 * <li>oppositeDifferentClass</li>
26 * <li>nonSymmetricOpposite</li> 28 * <li>nonSymmetricOpposite</li>
29 * <li>superTypes</li>
30 * <li>moreThenFiveSuperTypes</li>
27 * </ul> 31 * </ul>
28 * 32 *
29 * @see IQueryGroup 33 * @see IQueryGroup
@@ -53,6 +57,8 @@ public final class Ecore extends BaseGeneratedPatternGroup {
53 querySpecifications.add(Opposite.instance()); 57 querySpecifications.add(Opposite.instance());
54 querySpecifications.add(OppositeDifferentClass.instance()); 58 querySpecifications.add(OppositeDifferentClass.instance());
55 querySpecifications.add(NonSymmetricOpposite.instance()); 59 querySpecifications.add(NonSymmetricOpposite.instance());
60 querySpecifications.add(SuperTypes.instance());
61 querySpecifications.add(MoreThenFiveSuperTypes.instance());
56 } 62 }
57 63
58 public DirectSupertype getDirectSupertype() { 64 public DirectSupertype getDirectSupertype() {
@@ -94,4 +100,20 @@ public final class Ecore extends BaseGeneratedPatternGroup {
94 public NonSymmetricOpposite.Matcher getNonSymmetricOpposite(final ViatraQueryEngine engine) { 100 public NonSymmetricOpposite.Matcher getNonSymmetricOpposite(final ViatraQueryEngine engine) {
95 return NonSymmetricOpposite.Matcher.on(engine); 101 return NonSymmetricOpposite.Matcher.on(engine);
96 } 102 }
103
104 public SuperTypes getSuperTypes() {
105 return SuperTypes.instance();
106 }
107
108 public SuperTypes.Matcher getSuperTypes(final ViatraQueryEngine engine) {
109 return SuperTypes.Matcher.on(engine);
110 }
111
112 public MoreThenFiveSuperTypes getMoreThenFiveSuperTypes() {
113 return MoreThenFiveSuperTypes.instance();
114 }
115
116 public MoreThenFiveSuperTypes.Matcher getMoreThenFiveSuperTypes(final ViatraQueryEngine engine) {
117 return MoreThenFiveSuperTypes.Matcher.on(engine);
118 }
97} 119}
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore_pattern.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore_pattern.java
deleted file mode 100644
index e2627646..00000000
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/Ecore_pattern.java
+++ /dev/null
@@ -1,53 +0,0 @@
1/**
2 * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/ecore_pattern.vql
3 */
4package queries;
5
6import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
7import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
8import queries.SameSuperClass;
9
10/**
11 * A pattern group formed of all public patterns defined in ecore_pattern.vql.
12 *
13 * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare
14 * a VIATRA Query engine for matching all patterns originally defined in file ecore_pattern.vql,
15 * in order to achieve better performance than one-by-one on-demand matcher initialization.
16 *
17 * <p> From package queries, the group contains the definition of the following patterns: <ul>
18 * <li>sameSuperClass</li>
19 * </ul>
20 *
21 * @see IQueryGroup
22 *
23 */
24@SuppressWarnings("all")
25public final class Ecore_pattern extends BaseGeneratedPatternGroup {
26 /**
27 * Access the pattern group.
28 *
29 * @return the singleton instance of the group
30 * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications
31 *
32 */
33 public static Ecore_pattern instance() {
34 if (INSTANCE == null) {
35 INSTANCE = new Ecore_pattern();
36 }
37 return INSTANCE;
38 }
39
40 private static Ecore_pattern INSTANCE;
41
42 private Ecore_pattern() {
43 querySpecifications.add(SameSuperClass.instance());
44 }
45
46 public SameSuperClass getSameSuperClass() {
47 return SameSuperClass.instance();
48 }
49
50 public SameSuperClass.Matcher getSameSuperClass(final ViatraQueryEngine engine) {
51 return SameSuperClass.Matcher.on(engine);
52 }
53}
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/MoreThenFiveSuperTypes.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/MoreThenFiveSuperTypes.java
new file mode 100644
index 00000000..867ffd01
--- /dev/null
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/MoreThenFiveSuperTypes.java
@@ -0,0 +1,611 @@
1/**
2 * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/Ecore.vql
3 */
4package queries;
5
6import java.util.Arrays;
7import java.util.Collection;
8import java.util.LinkedHashSet;
9import java.util.List;
10import java.util.Objects;
11import java.util.Optional;
12import java.util.Set;
13import java.util.function.Consumer;
14import java.util.stream.Collectors;
15import java.util.stream.Stream;
16import org.apache.log4j.Logger;
17import org.eclipse.emf.ecore.EClass;
18import org.eclipse.viatra.query.runtime.api.IPatternMatch;
19import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
20import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
21import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
24import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
25import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
26import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
27import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
28import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
29import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
30import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
41import queries.SuperTypes;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * {@literal @}Constraint(severity="error", message="error", key = {c})
49 * pattern moreThenFiveSuperTypes(c: EClass){
50 * find superTypes(c1, s1);
51 * find superTypes(c1, s2);
52 * find superTypes(c1, s3);
53 * find superTypes(c1, s4);
54 * find superTypes(c1, s5);
55 * s1 != s2;
56 * s1 != s3;
57 * s1 != s4;
58 * s1 != s5;
59 * s2 != s3;
60 * s2 != s4;
61 * s2 != s5;
62 * s3 != s4;
63 * s3 != s5;
64 * s4 != s5;
65 * }
66 * </pre></code>
67 *
68 * @see Matcher
69 * @see Match
70 *
71 */
72@SuppressWarnings("all")
73public final class MoreThenFiveSuperTypes extends BaseGeneratedEMFQuerySpecification<MoreThenFiveSuperTypes.Matcher> {
74 /**
75 * Pattern-specific match representation of the queries.moreThenFiveSuperTypes pattern,
76 * to be used in conjunction with {@link Matcher}.
77 *
78 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
79 * Each instance is a (possibly partial) substitution of pattern parameters,
80 * usable to represent a match of the pattern in the result of a query,
81 * or to specify the bound (fixed) input parameters when issuing a query.
82 *
83 * @see Matcher
84 *
85 */
86 public static abstract class Match extends BasePatternMatch {
87 private EClass fC;
88
89 private static List<String> parameterNames = makeImmutableList("c");
90
91 private Match(final EClass pC) {
92 this.fC = pC;
93 }
94
95 @Override
96 public Object get(final String parameterName) {
97 if ("c".equals(parameterName)) return this.fC;
98 return null;
99 }
100
101 public EClass getC() {
102 return this.fC;
103 }
104
105 @Override
106 public boolean set(final String parameterName, final Object newValue) {
107 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
108 if ("c".equals(parameterName) ) {
109 this.fC = (EClass) newValue;
110 return true;
111 }
112 return false;
113 }
114
115 public void setC(final EClass pC) {
116 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
117 this.fC = pC;
118 }
119
120 @Override
121 public String patternName() {
122 return "queries.moreThenFiveSuperTypes";
123 }
124
125 @Override
126 public List<String> parameterNames() {
127 return MoreThenFiveSuperTypes.Match.parameterNames;
128 }
129
130 @Override
131 public Object[] toArray() {
132 return new Object[]{fC};
133 }
134
135 @Override
136 public MoreThenFiveSuperTypes.Match toImmutable() {
137 return isMutable() ? newMatch(fC) : this;
138 }
139
140 @Override
141 public String prettyPrint() {
142 StringBuilder result = new StringBuilder();
143 result.append("\"c\"=" + prettyPrintValue(fC));
144 return result.toString();
145 }
146
147 @Override
148 public int hashCode() {
149 return Objects.hash(fC);
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 MoreThenFiveSuperTypes.Match)) {
160 MoreThenFiveSuperTypes.Match other = (MoreThenFiveSuperTypes.Match) obj;
161 return Objects.equals(fC, other.fC);
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 MoreThenFiveSuperTypes specification() {
174 return MoreThenFiveSuperTypes.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 MoreThenFiveSuperTypes.Match newEmptyMatch() {
185 return new Mutable(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 pC the fixed value of pattern parameter c, or null if not bound.
193 * @return the new, mutable (partial) match object.
194 *
195 */
196 public static MoreThenFiveSuperTypes.Match newMutableMatch(final EClass pC) {
197 return new Mutable(pC);
198 }
199
200 /**
201 * Returns a new (partial) match.
202 * This can be used e.g. to call the matcher with a partial match.
203 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
204 * @param pC the fixed value of pattern parameter c, or null if not bound.
205 * @return the (partial) match object.
206 *
207 */
208 public static MoreThenFiveSuperTypes.Match newMatch(final EClass pC) {
209 return new Immutable(pC);
210 }
211
212 private static final class Mutable extends MoreThenFiveSuperTypes.Match {
213 Mutable(final EClass pC) {
214 super(pC);
215 }
216
217 @Override
218 public boolean isMutable() {
219 return true;
220 }
221 }
222
223 private static final class Immutable extends MoreThenFiveSuperTypes.Match {
224 Immutable(final EClass pC) {
225 super(pC);
226 }
227
228 @Override
229 public boolean isMutable() {
230 return false;
231 }
232 }
233 }
234
235 /**
236 * Generated pattern matcher API of the queries.moreThenFiveSuperTypes pattern,
237 * providing pattern-specific query methods.
238 *
239 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
240 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
241 *
242 * <p>Matches of the pattern will be represented as {@link Match}.
243 *
244 * <p>Original source:
245 * <code><pre>
246 * {@literal @}Constraint(severity="error", message="error", key = {c})
247 * pattern moreThenFiveSuperTypes(c: EClass){
248 * find superTypes(c1, s1);
249 * find superTypes(c1, s2);
250 * find superTypes(c1, s3);
251 * find superTypes(c1, s4);
252 * find superTypes(c1, s5);
253 * s1 != s2;
254 * s1 != s3;
255 * s1 != s4;
256 * s1 != s5;
257 * s2 != s3;
258 * s2 != s4;
259 * s2 != s5;
260 * s3 != s4;
261 * s3 != s5;
262 * s4 != s5;
263 * }
264 * </pre></code>
265 *
266 * @see Match
267 * @see MoreThenFiveSuperTypes
268 *
269 */
270 public static class Matcher extends BaseMatcher<MoreThenFiveSuperTypes.Match> {
271 /**
272 * Initializes the pattern matcher within an existing VIATRA Query engine.
273 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
274 *
275 * @param engine the existing VIATRA Query engine in which this matcher will be created.
276 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
277 *
278 */
279 public static MoreThenFiveSuperTypes.Matcher on(final ViatraQueryEngine engine) {
280 // check if matcher already exists
281 Matcher matcher = engine.getExistingMatcher(querySpecification());
282 if (matcher == null) {
283 matcher = (Matcher)engine.getMatcher(querySpecification());
284 }
285 return matcher;
286 }
287
288 /**
289 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
290 * @return an initialized matcher
291 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
292 *
293 */
294 public static MoreThenFiveSuperTypes.Matcher create() {
295 return new Matcher();
296 }
297
298 private static final int POSITION_C = 0;
299
300 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MoreThenFiveSuperTypes.Matcher.class);
301
302 /**
303 * Initializes the pattern matcher within an existing VIATRA Query engine.
304 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
305 *
306 * @param engine the existing VIATRA Query engine in which this matcher will be created.
307 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
308 *
309 */
310 private Matcher() {
311 super(querySpecification());
312 }
313
314 /**
315 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
316 * @param pC the fixed value of pattern parameter c, or null if not bound.
317 * @return matches represented as a Match object.
318 *
319 */
320 public Collection<MoreThenFiveSuperTypes.Match> getAllMatches(final EClass pC) {
321 return rawStreamAllMatches(new Object[]{pC}).collect(Collectors.toSet());
322 }
323
324 /**
325 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
326 * </p>
327 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
328 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
329 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
330 * @param pC the fixed value of pattern parameter c, or null if not bound.
331 * @return a stream of matches represented as a Match object.
332 *
333 */
334 public Stream<MoreThenFiveSuperTypes.Match> streamAllMatches(final EClass pC) {
335 return rawStreamAllMatches(new Object[]{pC});
336 }
337
338 /**
339 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
340 * Neither determinism nor randomness of selection is guaranteed.
341 * @param pC the fixed value of pattern parameter c, 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<MoreThenFiveSuperTypes.Match> getOneArbitraryMatch(final EClass pC) {
346 return rawGetOneArbitraryMatch(new Object[]{pC});
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 pC the fixed value of pattern parameter c, or null if not bound.
353 * @return true if the input is a valid (partial) match of the pattern.
354 *
355 */
356 public boolean hasMatch(final EClass pC) {
357 return rawHasMatch(new Object[]{pC});
358 }
359
360 /**
361 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
362 * @param pC the fixed value of pattern parameter c, or null if not bound.
363 * @return the number of pattern matches found.
364 *
365 */
366 public int countMatches(final EClass pC) {
367 return rawCountMatches(new Object[]{pC});
368 }
369
370 /**
371 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
372 * Neither determinism nor randomness of selection is guaranteed.
373 * @param pC the fixed value of pattern parameter c, or null if not bound.
374 * @param processor the action that will process the selected match.
375 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
376 *
377 */
378 public boolean forOneArbitraryMatch(final EClass pC, final Consumer<? super MoreThenFiveSuperTypes.Match> processor) {
379 return rawForOneArbitraryMatch(new Object[]{pC}, processor);
380 }
381
382 /**
383 * Returns a new (partial) match.
384 * This can be used e.g. to call the matcher with a partial match.
385 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
386 * @param pC the fixed value of pattern parameter c, or null if not bound.
387 * @return the (partial) match object.
388 *
389 */
390 public MoreThenFiveSuperTypes.Match newMatch(final EClass pC) {
391 return MoreThenFiveSuperTypes.Match.newMatch(pC);
392 }
393
394 /**
395 * Retrieve the set of values that occur in matches for c.
396 * @return the Set of all values or empty set if there are no matches
397 *
398 */
399 protected Stream<EClass> rawStreamAllValuesOfc(final Object[] parameters) {
400 return rawStreamAllValues(POSITION_C, parameters).map(EClass.class::cast);
401 }
402
403 /**
404 * Retrieve the set of values that occur in matches for c.
405 * @return the Set of all values or empty set if there are no matches
406 *
407 */
408 public Set<EClass> getAllValuesOfc() {
409 return rawStreamAllValuesOfc(emptyArray()).collect(Collectors.toSet());
410 }
411
412 /**
413 * Retrieve the set of values that occur in matches for c.
414 * @return the Set of all values or empty set if there are no matches
415 *
416 */
417 public Stream<EClass> streamAllValuesOfc() {
418 return rawStreamAllValuesOfc(emptyArray());
419 }
420
421 @Override
422 protected MoreThenFiveSuperTypes.Match tupleToMatch(final Tuple t) {
423 try {
424 return MoreThenFiveSuperTypes.Match.newMatch((EClass) t.get(POSITION_C));
425 } catch(ClassCastException e) {
426 LOGGER.error("Element(s) in tuple not properly typed!",e);
427 return null;
428 }
429 }
430
431 @Override
432 protected MoreThenFiveSuperTypes.Match arrayToMatch(final Object[] match) {
433 try {
434 return MoreThenFiveSuperTypes.Match.newMatch((EClass) match[POSITION_C]);
435 } catch(ClassCastException e) {
436 LOGGER.error("Element(s) in array not properly typed!",e);
437 return null;
438 }
439 }
440
441 @Override
442 protected MoreThenFiveSuperTypes.Match arrayToMatchMutable(final Object[] match) {
443 try {
444 return MoreThenFiveSuperTypes.Match.newMutableMatch((EClass) match[POSITION_C]);
445 } catch(ClassCastException e) {
446 LOGGER.error("Element(s) in array not properly typed!",e);
447 return null;
448 }
449 }
450
451 /**
452 * @return the singleton instance of the query specification of this pattern
453 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
454 *
455 */
456 public static IQuerySpecification<MoreThenFiveSuperTypes.Matcher> querySpecification() {
457 return MoreThenFiveSuperTypes.instance();
458 }
459 }
460
461 private MoreThenFiveSuperTypes() {
462 super(GeneratedPQuery.INSTANCE);
463 }
464
465 /**
466 * @return the singleton instance of the query specification
467 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
468 *
469 */
470 public static MoreThenFiveSuperTypes instance() {
471 try{
472 return LazyHolder.INSTANCE;
473 } catch (ExceptionInInitializerError err) {
474 throw processInitializerError(err);
475 }
476 }
477
478 @Override
479 protected MoreThenFiveSuperTypes.Matcher instantiate(final ViatraQueryEngine engine) {
480 return MoreThenFiveSuperTypes.Matcher.on(engine);
481 }
482
483 @Override
484 public MoreThenFiveSuperTypes.Matcher instantiate() {
485 return MoreThenFiveSuperTypes.Matcher.create();
486 }
487
488 @Override
489 public MoreThenFiveSuperTypes.Match newEmptyMatch() {
490 return MoreThenFiveSuperTypes.Match.newEmptyMatch();
491 }
492
493 @Override
494 public MoreThenFiveSuperTypes.Match newMatch(final Object... parameters) {
495 return MoreThenFiveSuperTypes.Match.newMatch((org.eclipse.emf.ecore.EClass) parameters[0]);
496 }
497
498 /**
499 * Inner class allowing the singleton instance of {@link JvmGenericType: queries.MoreThenFiveSuperTypes (visibility: PUBLIC, simpleName: MoreThenFiveSuperTypes, identifier: queries.MoreThenFiveSuperTypes, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
500 * <b>not</b> at the class load time of the outer class,
501 * but rather at the first call to {@link JvmGenericType: queries.MoreThenFiveSuperTypes (visibility: PUBLIC, simpleName: MoreThenFiveSuperTypes, identifier: queries.MoreThenFiveSuperTypes, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
502 *
503 * <p> This workaround is required e.g. to support recursion.
504 *
505 */
506 private static class LazyHolder {
507 private static final MoreThenFiveSuperTypes INSTANCE = new MoreThenFiveSuperTypes();
508
509 /**
510 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
511 * This initialization order is required to support indirect recursion.
512 *
513 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
514 *
515 */
516 private static final Object STATIC_INITIALIZER = ensureInitialized();
517
518 public static Object ensureInitialized() {
519 INSTANCE.ensureInitializedInternal();
520 return null;
521 }
522 }
523
524 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
525 private static final MoreThenFiveSuperTypes.GeneratedPQuery INSTANCE = new GeneratedPQuery();
526
527 private final PParameter parameter_c = new PParameter("c", "org.eclipse.emf.ecore.EClass", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EClass")), PParameterDirection.INOUT);
528
529 private final List<PParameter> parameters = Arrays.asList(parameter_c);
530
531 private GeneratedPQuery() {
532 super(PVisibility.PUBLIC);
533 }
534
535 @Override
536 public String getFullyQualifiedName() {
537 return "queries.moreThenFiveSuperTypes";
538 }
539
540 @Override
541 public List<String> getParameterNames() {
542 return Arrays.asList("c");
543 }
544
545 @Override
546 public List<PParameter> getParameters() {
547 return parameters;
548 }
549
550 @Override
551 public Set<PBody> doGetContainedBodies() {
552 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
553 Set<PBody> bodies = new LinkedHashSet<>();
554 {
555 PBody body = new PBody(this);
556 PVariable var_c = body.getOrCreateVariableByName("c");
557 PVariable var_c1 = body.getOrCreateVariableByName("c1");
558 PVariable var_s1 = body.getOrCreateVariableByName("s1");
559 PVariable var_s2 = body.getOrCreateVariableByName("s2");
560 PVariable var_s3 = body.getOrCreateVariableByName("s3");
561 PVariable var_s4 = body.getOrCreateVariableByName("s4");
562 PVariable var_s5 = body.getOrCreateVariableByName("s5");
563 new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
564 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
565 new ExportedParameter(body, var_c, parameter_c)
566 ));
567 // find superTypes(c1, s1)
568 new PositivePatternCall(body, Tuples.flatTupleOf(var_c1, var_s1), SuperTypes.instance().getInternalQueryRepresentation());
569 // find superTypes(c1, s2)
570 new PositivePatternCall(body, Tuples.flatTupleOf(var_c1, var_s2), SuperTypes.instance().getInternalQueryRepresentation());
571 // find superTypes(c1, s3)
572 new PositivePatternCall(body, Tuples.flatTupleOf(var_c1, var_s3), SuperTypes.instance().getInternalQueryRepresentation());
573 // find superTypes(c1, s4)
574 new PositivePatternCall(body, Tuples.flatTupleOf(var_c1, var_s4), SuperTypes.instance().getInternalQueryRepresentation());
575 // find superTypes(c1, s5)
576 new PositivePatternCall(body, Tuples.flatTupleOf(var_c1, var_s5), SuperTypes.instance().getInternalQueryRepresentation());
577 // s1 != s2
578 new Inequality(body, var_s1, var_s2);
579 // s1 != s3
580 new Inequality(body, var_s1, var_s3);
581 // s1 != s4
582 new Inequality(body, var_s1, var_s4);
583 // s1 != s5
584 new Inequality(body, var_s1, var_s5);
585 // s2 != s3
586 new Inequality(body, var_s2, var_s3);
587 // s2 != s4
588 new Inequality(body, var_s2, var_s4);
589 // s2 != s5
590 new Inequality(body, var_s2, var_s5);
591 // s3 != s4
592 new Inequality(body, var_s3, var_s4);
593 // s3 != s5
594 new Inequality(body, var_s3, var_s5);
595 // s4 != s5
596 new Inequality(body, var_s4, var_s5);
597 bodies.add(body);
598 }
599 {
600 PAnnotation annotation = new PAnnotation("Constraint");
601 annotation.addAttribute("severity", "error");
602 annotation.addAttribute("message", "error");
603 annotation.addAttribute("key", Arrays.asList(new Object[] {
604 new ParameterReference("c")
605 }));
606 addAnnotation(annotation);
607 }
608 return bodies;
609 }
610 }
611}
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/SameSuperClass.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/SameSuperClass.java
deleted file mode 100644
index 2e8a19d8..00000000
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/SameSuperClass.java
+++ /dev/null
@@ -1,824 +0,0 @@
1/**
2 * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/ecore_pattern.vql
3 */
4package queries;
5
6import java.util.Arrays;
7import java.util.Collection;
8import java.util.LinkedHashSet;
9import java.util.List;
10import java.util.Objects;
11import java.util.Optional;
12import java.util.Set;
13import java.util.function.Consumer;
14import java.util.stream.Collectors;
15import java.util.stream.Stream;
16import org.apache.log4j.Logger;
17import org.eclipse.emf.ecore.EClass;
18import org.eclipse.viatra.query.runtime.api.IPatternMatch;
19import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
20import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
21import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
24import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
25import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
26import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
27import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
28import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
30import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
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(severity="error", message="error", key = {c})
48 * pattern sameSuperClass(c : EClass, s1 : EClass, s2: EClass) {
49 * EClass.eSuperTypes(c, s1);
50 * EClass.eSuperTypes(c, s2);
51 * s1 == s2;
52 * }
53 * </pre></code>
54 *
55 * @see Matcher
56 * @see Match
57 *
58 */
59@SuppressWarnings("all")
60public final class SameSuperClass extends BaseGeneratedEMFQuerySpecification<SameSuperClass.Matcher> {
61 /**
62 * Pattern-specific match representation of the queries.sameSuperClass pattern,
63 * to be used in conjunction with {@link Matcher}.
64 *
65 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
66 * Each instance is a (possibly partial) substitution of pattern parameters,
67 * usable to represent a match of the pattern in the result of a query,
68 * or to specify the bound (fixed) input parameters when issuing a query.
69 *
70 * @see Matcher
71 *
72 */
73 public static abstract class Match extends BasePatternMatch {
74 private EClass fC;
75
76 private EClass fS1;
77
78 private EClass fS2;
79
80 private static List<String> parameterNames = makeImmutableList("c", "s1", "s2");
81
82 private Match(final EClass pC, final EClass pS1, final EClass pS2) {
83 this.fC = pC;
84 this.fS1 = pS1;
85 this.fS2 = pS2;
86 }
87
88 @Override
89 public Object get(final String parameterName) {
90 if ("c".equals(parameterName)) return this.fC;
91 if ("s1".equals(parameterName)) return this.fS1;
92 if ("s2".equals(parameterName)) return this.fS2;
93 return null;
94 }
95
96 public EClass getC() {
97 return this.fC;
98 }
99
100 public EClass getS1() {
101 return this.fS1;
102 }
103
104 public EClass getS2() {
105 return this.fS2;
106 }
107
108 @Override
109 public boolean set(final String parameterName, final Object newValue) {
110 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
111 if ("c".equals(parameterName) ) {
112 this.fC = (EClass) newValue;
113 return true;
114 }
115 if ("s1".equals(parameterName) ) {
116 this.fS1 = (EClass) newValue;
117 return true;
118 }
119 if ("s2".equals(parameterName) ) {
120 this.fS2 = (EClass) newValue;
121 return true;
122 }
123 return false;
124 }
125
126 public void setC(final EClass pC) {
127 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
128 this.fC = pC;
129 }
130
131 public void setS1(final EClass pS1) {
132 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
133 this.fS1 = pS1;
134 }
135
136 public void setS2(final EClass pS2) {
137 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
138 this.fS2 = pS2;
139 }
140
141 @Override
142 public String patternName() {
143 return "queries.sameSuperClass";
144 }
145
146 @Override
147 public List<String> parameterNames() {
148 return SameSuperClass.Match.parameterNames;
149 }
150
151 @Override
152 public Object[] toArray() {
153 return new Object[]{fC, fS1, fS2};
154 }
155
156 @Override
157 public SameSuperClass.Match toImmutable() {
158 return isMutable() ? newMatch(fC, fS1, fS2) : this;
159 }
160
161 @Override
162 public String prettyPrint() {
163 StringBuilder result = new StringBuilder();
164 result.append("\"c\"=" + prettyPrintValue(fC) + ", ");
165 result.append("\"s1\"=" + prettyPrintValue(fS1) + ", ");
166 result.append("\"s2\"=" + prettyPrintValue(fS2));
167 return result.toString();
168 }
169
170 @Override
171 public int hashCode() {
172 return Objects.hash(fC, fS1, fS2);
173 }
174
175 @Override
176 public boolean equals(final Object obj) {
177 if (this == obj)
178 return true;
179 if (obj == null) {
180 return false;
181 }
182 if ((obj instanceof SameSuperClass.Match)) {
183 SameSuperClass.Match other = (SameSuperClass.Match) obj;
184 return Objects.equals(fC, other.fC) && Objects.equals(fS1, other.fS1) && Objects.equals(fS2, other.fS2);
185 } else {
186 // this should be infrequent
187 if (!(obj instanceof IPatternMatch)) {
188 return false;
189 }
190 IPatternMatch otherSig = (IPatternMatch) obj;
191 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
192 }
193 }
194
195 @Override
196 public SameSuperClass specification() {
197 return SameSuperClass.instance();
198 }
199
200 /**
201 * Returns an empty, mutable match.
202 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
203 *
204 * @return the empty match.
205 *
206 */
207 public static SameSuperClass.Match newEmptyMatch() {
208 return new Mutable(null, null, null);
209 }
210
211 /**
212 * Returns a mutable (partial) match.
213 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
214 *
215 * @param pC the fixed value of pattern parameter c, or null if not bound.
216 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
217 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
218 * @return the new, mutable (partial) match object.
219 *
220 */
221 public static SameSuperClass.Match newMutableMatch(final EClass pC, final EClass pS1, final EClass pS2) {
222 return new Mutable(pC, pS1, pS2);
223 }
224
225 /**
226 * Returns a new (partial) match.
227 * This can be used e.g. to call the matcher with a partial match.
228 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
229 * @param pC the fixed value of pattern parameter c, or null if not bound.
230 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
231 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
232 * @return the (partial) match object.
233 *
234 */
235 public static SameSuperClass.Match newMatch(final EClass pC, final EClass pS1, final EClass pS2) {
236 return new Immutable(pC, pS1, pS2);
237 }
238
239 private static final class Mutable extends SameSuperClass.Match {
240 Mutable(final EClass pC, final EClass pS1, final EClass pS2) {
241 super(pC, pS1, pS2);
242 }
243
244 @Override
245 public boolean isMutable() {
246 return true;
247 }
248 }
249
250 private static final class Immutable extends SameSuperClass.Match {
251 Immutable(final EClass pC, final EClass pS1, final EClass pS2) {
252 super(pC, pS1, pS2);
253 }
254
255 @Override
256 public boolean isMutable() {
257 return false;
258 }
259 }
260 }
261
262 /**
263 * Generated pattern matcher API of the queries.sameSuperClass pattern,
264 * providing pattern-specific query methods.
265 *
266 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
267 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
268 *
269 * <p>Matches of the pattern will be represented as {@link Match}.
270 *
271 * <p>Original source:
272 * <code><pre>
273 * {@literal @}Constraint(severity="error", message="error", key = {c})
274 * pattern sameSuperClass(c : EClass, s1 : EClass, s2: EClass) {
275 * EClass.eSuperTypes(c, s1);
276 * EClass.eSuperTypes(c, s2);
277 * s1 == s2;
278 * }
279 * </pre></code>
280 *
281 * @see Match
282 * @see SameSuperClass
283 *
284 */
285 public static class Matcher extends BaseMatcher<SameSuperClass.Match> {
286 /**
287 * Initializes the pattern matcher within an existing VIATRA Query engine.
288 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
289 *
290 * @param engine the existing VIATRA Query engine in which this matcher will be created.
291 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
292 *
293 */
294 public static SameSuperClass.Matcher on(final ViatraQueryEngine engine) {
295 // check if matcher already exists
296 Matcher matcher = engine.getExistingMatcher(querySpecification());
297 if (matcher == null) {
298 matcher = (Matcher)engine.getMatcher(querySpecification());
299 }
300 return matcher;
301 }
302
303 /**
304 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
305 * @return an initialized matcher
306 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
307 *
308 */
309 public static SameSuperClass.Matcher create() {
310 return new Matcher();
311 }
312
313 private static final int POSITION_C = 0;
314
315 private static final int POSITION_S1 = 1;
316
317 private static final int POSITION_S2 = 2;
318
319 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SameSuperClass.Matcher.class);
320
321 /**
322 * Initializes the pattern matcher within an existing VIATRA Query engine.
323 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
324 *
325 * @param engine the existing VIATRA Query engine in which this matcher will be created.
326 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
327 *
328 */
329 private Matcher() {
330 super(querySpecification());
331 }
332
333 /**
334 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
335 * @param pC the fixed value of pattern parameter c, or null if not bound.
336 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
337 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
338 * @return matches represented as a Match object.
339 *
340 */
341 public Collection<SameSuperClass.Match> getAllMatches(final EClass pC, final EClass pS1, final EClass pS2) {
342 return rawStreamAllMatches(new Object[]{pC, pS1, pS2}).collect(Collectors.toSet());
343 }
344
345 /**
346 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
347 * </p>
348 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
349 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
350 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
351 * @param pC the fixed value of pattern parameter c, or null if not bound.
352 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
353 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
354 * @return a stream of matches represented as a Match object.
355 *
356 */
357 public Stream<SameSuperClass.Match> streamAllMatches(final EClass pC, final EClass pS1, final EClass pS2) {
358 return rawStreamAllMatches(new Object[]{pC, pS1, pS2});
359 }
360
361 /**
362 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
363 * Neither determinism nor randomness of selection is guaranteed.
364 * @param pC the fixed value of pattern parameter c, or null if not bound.
365 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
366 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
367 * @return a match represented as a Match object, or null if no match is found.
368 *
369 */
370 public Optional<SameSuperClass.Match> getOneArbitraryMatch(final EClass pC, final EClass pS1, final EClass pS2) {
371 return rawGetOneArbitraryMatch(new Object[]{pC, pS1, pS2});
372 }
373
374 /**
375 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
376 * under any possible substitution of the unspecified parameters (if any).
377 * @param pC the fixed value of pattern parameter c, or null if not bound.
378 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
379 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
380 * @return true if the input is a valid (partial) match of the pattern.
381 *
382 */
383 public boolean hasMatch(final EClass pC, final EClass pS1, final EClass pS2) {
384 return rawHasMatch(new Object[]{pC, pS1, pS2});
385 }
386
387 /**
388 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
389 * @param pC the fixed value of pattern parameter c, or null if not bound.
390 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
391 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
392 * @return the number of pattern matches found.
393 *
394 */
395 public int countMatches(final EClass pC, final EClass pS1, final EClass pS2) {
396 return rawCountMatches(new Object[]{pC, pS1, pS2});
397 }
398
399 /**
400 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
401 * Neither determinism nor randomness of selection is guaranteed.
402 * @param pC the fixed value of pattern parameter c, or null if not bound.
403 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
404 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
405 * @param processor the action that will process the selected match.
406 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
407 *
408 */
409 public boolean forOneArbitraryMatch(final EClass pC, final EClass pS1, final EClass pS2, final Consumer<? super SameSuperClass.Match> processor) {
410 return rawForOneArbitraryMatch(new Object[]{pC, pS1, pS2}, processor);
411 }
412
413 /**
414 * Returns a new (partial) match.
415 * This can be used e.g. to call the matcher with a partial match.
416 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
417 * @param pC the fixed value of pattern parameter c, or null if not bound.
418 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
419 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
420 * @return the (partial) match object.
421 *
422 */
423 public SameSuperClass.Match newMatch(final EClass pC, final EClass pS1, final EClass pS2) {
424 return SameSuperClass.Match.newMatch(pC, pS1, pS2);
425 }
426
427 /**
428 * Retrieve the set of values that occur in matches for c.
429 * @return the Set of all values or empty set if there are no matches
430 *
431 */
432 protected Stream<EClass> rawStreamAllValuesOfc(final Object[] parameters) {
433 return rawStreamAllValues(POSITION_C, parameters).map(EClass.class::cast);
434 }
435
436 /**
437 * Retrieve the set of values that occur in matches for c.
438 * @return the Set of all values or empty set if there are no matches
439 *
440 */
441 public Set<EClass> getAllValuesOfc() {
442 return rawStreamAllValuesOfc(emptyArray()).collect(Collectors.toSet());
443 }
444
445 /**
446 * Retrieve the set of values that occur in matches for c.
447 * @return the Set of all values or empty set if there are no matches
448 *
449 */
450 public Stream<EClass> streamAllValuesOfc() {
451 return rawStreamAllValuesOfc(emptyArray());
452 }
453
454 /**
455 * Retrieve the set of values that occur in matches for c.
456 * </p>
457 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
458 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
459 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
460 *
461 * @return the Stream of all values or empty set if there are no matches
462 *
463 */
464 public Stream<EClass> streamAllValuesOfc(final SameSuperClass.Match partialMatch) {
465 return rawStreamAllValuesOfc(partialMatch.toArray());
466 }
467
468 /**
469 * Retrieve the set of values that occur in matches for c.
470 * </p>
471 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
472 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
473 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
474 *
475 * @return the Stream of all values or empty set if there are no matches
476 *
477 */
478 public Stream<EClass> streamAllValuesOfc(final EClass pS1, final EClass pS2) {
479 return rawStreamAllValuesOfc(new Object[]{null, pS1, pS2});
480 }
481
482 /**
483 * Retrieve the set of values that occur in matches for c.
484 * @return the Set of all values or empty set if there are no matches
485 *
486 */
487 public Set<EClass> getAllValuesOfc(final SameSuperClass.Match partialMatch) {
488 return rawStreamAllValuesOfc(partialMatch.toArray()).collect(Collectors.toSet());
489 }
490
491 /**
492 * Retrieve the set of values that occur in matches for c.
493 * @return the Set of all values or empty set if there are no matches
494 *
495 */
496 public Set<EClass> getAllValuesOfc(final EClass pS1, final EClass pS2) {
497 return rawStreamAllValuesOfc(new Object[]{null, pS1, pS2}).collect(Collectors.toSet());
498 }
499
500 /**
501 * Retrieve the set of values that occur in matches for s1.
502 * @return the Set of all values or empty set if there are no matches
503 *
504 */
505 protected Stream<EClass> rawStreamAllValuesOfs1(final Object[] parameters) {
506 return rawStreamAllValues(POSITION_S1, parameters).map(EClass.class::cast);
507 }
508
509 /**
510 * Retrieve the set of values that occur in matches for s1.
511 * @return the Set of all values or empty set if there are no matches
512 *
513 */
514 public Set<EClass> getAllValuesOfs1() {
515 return rawStreamAllValuesOfs1(emptyArray()).collect(Collectors.toSet());
516 }
517
518 /**
519 * Retrieve the set of values that occur in matches for s1.
520 * @return the Set of all values or empty set if there are no matches
521 *
522 */
523 public Stream<EClass> streamAllValuesOfs1() {
524 return rawStreamAllValuesOfs1(emptyArray());
525 }
526
527 /**
528 * Retrieve the set of values that occur in matches for s1.
529 * </p>
530 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
531 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
532 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
533 *
534 * @return the Stream of all values or empty set if there are no matches
535 *
536 */
537 public Stream<EClass> streamAllValuesOfs1(final SameSuperClass.Match partialMatch) {
538 return rawStreamAllValuesOfs1(partialMatch.toArray());
539 }
540
541 /**
542 * Retrieve the set of values that occur in matches for s1.
543 * </p>
544 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
545 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
546 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
547 *
548 * @return the Stream of all values or empty set if there are no matches
549 *
550 */
551 public Stream<EClass> streamAllValuesOfs1(final EClass pC, final EClass pS2) {
552 return rawStreamAllValuesOfs1(new Object[]{pC, null, pS2});
553 }
554
555 /**
556 * Retrieve the set of values that occur in matches for s1.
557 * @return the Set of all values or empty set if there are no matches
558 *
559 */
560 public Set<EClass> getAllValuesOfs1(final SameSuperClass.Match partialMatch) {
561 return rawStreamAllValuesOfs1(partialMatch.toArray()).collect(Collectors.toSet());
562 }
563
564 /**
565 * Retrieve the set of values that occur in matches for s1.
566 * @return the Set of all values or empty set if there are no matches
567 *
568 */
569 public Set<EClass> getAllValuesOfs1(final EClass pC, final EClass pS2) {
570 return rawStreamAllValuesOfs1(new Object[]{pC, null, pS2}).collect(Collectors.toSet());
571 }
572
573 /**
574 * Retrieve the set of values that occur in matches for s2.
575 * @return the Set of all values or empty set if there are no matches
576 *
577 */
578 protected Stream<EClass> rawStreamAllValuesOfs2(final Object[] parameters) {
579 return rawStreamAllValues(POSITION_S2, parameters).map(EClass.class::cast);
580 }
581
582 /**
583 * Retrieve the set of values that occur in matches for s2.
584 * @return the Set of all values or empty set if there are no matches
585 *
586 */
587 public Set<EClass> getAllValuesOfs2() {
588 return rawStreamAllValuesOfs2(emptyArray()).collect(Collectors.toSet());
589 }
590
591 /**
592 * Retrieve the set of values that occur in matches for s2.
593 * @return the Set of all values or empty set if there are no matches
594 *
595 */
596 public Stream<EClass> streamAllValuesOfs2() {
597 return rawStreamAllValuesOfs2(emptyArray());
598 }
599
600 /**
601 * Retrieve the set of values that occur in matches for s2.
602 * </p>
603 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
604 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
605 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
606 *
607 * @return the Stream of all values or empty set if there are no matches
608 *
609 */
610 public Stream<EClass> streamAllValuesOfs2(final SameSuperClass.Match partialMatch) {
611 return rawStreamAllValuesOfs2(partialMatch.toArray());
612 }
613
614 /**
615 * Retrieve the set of values that occur in matches for s2.
616 * </p>
617 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
618 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
619 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
620 *
621 * @return the Stream of all values or empty set if there are no matches
622 *
623 */
624 public Stream<EClass> streamAllValuesOfs2(final EClass pC, final EClass pS1) {
625 return rawStreamAllValuesOfs2(new Object[]{pC, pS1, null});
626 }
627
628 /**
629 * Retrieve the set of values that occur in matches for s2.
630 * @return the Set of all values or empty set if there are no matches
631 *
632 */
633 public Set<EClass> getAllValuesOfs2(final SameSuperClass.Match partialMatch) {
634 return rawStreamAllValuesOfs2(partialMatch.toArray()).collect(Collectors.toSet());
635 }
636
637 /**
638 * Retrieve the set of values that occur in matches for s2.
639 * @return the Set of all values or empty set if there are no matches
640 *
641 */
642 public Set<EClass> getAllValuesOfs2(final EClass pC, final EClass pS1) {
643 return rawStreamAllValuesOfs2(new Object[]{pC, pS1, null}).collect(Collectors.toSet());
644 }
645
646 @Override
647 protected SameSuperClass.Match tupleToMatch(final Tuple t) {
648 try {
649 return SameSuperClass.Match.newMatch((EClass) t.get(POSITION_C), (EClass) t.get(POSITION_S1), (EClass) t.get(POSITION_S2));
650 } catch(ClassCastException e) {
651 LOGGER.error("Element(s) in tuple not properly typed!",e);
652 return null;
653 }
654 }
655
656 @Override
657 protected SameSuperClass.Match arrayToMatch(final Object[] match) {
658 try {
659 return SameSuperClass.Match.newMatch((EClass) match[POSITION_C], (EClass) match[POSITION_S1], (EClass) match[POSITION_S2]);
660 } catch(ClassCastException e) {
661 LOGGER.error("Element(s) in array not properly typed!",e);
662 return null;
663 }
664 }
665
666 @Override
667 protected SameSuperClass.Match arrayToMatchMutable(final Object[] match) {
668 try {
669 return SameSuperClass.Match.newMutableMatch((EClass) match[POSITION_C], (EClass) match[POSITION_S1], (EClass) match[POSITION_S2]);
670 } catch(ClassCastException e) {
671 LOGGER.error("Element(s) in array not properly typed!",e);
672 return null;
673 }
674 }
675
676 /**
677 * @return the singleton instance of the query specification of this pattern
678 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
679 *
680 */
681 public static IQuerySpecification<SameSuperClass.Matcher> querySpecification() {
682 return SameSuperClass.instance();
683 }
684 }
685
686 private SameSuperClass() {
687 super(GeneratedPQuery.INSTANCE);
688 }
689
690 /**
691 * @return the singleton instance of the query specification
692 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
693 *
694 */
695 public static SameSuperClass instance() {
696 try{
697 return LazyHolder.INSTANCE;
698 } catch (ExceptionInInitializerError err) {
699 throw processInitializerError(err);
700 }
701 }
702
703 @Override
704 protected SameSuperClass.Matcher instantiate(final ViatraQueryEngine engine) {
705 return SameSuperClass.Matcher.on(engine);
706 }
707
708 @Override
709 public SameSuperClass.Matcher instantiate() {
710 return SameSuperClass.Matcher.create();
711 }
712
713 @Override
714 public SameSuperClass.Match newEmptyMatch() {
715 return SameSuperClass.Match.newEmptyMatch();
716 }
717
718 @Override
719 public SameSuperClass.Match newMatch(final Object... parameters) {
720 return SameSuperClass.Match.newMatch((org.eclipse.emf.ecore.EClass) parameters[0], (org.eclipse.emf.ecore.EClass) parameters[1], (org.eclipse.emf.ecore.EClass) parameters[2]);
721 }
722
723 /**
724 * Inner class allowing the singleton instance of {@link JvmGenericType: queries.SameSuperClass (visibility: PUBLIC, simpleName: SameSuperClass, identifier: queries.SameSuperClass, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
725 * <b>not</b> at the class load time of the outer class,
726 * but rather at the first call to {@link JvmGenericType: queries.SameSuperClass (visibility: PUBLIC, simpleName: SameSuperClass, identifier: queries.SameSuperClass, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
727 *
728 * <p> This workaround is required e.g. to support recursion.
729 *
730 */
731 private static class LazyHolder {
732 private static final SameSuperClass INSTANCE = new SameSuperClass();
733
734 /**
735 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
736 * This initialization order is required to support indirect recursion.
737 *
738 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
739 *
740 */
741 private static final Object STATIC_INITIALIZER = ensureInitialized();
742
743 public static Object ensureInitialized() {
744 INSTANCE.ensureInitializedInternal();
745 return null;
746 }
747 }
748
749 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
750 private static final SameSuperClass.GeneratedPQuery INSTANCE = new GeneratedPQuery();
751
752 private final PParameter parameter_c = new PParameter("c", "org.eclipse.emf.ecore.EClass", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EClass")), PParameterDirection.INOUT);
753
754 private final PParameter parameter_s1 = new PParameter("s1", "org.eclipse.emf.ecore.EClass", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EClass")), PParameterDirection.INOUT);
755
756 private final PParameter parameter_s2 = new PParameter("s2", "org.eclipse.emf.ecore.EClass", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EClass")), PParameterDirection.INOUT);
757
758 private final List<PParameter> parameters = Arrays.asList(parameter_c, parameter_s1, parameter_s2);
759
760 private GeneratedPQuery() {
761 super(PVisibility.PUBLIC);
762 }
763
764 @Override
765 public String getFullyQualifiedName() {
766 return "queries.sameSuperClass";
767 }
768
769 @Override
770 public List<String> getParameterNames() {
771 return Arrays.asList("c","s1","s2");
772 }
773
774 @Override
775 public List<PParameter> getParameters() {
776 return parameters;
777 }
778
779 @Override
780 public Set<PBody> doGetContainedBodies() {
781 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
782 Set<PBody> bodies = new LinkedHashSet<>();
783 {
784 PBody body = new PBody(this);
785 PVariable var_c = body.getOrCreateVariableByName("c");
786 PVariable var_s1 = body.getOrCreateVariableByName("s1");
787 PVariable var_s2 = body.getOrCreateVariableByName("s2");
788 new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
789 new TypeConstraint(body, Tuples.flatTupleOf(var_s1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
790 new TypeConstraint(body, Tuples.flatTupleOf(var_s2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
791 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
792 new ExportedParameter(body, var_c, parameter_c),
793 new ExportedParameter(body, var_s1, parameter_s1),
794 new ExportedParameter(body, var_s2, parameter_s2)
795 ));
796 // EClass.eSuperTypes(c, s1)
797 new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
798 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
799 new TypeConstraint(body, Tuples.flatTupleOf(var_c, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass", "eSuperTypes")));
800 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
801 new Equality(body, var__virtual_0_, var_s1);
802 // EClass.eSuperTypes(c, s2)
803 new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
804 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
805 new TypeConstraint(body, Tuples.flatTupleOf(var_c, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass", "eSuperTypes")));
806 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
807 new Equality(body, var__virtual_1_, var_s2);
808 // s1 == s2
809 new Equality(body, var_s1, var_s2);
810 bodies.add(body);
811 }
812 {
813 PAnnotation annotation = new PAnnotation("Constraint");
814 annotation.addAttribute("severity", "error");
815 annotation.addAttribute("message", "error");
816 annotation.addAttribute("key", Arrays.asList(new Object[] {
817 new ParameterReference("c")
818 }));
819 addAnnotation(annotation);
820 }
821 return bodies;
822 }
823 }
824}
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/SuperTypes.java b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/SuperTypes.java
new file mode 100644
index 00000000..823e55da
--- /dev/null
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/src-gen/queries/SuperTypes.java
@@ -0,0 +1,692 @@
1/**
2 * Generated from platform:/resource/SocialNetwork_plugin/queries/queries/Ecore.vql
3 */
4package queries;
5
6import java.util.Arrays;
7import java.util.Collection;
8import java.util.LinkedHashSet;
9import java.util.List;
10import java.util.Objects;
11import java.util.Optional;
12import java.util.Set;
13import java.util.function.Consumer;
14import java.util.stream.Collectors;
15import java.util.stream.Stream;
16import org.apache.log4j.Logger;
17import org.eclipse.emf.ecore.EClass;
18import org.eclipse.viatra.query.runtime.api.IPatternMatch;
19import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
20import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
21import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
24import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
25import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
26import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
27import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
28import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
30import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
33import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
36import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
37import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
38import 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 superTypes(c1:EClass, c2:EClass){
46 * EClass.eSuperTypes(c1,c2);
47 * }
48 * </pre></code>
49 *
50 * @see Matcher
51 * @see Match
52 *
53 */
54@SuppressWarnings("all")
55public final class SuperTypes extends BaseGeneratedEMFQuerySpecification<SuperTypes.Matcher> {
56 /**
57 * Pattern-specific match representation of the queries.superTypes 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 fC1;
70
71 private EClass fC2;
72
73 private static List<String> parameterNames = makeImmutableList("c1", "c2");
74
75 private Match(final EClass pC1, final EClass pC2) {
76 this.fC1 = pC1;
77 this.fC2 = pC2;
78 }
79
80 @Override
81 public Object get(final String parameterName) {
82 if ("c1".equals(parameterName)) return this.fC1;
83 if ("c2".equals(parameterName)) return this.fC2;
84 return null;
85 }
86
87 public EClass getC1() {
88 return this.fC1;
89 }
90
91 public EClass getC2() {
92 return this.fC2;
93 }
94
95 @Override
96 public boolean set(final String parameterName, final Object newValue) {
97 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
98 if ("c1".equals(parameterName) ) {
99 this.fC1 = (EClass) newValue;
100 return true;
101 }
102 if ("c2".equals(parameterName) ) {
103 this.fC2 = (EClass) newValue;
104 return true;
105 }
106 return false;
107 }
108
109 public void setC1(final EClass pC1) {
110 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
111 this.fC1 = pC1;
112 }
113
114 public void setC2(final EClass pC2) {
115 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
116 this.fC2 = pC2;
117 }
118
119 @Override
120 public String patternName() {
121 return "queries.superTypes";
122 }
123
124 @Override
125 public List<String> parameterNames() {
126 return SuperTypes.Match.parameterNames;
127 }
128
129 @Override
130 public Object[] toArray() {
131 return new Object[]{fC1, fC2};
132 }
133
134 @Override
135 public SuperTypes.Match toImmutable() {
136 return isMutable() ? newMatch(fC1, fC2) : this;
137 }
138
139 @Override
140 public String prettyPrint() {
141 StringBuilder result = new StringBuilder();
142 result.append("\"c1\"=" + prettyPrintValue(fC1) + ", ");
143 result.append("\"c2\"=" + prettyPrintValue(fC2));
144 return result.toString();
145 }
146
147 @Override
148 public int hashCode() {
149 return Objects.hash(fC1, fC2);
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 SuperTypes.Match)) {
160 SuperTypes.Match other = (SuperTypes.Match) obj;
161 return Objects.equals(fC1, other.fC1) && Objects.equals(fC2, other.fC2);
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 SuperTypes specification() {
174 return SuperTypes.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 SuperTypes.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 pC1 the fixed value of pattern parameter c1, or null if not bound.
193 * @param pC2 the fixed value of pattern parameter c2, or null if not bound.
194 * @return the new, mutable (partial) match object.
195 *
196 */
197 public static SuperTypes.Match newMutableMatch(final EClass pC1, final EClass pC2) {
198 return new Mutable(pC1, pC2);
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 pC1 the fixed value of pattern parameter c1, or null if not bound.
206 * @param pC2 the fixed value of pattern parameter c2, or null if not bound.
207 * @return the (partial) match object.
208 *
209 */
210 public static SuperTypes.Match newMatch(final EClass pC1, final EClass pC2) {
211 return new Immutable(pC1, pC2);
212 }
213
214 private static final class Mutable extends SuperTypes.Match {
215 Mutable(final EClass pC1, final EClass pC2) {
216 super(pC1, pC2);
217 }
218
219 @Override
220 public boolean isMutable() {
221 return true;
222 }
223 }
224
225 private static final class Immutable extends SuperTypes.Match {
226 Immutable(final EClass pC1, final EClass pC2) {
227 super(pC1, pC2);
228 }
229
230 @Override
231 public boolean isMutable() {
232 return false;
233 }
234 }
235 }
236
237 /**
238 * Generated pattern matcher API of the queries.superTypes 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 superTypes(c1:EClass, c2:EClass){
249 * EClass.eSuperTypes(c1,c2);
250 * }
251 * </pre></code>
252 *
253 * @see Match
254 * @see SuperTypes
255 *
256 */
257 public static class Matcher extends BaseMatcher<SuperTypes.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 SuperTypes.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 SuperTypes.Matcher create() {
282 return new Matcher();
283 }
284
285 private static final int POSITION_C1 = 0;
286
287 private static final int POSITION_C2 = 1;
288
289 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SuperTypes.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 pC1 the fixed value of pattern parameter c1, or null if not bound.
306 * @param pC2 the fixed value of pattern parameter c2, or null if not bound.
307 * @return matches represented as a Match object.
308 *
309 */
310 public Collection<SuperTypes.Match> getAllMatches(final EClass pC1, final EClass pC2) {
311 return rawStreamAllMatches(new Object[]{pC1, pC2}).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 pC1 the fixed value of pattern parameter c1, or null if not bound.
321 * @param pC2 the fixed value of pattern parameter c2, or null if not bound.
322 * @return a stream of matches represented as a Match object.
323 *
324 */
325 public Stream<SuperTypes.Match> streamAllMatches(final EClass pC1, final EClass pC2) {
326 return rawStreamAllMatches(new Object[]{pC1, pC2});
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 pC1 the fixed value of pattern parameter c1, or null if not bound.
333 * @param pC2 the fixed value of pattern parameter c2, 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<SuperTypes.Match> getOneArbitraryMatch(final EClass pC1, final EClass pC2) {
338 return rawGetOneArbitraryMatch(new Object[]{pC1, pC2});
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 pC1 the fixed value of pattern parameter c1, or null if not bound.
345 * @param pC2 the fixed value of pattern parameter c2, 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 pC1, final EClass pC2) {
350 return rawHasMatch(new Object[]{pC1, pC2});
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 pC1 the fixed value of pattern parameter c1, or null if not bound.
356 * @param pC2 the fixed value of pattern parameter c2, or null if not bound.
357 * @return the number of pattern matches found.
358 *
359 */
360 public int countMatches(final EClass pC1, final EClass pC2) {
361 return rawCountMatches(new Object[]{pC1, pC2});
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 pC1 the fixed value of pattern parameter c1, or null if not bound.
368 * @param pC2 the fixed value of pattern parameter c2, 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 pC1, final EClass pC2, final Consumer<? super SuperTypes.Match> processor) {
374 return rawForOneArbitraryMatch(new Object[]{pC1, pC2}, 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 pC1 the fixed value of pattern parameter c1, or null if not bound.
382 * @param pC2 the fixed value of pattern parameter c2, or null if not bound.
383 * @return the (partial) match object.
384 *
385 */
386 public SuperTypes.Match newMatch(final EClass pC1, final EClass pC2) {
387 return SuperTypes.Match.newMatch(pC1, pC2);
388 }
389
390 /**
391 * Retrieve the set of values that occur in matches for c1.
392 * @return the Set of all values or empty set if there are no matches
393 *
394 */
395 protected Stream<EClass> rawStreamAllValuesOfc1(final Object[] parameters) {
396 return rawStreamAllValues(POSITION_C1, parameters).map(EClass.class::cast);
397 }
398
399 /**
400 * Retrieve the set of values that occur in matches for c1.
401 * @return the Set of all values or empty set if there are no matches
402 *
403 */
404 public Set<EClass> getAllValuesOfc1() {
405 return rawStreamAllValuesOfc1(emptyArray()).collect(Collectors.toSet());
406 }
407
408 /**
409 * Retrieve the set of values that occur in matches for c1.
410 * @return the Set of all values or empty set if there are no matches
411 *
412 */
413 public Stream<EClass> streamAllValuesOfc1() {
414 return rawStreamAllValuesOfc1(emptyArray());
415 }
416
417 /**
418 * Retrieve the set of values that occur in matches for c1.
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> streamAllValuesOfc1(final SuperTypes.Match partialMatch) {
428 return rawStreamAllValuesOfc1(partialMatch.toArray());
429 }
430
431 /**
432 * Retrieve the set of values that occur in matches for c1.
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> streamAllValuesOfc1(final EClass pC2) {
442 return rawStreamAllValuesOfc1(new Object[]{null, pC2});
443 }
444
445 /**
446 * Retrieve the set of values that occur in matches for c1.
447 * @return the Set of all values or empty set if there are no matches
448 *
449 */
450 public Set<EClass> getAllValuesOfc1(final SuperTypes.Match partialMatch) {
451 return rawStreamAllValuesOfc1(partialMatch.toArray()).collect(Collectors.toSet());
452 }
453
454 /**
455 * Retrieve the set of values that occur in matches for c1.
456 * @return the Set of all values or empty set if there are no matches
457 *
458 */
459 public Set<EClass> getAllValuesOfc1(final EClass pC2) {
460 return rawStreamAllValuesOfc1(new Object[]{null, pC2}).collect(Collectors.toSet());
461 }
462
463 /**
464 * Retrieve the set of values that occur in matches for c2.
465 * @return the Set of all values or empty set if there are no matches
466 *
467 */
468 protected Stream<EClass> rawStreamAllValuesOfc2(final Object[] parameters) {
469 return rawStreamAllValues(POSITION_C2, parameters).map(EClass.class::cast);
470 }
471
472 /**
473 * Retrieve the set of values that occur in matches for c2.
474 * @return the Set of all values or empty set if there are no matches
475 *
476 */
477 public Set<EClass> getAllValuesOfc2() {
478 return rawStreamAllValuesOfc2(emptyArray()).collect(Collectors.toSet());
479 }
480
481 /**
482 * Retrieve the set of values that occur in matches for c2.
483 * @return the Set of all values or empty set if there are no matches
484 *
485 */
486 public Stream<EClass> streamAllValuesOfc2() {
487 return rawStreamAllValuesOfc2(emptyArray());
488 }
489
490 /**
491 * Retrieve the set of values that occur in matches for c2.
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> streamAllValuesOfc2(final SuperTypes.Match partialMatch) {
501 return rawStreamAllValuesOfc2(partialMatch.toArray());
502 }
503
504 /**
505 * Retrieve the set of values that occur in matches for c2.
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> streamAllValuesOfc2(final EClass pC1) {
515 return rawStreamAllValuesOfc2(new Object[]{pC1, null});
516 }
517
518 /**
519 * Retrieve the set of values that occur in matches for c2.
520 * @return the Set of all values or empty set if there are no matches
521 *
522 */
523 public Set<EClass> getAllValuesOfc2(final SuperTypes.Match partialMatch) {
524 return rawStreamAllValuesOfc2(partialMatch.toArray()).collect(Collectors.toSet());
525 }
526
527 /**
528 * Retrieve the set of values that occur in matches for c2.
529 * @return the Set of all values or empty set if there are no matches
530 *
531 */
532 public Set<EClass> getAllValuesOfc2(final EClass pC1) {
533 return rawStreamAllValuesOfc2(new Object[]{pC1, null}).collect(Collectors.toSet());
534 }
535
536 @Override
537 protected SuperTypes.Match tupleToMatch(final Tuple t) {
538 try {
539 return SuperTypes.Match.newMatch((EClass) t.get(POSITION_C1), (EClass) t.get(POSITION_C2));
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 SuperTypes.Match arrayToMatch(final Object[] match) {
548 try {
549 return SuperTypes.Match.newMatch((EClass) match[POSITION_C1], (EClass) match[POSITION_C2]);
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 SuperTypes.Match arrayToMatchMutable(final Object[] match) {
558 try {
559 return SuperTypes.Match.newMutableMatch((EClass) match[POSITION_C1], (EClass) match[POSITION_C2]);
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<SuperTypes.Matcher> querySpecification() {
572 return SuperTypes.instance();
573 }
574 }
575
576 private SuperTypes() {
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 SuperTypes instance() {
586 try{
587 return LazyHolder.INSTANCE;
588 } catch (ExceptionInInitializerError err) {
589 throw processInitializerError(err);
590 }
591 }
592
593 @Override
594 protected SuperTypes.Matcher instantiate(final ViatraQueryEngine engine) {
595 return SuperTypes.Matcher.on(engine);
596 }
597
598 @Override
599 public SuperTypes.Matcher instantiate() {
600 return SuperTypes.Matcher.create();
601 }
602
603 @Override
604 public SuperTypes.Match newEmptyMatch() {
605 return SuperTypes.Match.newEmptyMatch();
606 }
607
608 @Override
609 public SuperTypes.Match newMatch(final Object... parameters) {
610 return SuperTypes.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.SuperTypes (visibility: PUBLIC, simpleName: SuperTypes, identifier: queries.SuperTypes, 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.SuperTypes (visibility: PUBLIC, simpleName: SuperTypes, identifier: queries.SuperTypes, 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 SuperTypes INSTANCE = new SuperTypes();
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 SuperTypes.GeneratedPQuery INSTANCE = new GeneratedPQuery();
641
642 private final PParameter parameter_c1 = new PParameter("c1", "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_c2 = new PParameter("c2", "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_c1, parameter_c2);
647
648 private GeneratedPQuery() {
649 super(PVisibility.PUBLIC);
650 }
651
652 @Override
653 public String getFullyQualifiedName() {
654 return "queries.superTypes";
655 }
656
657 @Override
658 public List<String> getParameterNames() {
659 return Arrays.asList("c1","c2");
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_c1 = body.getOrCreateVariableByName("c1");
674 PVariable var_c2 = body.getOrCreateVariableByName("c2");
675 new TypeConstraint(body, Tuples.flatTupleOf(var_c1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
676 new TypeConstraint(body, Tuples.flatTupleOf(var_c2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
677 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
678 new ExportedParameter(body, var_c1, parameter_c1),
679 new ExportedParameter(body, var_c2, parameter_c2)
680 ));
681 // EClass.eSuperTypes(c1,c2)
682 new TypeConstraint(body, Tuples.flatTupleOf(var_c1), 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_c1, 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_c2);
687 bodies.add(body);
688 }
689 return bodies;
690 }
691 }
692}
diff --git a/Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig b/Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig
index 4ce9da27..04351a6e 100644
--- a/Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig
+++ b/Metrics/Metrics-Calculation/SocialNetwork_plugin/yakinduGeneration.vsconfig
@@ -9,19 +9,19 @@ generate {
9 solver = ViatraSolver 9 solver = ViatraSolver
10 10
11 scope = { 11 scope = {
12 #node = 98 12 #node = 30
13 } 13 }
14 14
15 number = 1 15 number = 1
16 runs = 1 16 runs = 100
17 config = { 17 config = {
18 log-level = none, 18 log-level = none,
19 "optional-wf" = "true", 19 "optional-wf" = "false",
20 "realistic-guidance" = "Composite", 20 "realistic-guidance" = "Composite",
21 "allow-must-violations" = "true", 21 "allow-must-violations" = "false",
22 "domain" = "Yakindumm" 22 "domain" = "Yakindumm"
23 } 23 }
24 24
25 debug = "debug" 25 debug = "debug"
26 output = "output/Viatra_100/" 26 output = "output/real_30+v/"
27} \ No newline at end of file 27} \ No newline at end of file