简体   繁体   中英

How to enter a neo4j Cypher query using Bulbs?

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM