neo4j/cypher-plugin — Issue #4: Proposed Rest Cypher Table Results
Author: Romiko
Created: 2012-01-21 02:48:08+00:00
State: open

Hi,

The current Rest API puts multiple data types in one array, this is not deserailization friendly. What I propose is a new data structure for Cypher Table Results. Below is the new Data Structure proposal, I have also fully tested this with deserialization and generics and works like a dream, test code is also included at the GIST links.

Deserialization friendly JSON Cypher Result:
https://gist.github.com/1650945

Test Code:
https://gist.github.com/1650923

Notice the elegance of deserialization of any data in the table and even payload with this line of code.
//Act
var cypherResult = graphClient
.ExecuteGetCypherResults, RelationshipApiResponse, string>>(
new CypherQuery(graphClient, cypherExpectedQuery, parameters,null)
);

Here I am calling to produce a CypherTableResponse with 3 columns of:
NodeApiResponse (Node with payload of datatype foo
RelationshipApiResponse (Relationship with payload of dataype foo)
string

This new way of producing means faster deserialization without any hacks to try figure out multiple data types in one array, instead we have an array of DATAROWS.

See below for the code structure of the CypherTableResult
https://gist.github.com/1650935