Flock Ecore Migration leaving dangling reference [message #1857421] |
Tue, 07 February 2023 01:41 |
|
I would like to remove a marker interface from a metamodel in a declarative fashion, so I wanted to use flock. The code below does not work, as it leaves behind dangling references shown as question marks. See Emfatic sample snippet at the bottom.
At the core of the issue seems to be that the eSuperTypes feature is not available in the normal way. I have tried to use the underlying Java method, and have been able to call it, but have not found a way to do a replacement.
Any advice on this? I know this can be done with EOL, but to me using Flock seemed a nicer approach.
Thanks!
@cascade
delete EClass when: original.name = "IdentifiedObject"
@namespace(uri="metamodel", prefix="metamodel")
package metamodel;
class Feature extends ? {
attr String[1] name;
attr String[1] value;
}
abstract class ArchimateModelObject extends ?, Features, Identifier, Nameable {
}
Issue as it shows when accessing the property, even if quoted:
copyMetamodelToEcore:
[epsilon.flock - fixCbcore.mig] EXCEPTION: Property 'eSuperTypes' not found in object
[epsilon.flock - fixCbcore.mig] at (/home/jg/git/TOGAFBot/implementation/modelMaintenance/fixCbcore.mig@12:4-12:52)
[epsilon.flock - fixCbcore.mig] at (unknown@0:0-0:0)
[epsilon.flock - fixCbcore.mig] at (/home/jg/git/TOGAFBot/implementation/modelMaintenance/fixCbcore.mig@1:0-13:1)
[epsilon.flock - fixCbcore.mig]
[Updated on: Tue, 07 February 2023 01:48] Report message to a moderator
|
|
|
|
|
Re: Flock Ecore Migration leaving dangling reference [message #1857424 is a reply to message #1857423] |
Tue, 07 February 2023 03:59 |
|
Disregard, please! The code below works fine. The issue is removing the referenced type before the transform, which is the correct execution order of flock as documented.
migrate EClass {
migrated.eSuperTypes = original.eSuperTypes.select(t | t.name != "IdentifiedObject");
}
and then, in the pipeline:
var identifiedObjects = EClass.all().select(c | c.name = "IdentifiedObject");
for (identifiedObject: EClass in identifiedObjects){delete identifiedObject;}
|
|
|
Powered by
FUDForum. Page generated in 0.03485 seconds