Processing an Ecore-Based Model as a Graph [message #1415196] |
Tue, 02 September 2014 05:41  |
Eclipse User |
|
|
|
Hello,
I currently have a graphml model/muddle and an EOL program which processes this model. However, I would like to (minimally) modify my EOL program to process an Ecore-based version of my model. I am therefore looking to replace the code below with something that would perform the equivalent function but with an Ecore-based model:
var elements = myModel.muddle.elements;
var nodes = elements.select(e|e.type.eClass().name = "MuddleElementType");
var edges = elements.select(e|e.type.eClass().name = "LinkElementType");
for(e in edges)
{
if(e.Target = self && e.Source = x)
{
}
}
for (n in nodes
{
//process
}
Having looked at the Javadoc for EmfModel, I noticed the methods
getAllOfType, getAllOfKind, and allContents. I tried:
var elements = myModel.getAllOfKind("EObject");
var elements = myModel.allContents();
These lines of code only returned the "nodes", that is, the EReferences (edges) were not returned. Furthermore, var edges = myModel.getAllOfKind("EReference") returned zero elements.
Does anyone have any suggestions?
Even if it is possible to obtain a list of all EReferences in a model, is it then possible to obtain the source and target EObjects given an EReference (as shown in the code above)? It would appear to me that it is only possible to determine the target of an EReference from a given source EObject.
Thanks,
Tom
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04246 seconds