addEdge
How to specify an edge.
Synopsis
vertex1.addEdge('edgeLabel', vertex2, [T.id, 'edge_id'], ['key', 'value'] [,...])
Description
Edge data is inserted using addEdge
. A previously created edge label must be specified. An edge_id may be specified, to
upsert data for a multiple cardinality edge to prevent creation of a new edge. Property
key-value pairs may be optionally specified.
Examples
Create an edge with an edge label
rated
between the vertices johnDoe and beefBourguignon with the
properties
timestamp
, stars
, and
comment
.johnDoe.addEdge('rated', beefBourguignon, 'timestamp', '2014-01-01T00:00:00.00Z', 'stars', 5, 'comment', 'Pretty tasty!')
Update an edge with an edge label
created
between the vertices juliaChild and beefBourguignon, specifying the
edge with an edge id of 2c85fabd-7c49-4b28-91a7-ca72ae53fd39, and a property
createDate
of
2017-08-22:juliaChild.addEdge('created', 'beefBourguignon', T.id, java.util.UUID.fromString('2c85fabd-7c49-4b28-91a7-ca72ae53fd39'), 'createDate', '2017-08-22')
Note
that a conversion function must be used to convert a string to the UUID.
T.id
is a literal that must be included in the statement.