aboutsummaryrefslogtreecommitdiffstats
path: root/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph
diff options
context:
space:
mode:
authorLibravatar 20001LastOrder <boqi.chen@mail.mcgill.ca>2019-07-16 10:54:25 -0400
committerLibravatar 20001LastOrder <boqi.chen@mail.mcgill.ca>2019-07-16 10:54:25 -0400
commit59ef2d4560cde4954c5e1f850958c0ca59c742df (patch)
tree60373712073928d27dd657439b2430fa4ca09bc7 /Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph
parentmeasurements for the different violation types, comparison for differenct gen... (diff)
downloadVIATRA-Generator-59ef2d4560cde4954c5e1f850958c0ca59c742df.tar.gz
VIATRA-Generator-59ef2d4560cde4954c5e1f850958c0ca59c742df.tar.zst
VIATRA-Generator-59ef2d4560cde4954c5e1f850958c0ca59c742df.zip
consider node types during generation
Diffstat (limited to 'Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph')
-rw-r--r--Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/EMFGraph.xtend23
-rw-r--r--Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/GraphStatistic.xtend6
-rw-r--r--Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/PartialInterpretationGraph.xtend15
3 files changed, 38 insertions, 6 deletions
diff --git a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/EMFGraph.xtend b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/EMFGraph.xtend
index b4c57bd8..4ebd59b7 100644
--- a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/EMFGraph.xtend
+++ b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/EMFGraph.xtend
@@ -30,13 +30,26 @@ class EMFGraph extends Graph{
30 ] 30 ]
31 31
32 referenceTypes.forEach[it| 32 referenceTypes.forEach[it|
33 statistic.addEdgeType(it.name); 33 var typeToAdd = it;
34
35 // TODO: Here is to only consider one part of opposite edges
36// if(it.upperBound != -1 && it.EOpposite !== null &&
37// (it.EOpposite.upperBound == -1 || it.EOpposite.upperBound > it.upperBound
38// )){
39// typeToAdd = it.EOpposite;
40// }
41 //if(!typeToAdd.name.equals('incomingTransitions')){
42 statistic.addEdgeType(typeToAdd.name);
43 //}
34 ]; 44 ];
35 45
36 objects.forEach[source| 46 objects.forEach[source|
37 source.eClass.EAllReferences.forEach[r| 47 source.eClass.EAllReferences.forEach[r|
38 //add the type first (if it is not added already) 48 //add the type first (if it is not added already)
39 //many references 49 //many references
50// if(r.name.equals('incomingTransitions')){
51// return;
52// }
40 if(r.isMany){ 53 if(r.isMany){
41 source.getNeighbours(r).forEach[target| 54 source.getNeighbours(r).forEach[target|
42 addEdge(source, target, r); 55 addEdge(source, target, r);
@@ -85,6 +98,14 @@ class EMFGraph extends Graph{
85 } 98 }
86 99
87 def addEdge(EObject source, EObject target, EReference r){ 100 def addEdge(EObject source, EObject target, EReference r){
101 // TODO: Here is to only consider one part of opposite edges
102 //check for the opposite reference and do not add if its opposite will be added
103// if(r.upperBound != -1 && r.EOpposite !== null &&
104// (r.EOpposite.upperBound == -1 || r.EOpposite.upperBound > r.upperBound
105// )){
106// return;
107// }
108
88 if(target !== null && r !== null){ 109 if(target !== null && r !== null){
89 statistic.addEdge(source, target, r.name); 110 statistic.addEdge(source, target, r.name);
90 } 111 }
diff --git a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/GraphStatistic.xtend b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/GraphStatistic.xtend
index 9b8fd0e3..84071176 100644
--- a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/GraphStatistic.xtend
+++ b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/GraphStatistic.xtend
@@ -8,6 +8,7 @@ import java.util.List
8import java.util.Map 8import java.util.Map
9import java.util.Set 9import java.util.Set
10import org.eclipse.emf.ecore.EObject 10import org.eclipse.emf.ecore.EObject
11import org.eclipse.emf.ecore.EReference
11 12
12class GraphStatistic { 13class GraphStatistic {
13 val incomingEdges = new HashMap<String, Multimap<EObject, EObject>>; 14 val incomingEdges = new HashMap<String, Multimap<EObject, EObject>>;
@@ -21,9 +22,12 @@ class GraphStatistic {
21 * @param type: type to add 22 * @param type: type to add
22 */ 23 */
23 def void addEdgeType(String type){ 24 def void addEdgeType(String type){
25
26
24 if(edgeTypes.contains(type)){ 27 if(edgeTypes.contains(type)){
25 return; 28 return;
26 } 29 }
30
27 edgeTypes.add(type); 31 edgeTypes.add(type);
28 incomingEdges.put(type, ArrayListMultimap.create()); 32 incomingEdges.put(type, ArrayListMultimap.create());
29 outcomingEdges.put(type, ArrayListMultimap.create()); 33 outcomingEdges.put(type, ArrayListMultimap.create());
diff --git a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/PartialInterpretationGraph.xtend b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/PartialInterpretationGraph.xtend
index 91d7c5f9..bb679bf6 100644
--- a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/PartialInterpretationGraph.xtend
+++ b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/PartialInterpretationGraph.xtend
@@ -19,7 +19,11 @@ class PartialInterpretationGraph extends Graph{
19 //the edge types are defined in terms of RelationDeclaration 19 //the edge types are defined in terms of RelationDeclaration
20 partial.problem.relations.filter(RelationDeclaration).forEach[ 20 partial.problem.relations.filter(RelationDeclaration).forEach[
21 //only need the name of the reference type (remove everything with and after "reference") 21 //only need the name of the reference type (remove everything with and after "reference")
22 this.statistic.addEdgeType(it.name.split(" ").get(0)); 22 var n = it.name.split(" ").get(0);
23 // TODO: Here is to only consider one part of opposite edges
24 //if(!n.equals('target') && !n.equals('source') /* && !n.equals('incomingTransitions')*/){
25 this.statistic.addEdgeType(n);
26 //}
23 ] 27 ]
24 // add all elements 28 // add all elements
25 val typeInterpretations = getTypes(partial); 29 val typeInterpretations = getTypes(partial);
@@ -33,9 +37,12 @@ class PartialInterpretationGraph extends Graph{
33 for(relationInterpretation : partial.partialrelationinterpretation) { 37 for(relationInterpretation : partial.partialrelationinterpretation) {
34 //only need the name of the reference type (remove everything with and after "reference") 38 //only need the name of the reference type (remove everything with and after "reference")
35 val type = relationInterpretation.interpretationOf.name.split(" ").get(0); 39 val type = relationInterpretation.interpretationOf.name.split(" ").get(0);
36 for(edge : relationInterpretation.relationlinks.filter(BinaryElementRelationLink)){ 40 // TODO: Here is to only consider one part of opposite edges
37 statistic.addEdge(edge.param1, edge.param2, type); 41 //if(!type.equals('target') && !type.equals('source') /*&& !type.equals('incomingTransitions')*/){
38 } 42 for(edge : relationInterpretation.relationlinks.filter(BinaryElementRelationLink)){
43 statistic.addEdge(edge.param1, edge.param2, type);
44 }
45 //}
39 } 46 }
40 47
41 this.name = name; 48 this.name = name;