I am trying to query for properties in Neo4j using the Cypher Query API. The query I am attempting is as follows:
String query = "start n=node(*) where (n.property-id = 'someid') return ID(n)"
I get an error when executing as follows:
Exception in thread "main" Unknown identifier id
.
So, this means that Neo4j is treating the dash in property-id as a keyword. How does one go about formulating queries with dashes in a node/relationship property?
Thank you.
The WITH clause allows query parts to be chained together, piping the results from one to be used as starting points or criteria in the next. It is important to note that WITH affects variables in scope.
The Neo4j Graph Data Science Library provides multiple operations to work with relationships and their properties stored in a projected graphs. Relationship properties are either added during the graph projection or when using the mutate mode of our graph algorithms.
Escape the property with backticks:
String query = "start n=node(*) where (n.`property-id` = 'someid') return ID(n)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With