How to specify an edge.


*vertex1*.addEdge('*edgeLabel*', *vertex2*, [, '*edge_id*'], ['*key*', '*value*'] [,...])


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.


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',, 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. is a literal that must be included in the statement.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000,