Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-08-2020 01:56 PM
Hi,
Today I faced a strange problem.
At Neo4j Desktop browser I ran below code expecting that code will initialize two parameter variables. But it threw error to me
:param x => "value 1";
//
//
//
:param y => "value 2";
Error
:param x => "value 1"
// // // :param y => "value 2"
Neo.ClientError.Statement.SyntaxError: Invalid input ':': expected (line 4, column 1 (offset: 9))
":param y => "value 2""
^
Then I tried to run comment section of differently
1 :param x => "value 1";
//a
//b
//c
:param y => "value 2";
Output
05-08-2020 05:26 PM
Note that :param
(and anything starting with a :
) isn't actually Cypher, but instead will be interpreted as a command for the application (in this case, the Neo4j Browser).
As such, don't expect the browser commands to interpret comments the way Cypher does, since they will never be interpreted by the Cypher engine.
In most cases, since commands are usually short, there shouldn't be many cases where you would need to have comments.
05-08-2020 09:25 PM
Hi Andrew,
This is not about :. this problem is posted by Roy too Syntax error around Cypher comments.
Somehow for me it is only reproducible with param.
In any language if some symbol is used as comment then ideally engine should skip those line as Cypher also did in the browser at several instances.
I have not tried the same to reproduce the issue out of browser, however I am still feel that throwing an error is issue irrespective or cypher/browser.
I am not sure looks like by mistake I marked it as Solution.
05-09-2020 01:03 AM
You likely would not be able to reproduce this out of the browser with :param
, excepting cypher-shell, as it would error out as invalid syntax. As mentioned, the :
commands, including :param
are not cypher. They are not interpreted as Cypher, nor executed as Cypher. They are intercepted and interpreted by the application (the Neo4j Browser or Cypher-shell) and cannot be otherwise used by the Neo4j drivers, because these commands are not Cypher, so the Neo4j server itself doesn't know what to do with it.
That said, it does make sense to have the browser recognize comment characters when it interprets commands, and even between statements and/or commands when the multi-statement query editor is being used. I'll see if I can add that as a backlog item for the browser.
05-09-2020 01:24 AM
I do not know how to execute multiple statements in one shot using Cypher shell. However I completely rely on you that this is Neo4j browser issue, which needs to be fixed.
Reasons
05-09-2020 03:20 PM
Please check if you have multiple statement query editor is enabled in your neo4j browser settings.
I can do this without any error in browser.
:param x => "value 1";
:param y => "value 2";
05-11-2020 01:23 AM
I already have enabled multiple statement query editor. That is working good. This problem comes with some combination of comments symbol
05-11-2020 08:16 AM
You are correct about comments. It seems the comments and the multi-statement are not compatible in browser.
You can use the comments with cyphershell without any issues.
All the sessions of the conference are now available online