Property value expression¶
The property value expression references a property of a graph element or a field of a record.
Syntax¶
- property_value_expression
property_value_expression ::=
node_variable '.' property_name
| edge_variable '.' property_name
| record_value_expression '.' property_name
Parameters¶
node_variable¶
A variable value expression that evaluates to a reference of a node. For more information, see Variable value expression.
edge_variable¶
A variable value expression that evaluates to a reference of an edge. For more information, see Variable value expression.
record_value_expression¶
A value expression that evaluates to a record value. For more information, see Record type and Expressions.
property_name¶
The property name of a node or edge, or the field name of a record.
Examples¶
The following examples are based on the example dataset.
Retrieve the field of a record¶
LET r = RECORD {a:1, b:true, c:"str literal"} RETURN r.c
The preceding statement retrieves the field c of the record r.
Return:
+-------------+
| r.c |
+-------------+
| str literal |
+-------------+
Retrieve the properties of nodes and edges¶
USE movie MATCH (v@`User`)-[e:Watch]->() RETURN v.id, e.rate LIMIT 3
The preceding statement retrieves the property id of users and the property rate of edges with the label Watch.
Return:
+------+--------+
| v.id | e.rate |
+------+--------+
| 64 | 4.0 |
| 64 | 3.5 |
| 64 | 5.0 |
+------+--------+
Retrieve the field of a nested record¶
LET r = RECORD {a:1, b:true, c:RECORD {d:2, e:"str literal"}} RETURN r.c.e AS result
or
RETURN RECORD {a:1, b:true, c:RECORD {d:2, e:"str literal"}}.c.e AS result
Return:
+-------------+
| result |
+-------------+
| str literal |
+-------------+