How to enter a neo4j Cypher query using Bulbs?

669 Views Asked by At

I know the greatest utility of Bulbs is that it lets you use an object graph mapper, but if I wanted to also include an already-written cypher query, how can I enter that directly through this API? Looking through the documentation of the project, I found this section:

http://bulbflow.com/docs/api/bulbs/neo4jserver/cypher/

...but the syntax of how to enter the query or what the return values were seemed a little unclear to me.

2

There are 2 best solutions below

1
On BEST ANSWER

Here's an example:

inrels = graph.cypher.query('START strt=node({mynode}) \
                            MATCH strt<-[r:follows]-neighbor \
                            WHERE neighbor.attr = {myattr} \
                            RETURN r', {'mynode': self.eid, 'myattr': someattr})

firstrel = inrel.next()

If you return a single column with nodes or rels, those would automatically be inflated to bulb objects. There used to be a graph.cypher.table() for generic return values in multi-column layout, based on your link I'm not sure this still exists.

0
On

The Cypher docs on bulbflow.com need to be updated.

See this answer for examples of how to execute all the different type of Cypher queries in Bulbs (including Cypher tables)...

How to execute Cypher Queries in Bulbs: https://stackoverflow.com/a/15358024/161085