Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » (no subject)
(no subject) [message #687356] Wed, 01 June 2011 19:30
Eclipse UserFriend
Originally posted by: <forums-noreply

Hi (saurav),

i hope that fit :d. For other the last two post in following topic: http://www.eclipse.org/forums/index.php/t/209676/. So, now to the content:

a) So today i tried a little bit with the QueryContext:

private static QueryContext getQueryContext(final ResourceSet rs) {
return new QueryContext() {

public URI[] getResourceScope() {
final List<URI> result = new ArrayList<URI>();
index.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]);
}
public ResourceSet getResourceSet() {
return rs;
}
};
}


And changed to:

public QueryContext createQueryContext(final ResourceSet resourceSet, final URI... useURIs) {
return new QueryContext() {
@Override
public URI[] getResourceScope() {
URI[] result = new URI[useURIs.length];
for (int x = 0; x < useURIs.length; x++) {
result[x] = normalizer.normalize(useURIs[x]);
}
return result;
}
@Override
public ResourceSet getResourceSet() {
return resourceSet;
}
};
}

public QueryContext createQueryContextAll(final ResourceSet resourceSet) {
return new QueryContext() {
@Override
public URI[] getResourceScope() {
return indexedURIs.toArray(new URI[indexedURIs.size()]);
}
@Override
public ResourceSet getResourceSet() {
return resourceSet;
}
};
}


The first construct (mean: everything in index.executeQueryCommand(...)) is only to get ALL indexed resources, right? First i thought this way is every time necessary.

c) Ok, i get URIs and when i need/want the EObjects i have to loaded with the URIs. That is what you mean, i think, or?

I split the handling of things around Query 2 in two classes:
- IndexQuery2Manager
- QueryCommandsManager

Make things a bit more clear for me and it make fun to work with Query 2. Now i have to take a closer look to the SQL like language.

Greetings,
littleRathi
Previous Topic:(no subject)
Next Topic:(no subject)
Goto Forum:
  


Current Time: Tue Sep 24 10:51:59 GMT 2024

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

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

Back to the top