I am currently working with Neo4j and using the Popoto.js library. However, I have come across an issue regarding the customization of node labels in the generated queries.
To provide some context, when Popoto.js generates a query for a node with a specific label, it includes the label as part of the node identifier, which can lead to queries that are not accepted by the Neo4j database. For example, the generated query looks like this:
MATCH (node::test:`Node::test`) RETURN node::test
As mentioned, this query format is not compatible with the Neo4j database. I am wondering if there is a solution or workaround to customize the query and achieve the desired result. Specifically, I would like to generate a query in the following format:
MATCH (n:`Node::test`) RETURN n
PS: i can’t remove the ‘::’ from nodes
This modified query format would allow me to work with the Neo4j database seamlessly.
I would greatly appreciate any guidance or insights you can provide regarding this issue. Thank you in advance for your assistance.
I tried to update popoto.start
function to generate a custom node label, but am still looking for a solution.
2
Answers
For the query to be "correct" you need to escape variables and labels that contain special characters:
Documentation: https://neo4j.com/developer/cypher/style-guide/#_backticks
I suggest you create a new issue in the popoto repo since this is most likely an easy fix there.
Here is a link to the popoto function that generates a node identifier based on the node label, which I copy here:
You can change the function to not use the node label (in your own fork of the linked repo).
For example, to generate the identifiers
n
,n1
,n2
, etc., you can replace this line:with this: