Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EMF-IncQuery » Migration to 0.9.0 documentation?
Migration to 0.9.0 documentation? [message #1613728] Thu, 12 February 2015 21:31 Go to next message
Jan Reimann is currently offline Jan ReimannFriend
Messages: 140
Registered: July 2009
Senior Member
Hi guys,
at first: congratulations for the new release :) Good work!
At second: I just saw that my code regarding the generic API has compile
errors. Do you provide any documentation about migration issues?
Especially 2 things are needed for my case:

1) index filtering:
BaseIndexOptions options = new BaseIndexOptions();
options.setResourceFilterConfiguration(new IBaseIndexResourceFilter() {

@Override
public boolean isResourceFiltered(Resource resource) {
// PathMap URI scheme is used to refer to JDK classes
return "pathmap".equals(resource.getURI().scheme());
}
});

The method isResourceFiltered(..) doesn't exist anymore.

2) engine creation:
IncQueryEngine engine = IncQueryEngine.on(resourceSet);
the on(..) method is deprecated.

How can I proceed here?

cheers,
Jan
Re: Migration to 0.9.0 documentation? [message #1614558 is a reply to message #1613728] Fri, 13 February 2015 10:22 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi,

thank you for pointing out these issues in our documentation. We believed, version 0.9 does not require special migration steps, and left out the migration guide deliberately, but I guess, we were wrong here.

1) The method was renamed to withResourceFiltered() that creates a copy of the configuration. This was done to avoid problematic cases when it called after an engine was initialized from the configuration, this configuration would be inconsistent with the correct settings.

On the other hand, this plain renaming was not a good idea. To help with the issue, I am putting back the old methods with a deprecation comment to use the old ones, and we will have a quick bugfix version where this change would be included.

2) This change was done to make IncQuery less EMF-dependent, and the concept of Scopes were introduced. EMF scopes created for the old versions can be created with new EMFScope(Notifier) call, and this can be added as a parameter. We have added a deprecation message to original on method to help migrating to the new version. Your code should be like

IncQueryEngine engine = IncQueryEngine.on(new EMFScope(resourceSet));

Did you have any other issues with the generic API that was not clear or needed documenting? We would be very grateful for finding these gaps in our documentation, and try to make it better.

Cheers,
Zoltán
Re: Migration to 0.9.0 documentation? [message #1614837 is a reply to message #1614558] Fri, 13 February 2015 14:31 Go to previous messageGo to next message
Jan Reimann is currently offline Jan ReimannFriend
Messages: 140
Registered: July 2009
Senior Member
Thanks Zoltan! From my point of using the generic API there are no other
issues.

cheers,
Jan
Re: Migration to 0.9.0 documentation? [message #1640801 is a reply to message #1613728] Sat, 28 February 2015 08:28 Go to previous messageGo to next message
Jan Reimann is currently offline Jan ReimannFriend
Messages: 140
Registered: July 2009
Senior Member
I want to come back to my first point regarding the index filtering.
Yesterday I played around a little bit and was wondering why the access
of my JaMoPP-based Java models takes so long. I use the following
snippet to register the filtering:

ResourceSet resourceSet;
Pattern pattern
BaseIndexOptions options = new BaseIndexOptions();
options.withResourceFilterConfiguration(new IBaseIndexResourceFilter() {

@Override
public boolean isResourceFiltered(Resource resource) {
return "pathmap".equals(resource.getURI().scheme());
}
});
EMFScope scope = new EMFScope(resourceSet, options);
IncQueryEngine engine = IncQueryEngine.on(scope);
SpecificationBuilder builder = new SpecificationBuilder();
IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>>
querySpecification = builder.getOrCreateSpecification(pattern);
IncQueryMatcher<? extends IPatternMatch> matcher =
engine.getMatcher(querySpecification);
Collection<? extends IPatternMatch> matches = matcher.getAllMatches();

While debugging I noticed that the isResourceFiltered(Resource resource)
method is never executed. Am I doing something wrong here?

cheers,
Jan

Am 12.02.2015 um 22:31 schrieb Jan Reimann:
> Hi guys,
> at first: congratulations for the new release :) Good work!
> At second: I just saw that my code regarding the generic API has compile
> errors. Do you provide any documentation about migration issues?
> Especially 2 things are needed for my case:
>
> 1) index filtering:
> BaseIndexOptions options = new BaseIndexOptions();
> options.setResourceFilterConfiguration(new IBaseIndexResourceFilter() {
>
> @Override
> public boolean isResourceFiltered(Resource resource) {
> // PathMap URI scheme is used to refer to JDK classes
> return "pathmap".equals(resource.getURI().scheme());
> }
> });
>
> The method isResourceFiltered(..) doesn't exist anymore.
>
> 2) engine creation:
> IncQueryEngine engine = IncQueryEngine.on(resourceSet);
> the on(..) method is deprecated.
>
> How can I proceed here?
>
> cheers,
> Jan
Re: Migration to 0.9.0 documentation? [message #1642889 is a reply to message #1640801] Sun, 01 March 2015 08:59 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi Jan,

the change here is that the withResourceFilterConfiguration() method creates a new instance of the BaseIndexOptions and returns it after the method is called. This allows setting multiple properties in a fluent-like API, but you have to use the last instance. This change was done to keep BaseIndexOptions immutable after created. In other words, I suggest using it as follows:

BaseIndexOptions options = new BaseIndexOptions().withResourceFilterConfiguration(new IBaseIndexResourceFilter() {
...
}

Cheers,
Zoltán
Re: Migration to 0.9.0 documentation? [message #1642961 is a reply to message #1642889] Sun, 01 March 2015 09:48 Go to previous message
Jan Reimann is currently offline Jan ReimannFriend
Messages: 140
Registered: July 2009
Senior Member
Thanks!

Am 01.03.2015 um 09:59 schrieb Zoltan Ujhelyi:
> Hi Jan,
>
> the change here is that the withResourceFilterConfiguration() method
> creates a new instance of the BaseIndexOptions and returns it after the
> method is called. This allows setting multiple properties in a
> fluent-like API, but you have to use the last instance. This change was
> done to keep BaseIndexOptions immutable after created. In other words, I
> suggest using it as follows:
>
> BaseIndexOptions options = new
> BaseIndexOptions().withResourceFilterConfiguration(new
> IBaseIndexResourceFilter() {
> ..
> }
>
> Cheers,
> Zoltán
Previous Topic:Newbie questions - please help me understand
Next Topic:Extract transitive closure path from match
Goto Forum:
  


Current Time: Wed Dec 04 16:41:38 GMT 2024

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

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

Back to the top