|
Re: Linking model elements [message #1832433 is a reply to message #1832429] |
Thu, 17 September 2020 20:02 |
|
With the default model indexer and updater, in order for an object to qualify as the next version of an existing object, it must a) belong to the same repository, b) be in the same file with the same identifier (for EMF, it's usually the uriFragment), and c) be the same type.
If the "existing object" was in a different repository, then Hawk will see the objects in your "separate repository" as new objects by default. There are several ways to solve this:
1. Use a single Git repository, where the initial commit is the contents of the original repository, and your later commits have the contents of that "separate repository" (but with the objects in the same exact locations as the original ones). Use the JGit location type so Hawk will only look at the commits and not at the working tree.
2. Keep using separate repositories, but use derived edges (basically, derived attributes whose expressions return sequences of objects) to link up "equivalent" objects. This doesn't require any custom coding, but it will require tweaking your EOL queries to follow those derived edges.
3. Create a custom location type which uses the contents of the "original model directory" for the first revision and then switches over to the other repository for later revisions.
4. Create a custom updater with custom logic to handle this situation.
For derived edges, you can use derived attributes as usual (the Attribute Type is irrelevant):
https://www.eclipse.org/hawk/basic-use/core-concepts/#managing-derived-attributes
[Updated on: Thu, 17 September 2020 20:02] Report message to a moderator
|
|
|
|
Re: Linking model elements [message #1832492 is a reply to message #1832439] |
Fri, 18 September 2020 21:51 |
|
Right, I see. If you have A1 and A1' of type A in the same backend, and you just want to link them, the easiest way is to use a derived edge as I mentioned above. You'd probably need some kind of unique ID to correlate the original and extended versions (the URI fragment might work if they are the same, using eURIFragment), and then do something like this for the EOL derived edge expression:
if (self.isExtended) {
return A.travelInTime(self.timepoint).select(e|e.uniqueID=self.uniqueID and e.node.id <> self.node.id);
} else {
return Sequence {};
}
You'd need to index A by uniqueID, though - otherwise, doing this linking may be expensive.
|
|
|
Powered by
FUDForum. Page generated in 0.02958 seconds