8
votes

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.

1

1 Answers

17
votes

Escape the property with backticks:

String query = "start n=node(*) where (n.`property-id` = 'someid') return ID(n)"