简体   繁体   中英

A very basic Neo4J Cypher not working

In regards to Neo4j, I'm noob. I've been attempting to learn Cypher by using the console in the website admin. But there seems to be quirks that I'm not aware off or there is a configuration setting that is incorrect.

For example: at the following URL, a very simple Cypher is provided (see code below) http://docs.neo4j.org/chunked/1.7.2/shell-commands.html#_query_with_cypher

When I execute the following Cypher on the console in the Neo4j admin website, I get an error:

start n = (0) return n
==> SyntaxException: expected either node or relationship here
==> "start m = (0) return m"

But if I execute the following Cypher. Notice that I added “node” prior to the “(0)”. Everything works fine:

start n = node(0) return  n
==> +-----------+
==> | n         |
==> +-----------+
==> | Node[0]{} |
==> +-----------+
==> 1 row, 0 ms

It seems that many examples I see do not include the word “node” in similar scenerios. Should this be expected or is there something I'm doing wrong?

I'm running Neo4j version 1.7.2 on windows server 2008.

Just use word node.

Here you can find a cheatsheet that might be helpful.

And here is another presentation that might be useful to learn/understand Cypher.

Based on Neo4J documentation there was change from version 1.4.2 to 1.5.3, I believe this keyword was once optional, but now required.

Neo4J Version 1.4.2 documentation http://docs.neo4j.org/chunked/1.4.2/query-start.html

start n=(1) return n

Neo4J Version 1.5.3 documentation http://docs.neo4j.org/chunked/1.5.3/query-start.html

START n=node(1) 
RETURN n

I can't be certain unless I load Neo4J version 1.4.2, but I believe "node" was probably optional in Neo4j Version 1.4.2. Now going forward from version 1.5.3, "node" seems to be required.

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