Question

I am new to neo4j, so my question may sound stupid to you but anyway.

I have OSM data set imported to neo4j graph db. So curretnly I am trying to query different stuff from db, like:

MATCH (a) WHERE has(a.addr:street) RETURN a.addr:street

and it fails with an sysntax error:

Type mismatch: expected Node but was Boolean, Number, String or Collection<Any> (line 1, column 23)
"MATCH (a) WHERE has(a.addr:street) RETURN a.addr:street"
                       ^

Which is strange, as the nodes has a lot of properties with colons(:).

Does anybody know how can I query such properties?

Was it helpful?

Solution

Welcome to Neo4j! Characters like : or whitespace can introduce ambiguity in a query since they may be significant in the query language, which gives the parser hick ups. You can still use these characters by enclosing the expression in "backticks", i.e.

MATCH (a) WHERE has(a.`addr:street`) RETURN a.`addr:street`

You can see some other examples here.

OTHER TIPS

There are three parts of a cypher query:

START,MATCH AND RETURN. So your query here will be ::

START a=node(1)
MATCH (a)-[:HAS]->(addr)-[:HAS]->(street)
RETURN street
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top