Databases Reference
In-Depth Information
In Cypher, this can be expressed as:
(ian)-[:SENT]->(email)-[:TO]->(jim),
(email)-[:CC]->(alistair)
Reviewing
Figure 4-5
shows how the act of Alistair reviewing a film can be represented in the graph.
Figure 4-5. Alistair wrote a review of a film, which was published in a magazine
In Cypher:
(alistair)-[:WROTE]->(review)-[:OF]->(film),
(review)-[:PUBLISHED_IN]->(magazine)
Represent Complex Value Types as Nodes
Value types are things that do not have an identity, and whose equivalence is based solely
on their values. Examples include
money
,
address
, and
SKU
. Complex value types are
value types with more than one field or property.
Address
, for example, is a complex
value type. Such multiproperty value types are best represented as separate nodes:
START
ord=
node
:orders(orderid=
{orderId}
)
MATCH
(ord)-[:DELIVERY_ADDRESS]->(address)
RETURN
address.first_line, address.zipcode