Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Hawk » Linking model elements(linking copies of model element that is indexed in separate repositories)
Linking model elements [message #1832429] Thu, 17 September 2020 17:39 Go to next message
Saheed Popoola is currently offline Saheed PopoolaFriend
Messages: 21
Registered: June 2019
Junior Member
I am trying to index model elements and some other properties (e.g change type). However, I would like to link my indexed model element to the exact copy of the element that is already indexed in hawk. For example, during the indexing of an element A in hawk, i also create a separate repository where I indexed the same element A along with a new property say (Add) . So when I query Add I can get the element A, and if I want to get the history of A, I can just locate the A that has been indexed in Hawk and get it from there.

Thanks
Re: Linking model elements [message #1832433 is a reply to message #1832429] Thu, 17 September 2020 20:02 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 597
Registered: January 2010
Location: Birmingham, UK
Senior Member

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 #1832439 is a reply to message #1832433] Fri, 18 September 2020 03:31 Go to previous messageGo to next message
Saheed Popoola is currently offline Saheed PopoolaFriend
Messages: 21
Registered: June 2019
Junior Member
Thanks for the reply. It also provided some fresh insights which I didn't know was possible. But just to clarify, by different repositories I actually meant it is stored in different nodes in the backend. I'm talking about a scenario during the indexing phase where I stored a copy of the element in another node in the backend. So it is still the same element from the same repositories, I just created an extra node to store new information, but I would like to link it to the main element that has been indexed by Hawk. I'm sorry about the misinterpretation
Re: Linking model elements [message #1832492 is a reply to message #1832439] Fri, 18 September 2020 21:51 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 597
Registered: January 2010
Location: Birmingham, UK
Senior Member

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.
Previous Topic:Tracking deleted model elements
Next Topic:Queries to get deleted elements
Goto Forum:
  


Current Time: Fri May 24 19:07:26 GMT 2024

Powered by FUDForum. Page generated in 0.03629 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top