|
|
|
|
|
|
|
Re: [EMF Query 2]Issue to query in Xtext and Object format [message #652219 is a reply to message #652181] |
Thu, 03 February 2011 02:29   |
Eclipse User |
|
|
|
Hi Aurelien,
Answers below.
Aurelien Pupier wrote on Wed, 02 February 2011 16:53 | Thanks again and again for your answer.
I change import in the .query files and it works like a charm (use ns package uri instead of referencing .ecore)
Can you confirm:
- XText take more time to initialize than Object format
- Xtext is quicker than Object format
|
Definitely XText execution takes a longer time than the Object based format because extra transformation from XText strings to XText AST to Query AST is needed.
Whereas in case of Object based format it is not required.
Quote: |
The real advantage of EMF query comes when the EMF resource is not yet loaded, otherwise browsing model via EMF API is faster. or perhaps, it really depends on the query?
|
Yes , considering the resource navigation aspects the main advantage lies in scability of the model, where the resources are not needed to be loaded.
Query Test UI,SQL like string syntax,type safety of queries and dirty state awareness are the other key features if the whole package of Querying aspects are concerned.
Quote: |
EDIT: in fact, after more investigation, if I use a more "complex" query (get also two attributes of the queried elements), the EMF resource API is better. perhaps it is because I don't have enough data? i have only thousands.
|
Does that mean nested query or query with multiple joins ?
Quote: |
Another point:
To execute the query, we need to provide a QueryContext. What is the recommended and efficient way to calculate ResourceSet when I wanty to do a request on all the indexed files? Same for URI of ResourceScope?
Regards,
|
Most of the cases we have seen passing all the resource uris available in the index as the resource scope.
This can be achieved by firing a resource query over the index to get all the resource URIs.
following code does that
public URI[] getResourceScope() {
final List<URI> result = new ArrayList<URI>();
IndexFactory.getInstance().executeQueryCommand(new QueryCommand() {
public void execute(QueryExecutor queryExecutor) {
ResourceQuery<ResourceDescriptor> resourceQuery = IndexQueryFactory.createResourceQuery();
for (ResourceDescriptor desc : queryExecutor.execute(resourceQuery)) {
result.add(desc.getURI());
}
}
});
return result.toArray(new URI[0]);
}
Empty resource set can be passed if the querying scenario only concerns about the non-dirty resources.
In case of dirty scenarios, user may wish to load some modified resources in the resource set.
Please let us know if you need more clarification on this topic.
Cheers,
Saurav
[Updated on: Thu, 03 February 2011 02:30] by Moderator
|
|
|
Re: [EMF Query 2]Issue to query in Xtext and Object format [message #652225 is a reply to message #652219] |
Thu, 03 February 2011 03:43   |
Eclipse User |
|
|
|
Hi,
Thanks for your answer.
Comments below.
saurav wrote on Thu, 03 February 2011 08:29 | Hi Aurelien,
Quote: |
EDIT: in fact, after more investigation, if I use a more "complex" query (get also two attributes of the queried elements), the EMF resource API is better. perhaps it is because I don't have enough data? i have only thousands.
|
Does that mean nested query or query with multiple joins ?
|
I mean this kind:
searchAllProcesses:
from Pool as pool
select pool,pool.name,pool.version
saurav wrote on Thu, 03 February 2011 08:29 |
Quote: |
Another point:
To execute the query, we need to provide a QueryContext. What is the recommended and efficient way to calculate ResourceSet when I wanty to do a request on all the indexed files? Same for URI of ResourceScope?
|
Most of the cases we have seen passing all the resource uris available in the index as the resource scope.
This can be achieved by firing a resource query over the index to get all the resource URIs.
following code does that
public URI[] getResourceScope() {
final List<URI> result = new ArrayList<URI>();
IndexFactory.getInstance().executeQueryCommand(new QueryCommand() {
public void execute(QueryExecutor queryExecutor) {
ResourceQuery<ResourceDescriptor> resourceQuery = IndexQueryFactory.createResourceQuery();
for (ResourceDescriptor desc : queryExecutor.execute(resourceQuery)) {
result.add(desc.getURI());
}
}
});
return result.toArray(new URI[0]);
}
Empty resource set can be passed if the querying scenario only concerns about the non-dirty resources.
In case of dirty scenarios, user may wish to load some modified resources in the resource set.
|
Ok it is finally what I use by looking into some query tests.
Most of the time, when I make a research, the EMF resource is yet loaded.
I think that my main use case when it is not loaded, I will use the request that is upside in this post, get all Pool and take two of these attributes.
I need to determine from which amount of data I will gain time.
EDIT: it seems to be too much data than I have. Is there a way to configure indexation as I will have always the same types of query?
Regards,
[Updated on: Thu, 03 February 2011 05:09] by Moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.20689 seconds