Perhaps it works if you create a "CypherResponse" object. Didn't try it
though:

class CypherResults {
   List<CypherResult> results;
}

class CypherResult {
   List<String> columns;
   List<Row> data;
}

class Row {
    List<Object> row;
}

Hmm but you don't get to the Person mapping. Perhaps it is easiest to
populate your Person objects manually from the Object[] in "row"

Or you use something like my cypher-rs on the server side to get sensibly
formatted Cypher Results: https://github.com/jexp/cypher-rs


On Thu, Jun 5, 2014 at 4:48 PM, Danny Alex Lachos Perez <
[email protected]> wrote:

> I have the following code (Using Eclipse with sample database Neo4j
> DataBase -"Movie") which returns the name and born of the actors of the
> film "The Matrix":
>
> String query = "match (a:Person)-->(m {title:'The Matrix'}) return 
> a.name,a.born;" final String txUri = SERVER_ROOT_URI + 
> "transaction/commit";WebResource resource = Client.create().resource( txUri 
> );String payload = "{\"statements\" : [ {\"statement\" : \"" +query + "\"} 
> ]}";ClientResponse response = resource
>         .accept( MediaType.APPLICATION_JSON )
>         .type( MediaType.APPLICATION_JSON )
>         .entity( payload )
>         .post( ClientResponse.class );
> System.out.println(response.getEntity( String.class ));
>
> The result is:
>
> {"results":[{"columns":["a.name","a.born"],"data":[{"row":["Keanu 
> Reeves",1964]},{"row":["Carrie-Anne Moss",1967]},{"row":["Laurence 
> Fishburne",1961]},{"row":["Hugo Weaving",1960]},{"row":["Andy 
> Wachowski",1967]},{"row":["Lana Wachowski",1965]},{"row":["Joel 
> Silver",1952]},{"row":["Emil Eifrem",1978]}]}],"errors":[]}
>
>
> But now i want to
>
> now I want to pass data to a list, for example:
>
> public class Person {
>     String name;
>     int born;}
>
>
> java.util.List<Person> lstPerson = new java.util.ArrayList<Person>();
>
>
> As I load the results of response.getEntity( String.class ) to my list or
> would be a better way of working using Eclipse?
>
> Thank you
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to