gauravjhaindia / restfb

Automatically exported from code.google.com/p/restfb
0 stars 0 forks source link

Example Required for FqlMultiQuery regarding similar queries. #208

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I have seen the examples for FqlMultiQuery at restfb.com and 
https://code.google.com/p/restfb/issues/detail?id=8 and the examples involving 
separate queries. However, I can't seem to find an example on how to use 
FqlMultiQuery for similar queries. For instance, take a look at the queries i 
would like to execute.

SELECT uid, name FROM user WHERE uid=220439
SELECT uid, name FROM user WHERE uid=239203
SELECT uid, name FROM user WHERE uid=<<iterate_over_this>>

What I did was to try:

Map<String, String> queries = new HashMap<String, String>();
for(JsonObject uid : all_uids) {
    put("JsonObject", "SELECT uid, name FROM user WHERE uid="+uid);
}

Execute it using:

MultiqueryResults multiqueryResults =
  facebookClient.executeFqlMultiquery(queries, MultiqueryResults.class);

Here is MultiqueryResults Class:

public class MultiqueryResults {
  @Facebook
  JsonObject posts;
}

And I try to see the count for the number of objects:

System.out.println("#:" + multiqueryResults.posts.getData.size());

What is the expected output? What do you see instead?

I get no output.

What version of the product are you using? On what operating system?

I am using RestFB Version 1.6.12

Please provide any additional information below.

My code has been changed with an alternative solution but it takes around a 
minute to process hundreds of queries and my research on Google recommended 
that I use a Batch Query or something similar to reduce the time taken to 
retrieve all the data. As a result, the code I have shown above is reproduced 
from memory so pardon me if there are small mistakes. All I am asking is for an 
example on how to use FqlMultiQuery for similar queries.

Original issue reported on code.google.com by czh.gabr...@gmail.com on 7 Oct 2013 at 9:42