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-31 14:45:06 -0400
committerLibravatar 20001LastOrder <boqi.chen@mail.mcgill.ca>2019-07-31 14:45:06 -0400
commit5e8b8c3a817dd9f7ae46338b6dbd3684dfb885fe (patch)
tree61b473589e5e43a58481ea28b7bbeeaf0860dcdb /Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph
parentconsider node types during generation (diff)
downloadVIATRA-Generator-5e8b8c3a817dd9f7ae46338b6dbd3684dfb885fe.tar.gz
VIATRA-Generator-5e8b8c3a817dd9f7ae46338b6dbd3684dfb885fe.tar.zst
VIATRA-Generator-5e8b8c3a817dd9f7ae46338b6dbd3684dfb885fe.zip
Further development of realistic solver, create generation config for ecore models
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.xtend12
-rw-r--r--Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/graph/PartialInterpretationGraph.xtend17
2 files changed, 14 insertions, 15 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 4ebd59b7..959006f4 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
@@ -24,7 +24,8 @@ class EMFGraph extends Graph{
24 */ 24 */
25 def void init(List<EObject> objects, List<Metric> metrics, String name, List<EReference> referenceTypes){ 25 def void init(List<EObject> objects, List<Metric> metrics, String name, List<EReference> referenceTypes){
26 objects.forEach[it| 26 objects.forEach[it|
27 var types = new HashSet(it.eClass.EAllSuperTypes.map[it|it.name]); 27 // TODO: Maybe want to consider all the super types as well
28 var types = new HashSet();
28 types.add(it.eClass.name); 29 types.add(it.eClass.name);
29 statistic.addNodeWithAllTypes(it, types); 30 statistic.addNodeWithAllTypes(it, types);
30 ] 31 ]
@@ -38,18 +39,13 @@ class EMFGraph extends Graph{
38// )){ 39// )){
39// typeToAdd = it.EOpposite; 40// typeToAdd = it.EOpposite;
40// } 41// }
41 //if(!typeToAdd.name.equals('incomingTransitions')){ 42//
42 statistic.addEdgeType(typeToAdd.name); 43 statistic.addEdgeType(typeToAdd.name);
43 //}
44 ]; 44 ];
45 45
46 objects.forEach[source| 46 objects.forEach[source|
47 source.eClass.EAllReferences.forEach[r| 47 source.eClass.EAllReferences.forEach[r|
48 //add the type first (if it is not added already)
49 //many references 48 //many references
50// if(r.name.equals('incomingTransitions')){
51// return;
52// }
53 if(r.isMany){ 49 if(r.isMany){
54 source.getNeighbours(r).forEach[target| 50 source.getNeighbours(r).forEach[target|
55 addEdge(source, target, r); 51 addEdge(source, target, r);
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 bb679bf6..ef68f366 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
@@ -21,16 +21,19 @@ class PartialInterpretationGraph extends Graph{
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 var n = 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 23 // TODO: Here is to only consider one part of opposite edges
24 //if(!n.equals('target') && !n.equals('source') /* && !n.equals('incomingTransitions')*/){ 24 if(!n.equals('target') && !n.equals('source') /* && !n.equals('incomingTransitions')*/){
25 this.statistic.addEdgeType(n); 25 this.statistic.addEdgeType(n);
26 //} 26 }
27 ] 27 ]
28 // add all elements 28 // add all elements
29 val typeInterpretations = getTypes(partial); 29 val typeInterpretations = getTypes(partial);
30 for(type : typeInterpretations){ 30 for(type : typeInterpretations){
31 var typeName = type.interpretationOf.name.replace(classSuffix, ''); 31 //Only consider the most concrete class
32 for(node : type.elements){ 32 if(type.interpretationOf.subtypes.size == 0){
33 this.statistic.addNodeWithType(node, typeName); 33 var typeName = type.interpretationOf.name.replace(classSuffix, '');
34 for(node : type.elements){
35 this.statistic.addNodeWithType(node, typeName);
36 }
34 } 37 }
35 } 38 }
36 39
@@ -38,11 +41,11 @@ class PartialInterpretationGraph extends Graph{
38 //only need the name of the reference type (remove everything with and after "reference") 41 //only need the name of the reference type (remove everything with and after "reference")
39 val type = relationInterpretation.interpretationOf.name.split(" ").get(0); 42 val type = relationInterpretation.interpretationOf.name.split(" ").get(0);
40 // TODO: Here is to only consider one part of opposite edges 43 // TODO: Here is to only consider one part of opposite edges
41 //if(!type.equals('target') && !type.equals('source') /*&& !type.equals('incomingTransitions')*/){ 44 if(!type.equals('target') && !type.equals('source') /*&& !type.equals('incomingTransitions')*/){
42 for(edge : relationInterpretation.relationlinks.filter(BinaryElementRelationLink)){ 45 for(edge : relationInterpretation.relationlinks.filter(BinaryElementRelationLink)){
43 statistic.addEdge(edge.param1, edge.param2, type); 46 statistic.addEdge(edge.param1, edge.param2, type);
44 } 47 }
45 //} 48 }
46 } 49 }
47 50
48 this.name = name; 51 this.name = name;