How to get the label of a relationship

cypher, neo4j

Solution

In Neo4j, relationships don't have labels - they have a single type, so it would be:

MATCH (a)-[r]->(b)
RETURN TYPE(r)

Problem

If I have the cypher query ``` MATCH (a)-[r]->(b) ``` I can get the labels of a and b fine line so ``` MATCH (a)-[r]->(b) RETURN labels(a), labels(b) ``` But when I want the label of `r` using the same syntax ``` MATCH (a)-[r]->(b) RETURN labels(r) ``` I get ``` Type mismatch: expected Node but was Relationship ``` How do I return the label of `r`, the relationship?

Original source