|
Re: Indexing model changes [message #1828316 is a reply to message #1828304] |
Sun, 07 June 2020 11:13 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi Saheed,
Hawk computes some of this information, but its default updater does not store it. You could create a custom updater (based on the current time-aware updater) that stores this additional information in the repository.
In order to use that new updater, you will need to create your own IHawkFactory itself. Let me know if you need help with that!
Kind regards,
Antonio
|
|
|
|
Re: Indexing model changes [message #1828349 is a reply to message #1828327] |
Mon, 08 June 2020 09:19 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
GraphModelInserter.calculateModelDeltaRatio computes the ratio of change of a file, measured as the proportion of objects that were added, updated, retyped or deleted in it. To do so, it classifies the various objects in the current file into those categories. Rather than EMF Compare, it uses a signature-based comparison (the signature is computed by the IHawkObject: in EMF it is based on applying SHA1 to its location / type / attributes / references) to detect updated objects.
The TimeAwareModelUpdater has a custom GraphModelInserter which still does this classification, but always returns 0 as the ratio to ensure that updates are always transactional: this way we force Hawk to apply changes incrementally (needed for the temporal graph), rather than do a "batch" update when it deletes the entire file and reindexes it (which is more performant in the non-timeaware case when we just want the latest version).
BTW, you can already see how we store information for the repository node in the TimeAwareIndexer class, using the setIndexedRevision method.
|
|
|
|
|
Re: Indexing model changes [message #1828612 is a reply to message #1828606] |
Mon, 15 June 2020 07:58 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
calculateModelDeltaRatio does not use EMF or EMF Compare at all - as I said above, it uses a signature-based approach to detect changes. If you only want to count the number of changes, that would be enough: you don't need to do any additional comparisons.
However, if you really need to use EMF Compare, the .emfresource plugin has a LocalHawkResourceImpl class that provides a read-only EMF resource view over a Hawk graph (it's the same one as for .localhawkmodel files). Before the updater changes the graph, the graph should reflect the previous version of the model (if present). You could cast down the IHawkResource that Hawk is currently processing to an EmfResource, and then get the underlying EMF resource for the new version of the model, then run the comparison. LocalHawkResourceImpl accepts a number of repoPatterns and filePatterns that can limit the scope of the resource.
|
|
|
Re: Indexing model changes [message #1829082 is a reply to message #1828612] |
Wed, 24 June 2020 21:36 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Saheed Popoola![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=popsap4me%40yahoo.com) Messages: 21 Registered: June 2019 |
Junior Member |
|
|
I'm having issues with the query. When I called the function "ChangeNode repNode = new ChangeManager((ITimeAwareGraphDatabase) graph).getOrCreateChangeNode();" from the query language, it returns a different node (with different id and null info), but when I called it within the setIndexedChanges in my custom indexer, it returns the real node. What could be wrong? Note, the repositoryNode for commit messages works fine in the Query language. Here is my code snippets.
public void setIndexedChanges(Collection<DiffChange> change) throws Exception {
try (IGraphTransaction tx = graph.beginTransaction()) {
ChangeManager manager = new ChangeManager((ITimeAwareGraphDatabase) graph);
ChangeNode repoNode = manager.getOrCreateChangeNode();
repo.setAdd(my variable);
tx.success();
}
ChangeNode repNode = new ChangeManager((ITimeAwareGraphDatabase) graph).getOrCreateChangeNode();
}
//constructor for ChangeManager
public ChangeManager(ITimeAwareGraphDatabase db) {
this.db = db;
this.idx = db.getOrCreateNodeIndex("_hawkChangeIndex");
}
//getorCreateChangeNode method
public ChangeNode getOrCreateChangeNode() {
String repoURI ="_hawkChangerrr";
String URI_PROPERTY = "uri";
IGraphIterable<? extends IGraphNode> iNode = idx.get(URI_PROPERTY, repoURI);
if (iNode.size() > 0) {
return new ChangeNode((ITimeAwareGraphNode) iNode.getSingle());
} else {
final ITimeAwareGraphNode node = db.createNode(
Collections.singletonMap(URI_PROPERTY, repoURI), "_hawkChanger");
idx.add(node, URI_PROPERTY, repoURI);
return new ChangeNode(node);
}
}
|
|
|
Re: Indexing model changes [message #1829148 is a reply to message #1829082] |
Thu, 25 June 2020 21:51 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Saheed Popoola![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=popsap4me%40yahoo.com) Messages: 21 Registered: June 2019 |
Junior Member |
|
|
for every query I run in the UI (after the indexing); it firsts create a new node (instead of retrieving an existing node) which indicates that the original node may not be in the database. So it only has the URI_PROPERTY which is stated in the function getOrCreateChangeNode().
[Updated on: Fri, 26 June 2020 04:00] Report message to a moderator
|
|
|
Re: Indexing model changes [message #1829163 is a reply to message #1829148] |
Fri, 26 June 2020 07:59 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
You have to be careful with the timepoint that the ITimeAwareGraphDatabase is at when you create the node. If the timepoint of the graph is X when you create the node, then it will only be available from X onwards.
Could you double check the result of ((ITimeAwareGraphDatabase)graph).getTime() in both places?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04377 seconds