We would like to write queries such as the following one, similar to the one we write for nodes but with square brackets, [], instead of brackets, ():
MATCH [r]
RETURN r
But this query results in an error. Relationships cannot be retrieved in the same way as nodes. If you want to see the relationship properties in a simple way, you can use either of the following syntaxes:
// no filtering
MATCH ()-[r]-()
RETURN r
// filtering on relationship type
MATCH ()-[r:REL_TYPE]-()
RETURN r
// filtering on relationship property and returning a subset of its properties
MATCH ()-[r]-()
WHERE r.property > 10
RETURN r.property
We will see how this works in detail in the Pattern matching and data retrieval section later on.