bjorngranvik / reudd

REgarding User Driven Development - a user centric "data in/report out" web site using Neo4j.
Apache License 2.0
1 stars 0 forks source link

Cypher support in reports #8

Open bjorngranvik opened 10 years ago

matsjonas commented 10 years ago

The groovy shell binding (used when generating the reports) is now populated with an ExecutionEngine to handle cypher and can thereby contain code like this:

import org.neo4j.cypher.javacompat.ExecutionResult;
ExecutionResult result = engine.execute("start n=node(*) where n.name = 'my node' return n, n.name");
...

This at least makes it possible for the programmer to use cypher in the reports, but it is in no way easy or user friendly. For the report to render successfully the result variable still needs to be transformed programmatically to the expected "list of rows with lists of cells" (List<List>) that the report rendering template expects.

I am unsure of whether to close the issue or not. The reports now have cypher support, but I am not content with the usability. Perhaps close this issue and create a new one for the 1.0 milestone to handle usability?

bjorngranvik commented 10 years ago

Does this mean that it's possible to execute a whole Cypher-statement if the result is produced correctly? I couldn't really test this easily since I hit a known bug in Cypher 1.9 where querying for a non-existing attribute produces an error.

Also, we need to be able to run in server mode. Have you tested that using neo4j 1.9.x? I have problems with the libs in the 2.0.0-M06.

matsjonas commented 10 years ago

Yes. Any Cypher-statement should be possible to execute and displayed correctly if the result is transformed into the correct format.

I tested with the configured setup of using neo4j 1.9.2. I didn't do anything special to start up the database. Have you altered your local conf in order to use neo in server mode? How?

bjorngranvik commented 10 years ago

Download Neo4j community. Start using "bin/neo4j start". Test by surfing into http://localhost:7474. Change to type="rest" in DataSource.groovy. Start reudd.

matsjonas commented 10 years ago

Works with embedded. Having trouble getting it to work using a neo4j server. Perhaps we should upgrade to neo4j 2.0 before spending too much time making it work with 1.9.X?

matsjonas commented 10 years ago

I found out why it didn't work when running neo4j in server mode. Cypher statements are executed in different ways depending if the current GraphDatabaseService is an * EmbeddedGraphDatabase* or a RestGraphDatabase.

Do you know anything about this @bjorngranvik? Is there no common interface that we can use to execute cypher statements without having to care for where the database resides?

matsjonas commented 10 years ago

FYI: When using an embedded database we use ExecutionEngine to execute cypher queries. When using the server version we need to use RestCypherQueryEngine.