In the return part of your query, you define which parts of the pattern you are interested in. It can be nodes, relationships, or properties on these.
Graph
To return a node, list it in the return statemenet.
Query
START n=node(2) RETURN n
The node.
To return a relationship, just include it in the return list.
Query
START n=node(1) MATCH (n)-[r:KNOWS]->(c) RETURN r
The relationship.
To return a property, use the dot separator, like this:
Query
START n=node(1) RETURN n.name
The the value of the property name.
To introduce a placeholder that is made up of characters that are
outside of the english alphabet, you can use the `
to enclose the identifier, like this:
Query
START `This isn't a common identifier`=node(1) RETURN `This isn't a common identifier`.`<<!!__??>>`
The node indexed with name "A" is returned
If the name of the column should be different from the expression used, you can rename it by using AS <new name>.
Query
START a=node(1) RETURN a.age AS SomethingTotallyDifferent
Returns the age property of a node, but renames the column.
If a property might or might not be there, you can select it optionally by adding a questionmark to the identifier, like this:
Query
START n=node(1, 2) RETURN n.age?
The age when the node has that property, or null
if the property is not there.
Copyright © 2012 Neo Technology