Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF Query2]first steps with EMF query2
[EMF Query2]first steps with EMF query2 [message #651523] Mon, 31 January 2011 14:38 Go to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 636
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

I would like to search quickly in several EMF files (GMF to be more precised).

I think that EMF query is a solution Smile but I have some questions:

Where can I download EMF query 2? I find update site only for emf query 1.4.0 (on http://download.eclipse.org/modeling/emf/updates/) and on download page for EMF query 2, there is a build tagged from 2009 :s

Is there specific documentation on EMF query (on EMF query 2)?
I see that there is an example plugin, maybe all documentation needed is in it for EMF query. I don't have a look at it for now. Maybe I should begin directly with EMF query2 (as soon a s I find it ^^) or is it similarly and I can take a look at it?

Thanks by advance,

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: [EMF Query2]first steps with EMF query2 [message #651556 is a reply to message #651523] Mon, 31 January 2011 16:14 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Aurelien,

Please find the details below.

Update site link is
https://hudson.eclipse.org/hudson/job/tycho-query2-nightly/l astSuccessfulBuild/artifact/targetPlatform/

Developer guide on how to setup ,execute queries and other useful information about Query2 can be found here.

http://wiki.eclipse.org/EMF/Query2/DevGuide

Please let us know if you face any problems further.

Cheers,
Saurav


Re: [EMF Query2]first steps with EMF query2 [message #651569 is a reply to message #651523] Mon, 31 January 2011 16:46 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 636
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Thanks for your quick answer Smile

You recommend m eto use a nightly build? Is there a stable release? At least, when is planned the stable release? for Indigo?

And, a firstlook to the guide: it seems really nice Smile

I think that I will use the builder on the project in my case. I suppose that the builder will incrementally modify the index on file save? Am I right? or is it also register on-the-fly modification (that are not already saved)?

On other hands, do you have some benchmarks? In order to have an idea of the gain than browsing "manually" the model. Also an idea of the time spent for indexing files? Do I need to reindex them at startup?

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: [EMF Query2]first steps with EMF query2 [message #651580 is a reply to message #651523] Mon, 31 January 2011 17:43 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Aurelien,

Thanks for your comments Razz
Please find answers to your questions below.

Quote:

You recommend m eto use a nightly build? Is there a stable release? At least, when is planned the stable release? for Indigo?


We dont have a release yet, but we are planning to have a parallel release and in the M1 of the next mainstream eclipse release.

Quote:

I think that I will use the builder on the project in my case. I suppose that the builder will incrementally modify the index on file save? Am I right? or is it also register on-the-fly modification (that are not already saved)?



Yes you are right.The builder will modify the index on file save, not on the on-the-fly modification.

Quote:

On other hands, do you have some benchmarks? In order to have an idea of the gain than browsing "manually" the model.



We dont have the benchamark reports yet.But we have done some internally and are planning to publish the same very soon.

Quote:

Also an idea of the time spent for indexing files? Do I need to reindex them at startup?


It will depend on how you load your resources.Generally the indexing engine is pretty fast.

For our Testing UI(Builder scenario) we store our indexes at the plug-in's metadata location, but it can be configured.Once the index is created it is not rebuilt on startup, only gets modified if you change something in the IDE session.

If the index is not built, then on the startup the indexes will be built.

I hope this helps.
Please let us know if you are stuck somewhere. Razz

cheers,
Saurav







[Updated on: Mon, 31 January 2011 17:44]

Report message to a moderator

Re: [EMF Query2]first steps with EMF query2 [message #651655 is a reply to message #651523] Tue, 01 February 2011 06:39 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
i forgot to mention one thing in the context of dirty resources.

Query2 also takes care of the dirty resources scenario i.e it provides the facility to calculate the results with combination of persistent and dirty resources.

So yours on the fly modifications can be also seen if you run the query on the dirty state.

cheers,
Saurav


Re: [EMF Query2]first steps with EMF query2 [message #651726 is a reply to message #651523] Tue, 01 February 2011 12:55 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 636
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi Saurav,

thanks for your answers.

I'm trying to make my first query correctly. I would like to have all element of that inherits of Type A inside an element.
I don't see how to query with abstract class.
To search into an element, I suppose that I need to use the scope variable that is in one of the example but what is its type? and what about isInclusiveScope?

Let's talk a look at my request:
final EObjectQuery<EObjectDescriptor> eObjectQuery = IndexQueryFactory.createEObjectQuery();
		eObjectQuery.eClassURI(EcoreUtil.getURI(XXXPackage.Literals.YYY));                   <<< here it seems that I can put only the concrete class
		final List<URI> result = new ArrayList<URI>();	
		IndexFactory.getInstance().executeQueryCommand(new QueryCommand() {

			public void execute(QueryExecutor queryExecutor) {
				QueryResult<EObjectDescriptor> execute = queryExecutor.execute(eObjectQuery);
				for (EObjectDescriptor objDesc : execute) {
					URI candidateResourceUri = objDesc.getResourceURI();
					
					//boolean isInScope = scope.contains(candidateResourceUri);          <<<< What is the typeof scope?
//					if (isInclusiveScope == isInScope) {                                                          <<<< What is isInclusiveScope?,
						// add uri of instance to result
						result.add(candidateResourceUri.appendFragment(objDesc.getFragment()));
//					}
				}
			}
		});
		return result;


some other questions:
Whaty is the recommended query language to use?
Are they sensible difference of performance between them?


BTW, I updated the wiki for the ID of natures and builder. I think that an update for the exampe to get EObject of a certain type might be updated too , as soon as I will know how to use result correctly.

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team

[Updated on: Tue, 01 February 2011 12:59]

Report message to a moderator

Re: [EMF Query2]first steps with EMF query2 [message #651739 is a reply to message #651580] Tue, 01 February 2011 12:38 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi Saurav,

just out of curiosity. Have you guys tested the indexer with Resources
stored in a CDO Repository?

I wonder if how such indexer would work if there is a Resource that can
be modified remotely. I guess in that case, that indexer / builder
should be at server side, instead. Queries could be also, ideally, be
executed at server side to avoid latency-wise expensive roundtripping.

The good thing about CDO is that a Resource doesn't need to be fully
loaded to access any of its children EObjects, which seems to be the
optimization premise of the indexer.

My main concern is scalability. I actually integrated EMF Query v1 with
our own document generation engine, and it ends up traversing the whole
model. I think CDO could benefit from such indexer, but first is should
be analyzed whether the concepts are compatible in a distributed
environment.

So, any plans/ideas of integration? Do you foresee the indexer would
improve the query performance in such scenario?

Cheers!

saurav escribió:
> Hi Aurelien,
>
> Thanks for your comments :p
> Quote:
>> You recommend m eto use a nightly build? Is there a stable release? At
>> least, when is planned the stable release? for Indigo?
>
> We dont have a release yet, but we are planning to have a parallel
> release and in the M1 of the next mainstream eclipse release.
>
> Quote:
>> I think that I will use the builder on the project in my case. I
>> suppose that the builder will incrementally modify the index on file
>> save? Am I right? or is it also register on-the-fly modification (that
>> are not already saved)?
>
>
> Yes you are right.The builder will modify the index on file save, not on
> the on-the-fly modification.
>
> Quote:
>> On other hands, do you have some benchmarks? In order to have an idea
>> of the gain than browsing "manually" the model.
>
>
> We dont have the benchamark reports yet.But we have done some internally
> and are planning to publish the same very soon.
>
> Quote:
>> Also an idea of the time spent for indexing files? Do I need to
>> reindex them at startup?
>
>
> It will depend on how you load your resources.Generally the indexing
> engine is pretty fast.
>
> For our Testing UI(Builder scenario) we store our indexes at the
> plug-in's metadata location, but it can be configured.Once the index is
> created it is not rebuilt on startup, only gets modified if you change
> something in the IDE session.
>
> If the index is not built, then on the startup the indexes will be build.
>
> I hope this helps.
> Please let us know if you are stuck somewhere. :p
> cheers,
> Saurav
>
>
>
>
>
>
Re: [EMF Query2]first steps with EMF query2 [message #651775 is a reply to message #651726] Tue, 01 February 2011 14:57 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Aurelien,

Please find answers to your questions below.

Aurelien Pupier wrote on Tue, 01 February 2011 07:55
Hi Saurav,

thanks for your answers.

I'm trying to make my first query correctly. I would like to have all element of that inherits of Type A inside an element.
I don't see how to query with abstract class.



You can mention your query by passing the abstract type.But in your case it will not return results since you are invoking the EObjectQuery directly.

If you want to use Query2 core instead of the direct index based queries i would suggest to go for a query language.
In a query language you can specify your queries with abstract types like this

SelectType: from AbstractType as AT select AT

Where AbstractType is your Abstract class.The Query engine in turn will look into all the concrete class instances and return the result for you.

Quote:

To search into an element, I suppose that I need to use the scope variable that is in one of the example but what is its type? and what about isInclusiveScope?

Let's talk a look at my request:
final EObjectQuery<EObjectDescriptor> eObjectQuery = IndexQueryFactory.createEObjectQuery();
		eObjectQuery.eClassURI(EcoreUtil.getURI(XXXPackage.Literals.YYY));                   <<< here it seems that I can put only the concrete class
		final List<URI> result = new ArrayList<URI>();	
		IndexFactory.getInstance().executeQueryCommand(new QueryCommand() {

			public void execute(QueryExecutor queryExecutor) {
				QueryResult<EObjectDescriptor> execute = queryExecutor.execute(eObjectQuery);
				for (EObjectDescriptor objDesc : execute) {
					URI candidateResourceUri = objDesc.getResourceURI();
					
					//boolean isInScope = scope.contains(candidateResourceUri);          <<<< What is the typeof scope?
//					if (isInclusiveScope == isInScope) {                                                          <<<< What is isInclusiveScope?,
						// add uri of instance to result
						result.add(candidateResourceUri.appendFragment(objDesc.getFragment()));
//					}
				}
			}
		});
		return result;





Generally there are two scopes one is the global scope which is actually the scope mentioned in the Query execution and the other is when user specify the inclusive scope in the query itself like.

ManuscriptsInBerlinOrHamburg2: 
	from 
		Library as lib
			in resources {"platform:/resource/org.eclipse.emf.query2.librarytest/data/library/Hamburg.xmi",
				"platform:/resource/org.eclipse.emf.query2.librarytest/data/library/Berlin.xmi"},
		Book as b, 
		Manuscript as m 
	select m 
	where lib.books = b
		and b.instanceOf = m


So the scope object is the scope calculated internally intersecting both the scopes.


Quote:

some other questions:
Whaty is the recommended query language to use?
Are they sensible difference of performance between them?



We prefer the XText based Query language to be used.
For that you get the Query UI which can be used to test your queries and check the model data quickly.Performance wise we dont see any difference.

Quote:

BTW, I updated the wiki for the ID of natures and builder. I think that an update for the exampe to get EObject of a certain type might be updated too , as soon as I will know how to use result correctly.
Regards,



Many thanks for updating for the wiki.
We hugely appreicate that.
Request you to open bugzilla for any kind of bugs, enhance ment or documenation request.

cheers,
Saurav


[Updated on: Tue, 01 February 2011 14:57]

Report message to a moderator

Re: [EMF Query2]first steps with EMF query2 [message #651792 is a reply to message #651739] Tue, 01 February 2011 15:55 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Victor,

Thanks for the comments/idea.
Please find the answers/comments below.

Victor Roldan Betancort wrote on Tue, 01 February 2011 07:38
Hi Saurav,

just out of curiosity. Have you guys tested the indexer with Resources
stored in a CDO Repository?

I wonder if how such indexer would work if there is a Resource that can
be modified remotely. I guess in that case, that indexer / builder
should be at server side, instead. Queries could be also, ideally, be
executed at server side to avoid latency-wise expensive roundtripping.




Actually we had looked at this possibility.We tried of having Query2 as a common query language for CDO alongwith OCL.
I created a prototype for execution of Query2 in the MEMStore
More details and the prototypical code can be found here.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=329723

Quote:

The good thing about CDO is that a Resource doesn't need to be fully
loaded to access any of its children EObjects, which seems to be the
optimization premise of the indexer.

My main concern is scalability. I actually integrated EMF Query v1 with
our own document generation engine, and it ends up traversing the whole
model. I think CDO could benefit from such indexer, but first is should
be analyzed whether the concepts are compatible in a distributed
environment.

So, any plans/ideas of integration? Do you foresee the indexer would
improve the query performance in such scenario?

Cheers!



I also strongly feel the query performance will improve in this scenario.We have plans for this integration.Do you wish to use Query2 for your engine ?We can probably work together to drive this forward.

Any further ideas/comments on this topic would be welcome.

cheers,
Saurav





Re: [EMF Query2]first steps with EMF query2 [message #651812 is a reply to message #651523] Tue, 01 February 2011 17:12 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 636
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

I'm trying to use Xtext for the queries.

but when I try to write the .query file, it cannot resolve my import and I don't know to specif where are my ecore files.

I'm trying this:
import "http://www.bonitasoft.org/ns/studio/process"

nameOfMyFirstquery:
from XXX as xxx select xxx


XXX is underscored telling me that "couldn't resolve reference for Eclass XXX"

This Eclass is well defined in the package Ns URI http://www.bonitasoft.org/ns/studio/process of my ecore file.

Where do I need to specify how to resolve it correctly?

I added the Xtend Nature to the project containing the query file. I try to put inside the same project as the ecore file.


Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: [EMF Query2]first steps with EMF query2 [message #651816 is a reply to message #651523] Tue, 01 February 2011 17:30 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 636
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

ok, I finally managed to do it using:

import 'platform:/resource/org.bonitasoft.studio-models/process.ecore'
import 'platform:/resource/org.bonitasoft.studio-models/form.ecore'

searchAllProcess:
from Pool as pool select pool



But I need to be in the sam eplugin where the ecore files are defined.

And in Xtext documentation( http://www.eclipse.org/Xtext/documentation/latest/xtext.html #syntax) there are a words about need to use:
fragment = org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment {
  genModels =
    "platform:/resource/my.project/src/my/pack/SecretCompartments.genmodel"
}


For now I don't understand where it should be.


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: [EMF Query2]first steps with EMF query2 [message #651823 is a reply to message #651812] Tue, 01 February 2011 17:42 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Aurelien,

Answers below

Aurelien Pupier wrote on Tue, 01 February 2011 12:12
I'm trying to use Xtext for the queries.

but when I try to write the .query file, it cannot resolve my import and I don't know to specif where are my ecore files.

I'm trying this:
import "http://www.bonitasoft.org/ns/studio/process"

nameOfMyFirstquery:
from XXX as xxx select xxx


XXX is underscored telling me that "couldn't resolve reference for Eclass XXX"

This Eclass is well defined in the package Ns URI http://www.bonitasoft.org/ns/studio/process of my ecore file.

Where do I need to specify how to resolve it correctly?



You need to have the model plug-in in your target platform.The plug-in must have the model classes.

Quote:

I added the Xtend Nature to the project containing the query file. I try to put inside the same project as the ecore file.

Regards,


So the below configuration should work.

(a) Model plug-in the target platform.
(b) Your data plug-in alongwith the .query file in the workspace.Your data plug-in must have the Query Index nature associated with it.
If you have the Query plug-ins installed.
You must get a 'Add/Remove Query Index nature' context menu action on the plug-in.Clicking on it will add the Index nature to the project if not already added.Which will associate the QueryIndexBuilder to the project.

cheers,
Saurav


Re: [EMF Query2]first steps with EMF query2 [message #652258 is a reply to message #651792] Thu, 03 February 2011 11:32 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi saurav,

sorry for the delayed answer, yesterday was day-off in Tenerife ;)

comments below:

saurav escribió:
> Hi Victor,
>
> Thanks for the comments/idea.
> Please find the answers/comments below.
>
> Victor Roldan Betancort wrote on Tue, 01 February 2011 07:38
>> Hi Saurav,
>>
>> just out of curiosity. Have you guys tested the indexer with Resources
>> stored in a CDO Repository?
>>
>> I wonder if how such indexer would work if there is a Resource that
>> can be modified remotely. I guess in that case, that indexer / builder
>> should be at server side, instead. Queries could be also, ideally, be
>> executed at server side to avoid latency-wise expensive roundtripping.
>
>
> Actually we had looked at this possibility.We tried of having Query2 as
> a common query language for CDO alongwith OCL.
> I created a prototype for execution of Query2 in the MEMStore More
> details and the prototypical code can be found here.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329723

As soon as I finish with some pending bugs, I'll look at your
contribution and perform some experiments :)

> Quote:
>> The good thing about CDO is that a Resource doesn't need to be fully
>> loaded to access any of its children EObjects, which seems to be the
>> optimization premise of the indexer.
>>
>> My main concern is scalability. I actually integrated EMF Query v1
>> with our own document generation engine, and it ends up traversing the
>> whole model. I think CDO could benefit from such indexer, but first is
>> should be analyzed whether the concepts are compatible in a
>> distributed environment.
>>
>> So, any plans/ideas of integration? Do you foresee the indexer would
>> improve the query performance in such scenario?
>>
>> Cheers!
>
>
> I also strongly feel the query performance will improve in this
> scenario.We have plans for this integration.Do you wish to use Query2
> for your engine ?We can probably work together to drive this forward.
>
> Any further ideas/comments on this topic would be welcome.

Sure, I think is a key feature for CDO. OCL is not exactly scalable at
server side...

Hope to come back to you with nice findings when ready ;)

Cheers!
Re: [EMF Query2]first steps with EMF query2 [message #652269 is a reply to message #651523] Thu, 03 February 2011 12:11 Go to previous message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Victor,

Thanks for the comments.

We are also eager to integrate Query2 in CDO.Your CDO expertise would be very helpful and needed.

Let us know if you need any kind of help from our side.

Best Regards,
Saurav


Previous Topic:Generated collection access
Next Topic:[EMF Query 2]Issue to query in Xtext and Object format
Goto Forum:
  


Current Time: Sat Oct 19 05:20:06 GMT 2019

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

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

Back to the top