Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] How to correctly build rules?

Hi Jens,

On 10/15/2012 05:42 PM, Jens Bürger wrote:
Am 09.10.2012 20:05, schrieb Christian Krause:
Hi Jens,

Am 05.10.2012 19:29, schrieb Jens Bürger:
Henshin even seems to apply a transformation, but instead of adding
the desired stereotype, it (aims to) remove the two other stereotypes
(the one from aNode and the CommunicationPath) -- maybe I
misunderstood how transformation rules work here?

Could it be that the stereotypes are root nodes?

It seems so, because the tree of the UML-XMI looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1"  ... >
  <uml:Model xmi:id="idModel" name="seclinksModel">
 ...
  </uml:Model>
  <UMLsec:Internet ...   />
  <UMLsec:critical ...    />
</xmi:XMI>

If you execute your
transformation programmatically, try this: call graph.getRoots()

This way the application of the stereotype seems to run fine.

great.


My only problem is: how can I save the graph? :)


This is easy. The saveEObject() method is just a convenience method. You can save your objects directly using the EMF API:

Resource resource = resourceSet.createResource(uri);
resource.getContents().addAll(graph.getRoots());
try {
      resource.save(null);
} catch (IOException e) {
    // ...
}

Cheers,
Christian

The graph is a Egraph, but saveEObject does only take an EObject. The only thing I can do at the moment is calling
graph.getRoots().get(0)
or something.

Thanks,

Jens
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



Back to the top