Cypher Help

33 views
Skip to first unread message

Chris

unread,
Jul 17, 2012, 5:51:46 PM7/17/12
to neo...@googlegroups.com
I've been tinkering around with Cypher for the past couple days trying to get a search box to search multiple terms in a Cypher query and have pieced together this...

x = Neo4j._query('START n=node(7) MATCH (n)-[:`_all`]->(default_ret) WHERE default_ret.first_and_last =~ /(?i-mx:A.*)/ OR default_ret.first_and_last =~ /(?i-mx:B.*)/ RETURN default_ret')

I'm about to start refactoring it for simplicity and had two questions 

1) node(7) ... can someone explain this? I'm new to Neo4j and Cypher and am still wrapping my head around some of the concepts but when I replace node(7) with node(1) it breaks.
2) default_ret. What is this? Can I replace it with something that makes the code clearer?

Thank you for your help.

Chris 

Peter Neubauer

unread,
Jul 17, 2012, 11:33:10 PM7/17/12
to neo...@googlegroups.com

Chris,
Node(1) just grabs the node in the database with id =1. You give it an identifier to address later in the query- n.

Same for the second one. default_ret is an identifier that you give the matching node in the MATCH clause and later address if in the return clause.

See http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html for details.

/peter

Send from mobile.

--
You received this message because you are subscribed to the Google Groups "neo4jrb" group.
To view this discussion on the web visit https://groups.google.com/d/msg/neo4jrb/-/j_ZnPDRg1SwJ.
To post to this group, send email to neo...@googlegroups.com.
To unsubscribe from this group, send email to neo4jrb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/neo4jrb?hl=en.

Chris

unread,
Jul 18, 2012, 11:12:38 AM7/18/12
to neo...@googlegroups.com
Peter,

If I'm searching across all nodes without consideration of their relationship to one another how would I complete "node(7)"?

Thank you for your response. I appreciate your help.

Chris 

Michael Hunger

unread,
Jul 18, 2012, 7:40:51 AM7/18/12
to neo...@googlegroups.com
And the cypher cheat sheet at: http://neo4j.org/resources/cypher
Reply all
Reply to author
Forward
0 new messages