edgeLabel

Synopsis

schema.edgeLabel('edgeLabel').
  [ single() | multiple() ].
  [ properties(property[, property]).[ add() | drop() ] ].
  [ connection( outVertex, inVertex) ].
  [ ttl ].
  [ ifNotExists() ].
  [ create() | add() | drop() | describe() | exists() ]

Description

An edge label specifies a type of edge that can be stored in DSE Graph. An edge label can have cardinality specified (default is multiple), properties that an edge has defined, the connections that are defined between two types of vertices, and a time-to-live (TTL) to determine the lifecycle of an edge. The order that the options are added to the schema statement matter: cardinality, properties associated with the edge label, then connection.

Examples

Create an edgeLabel created:

schema.edgeLabel('created').create()

Create an edgeLabel includedIn if the edge label doesn’t already exist:

schema.edgeLabel('includedIn').ifNotExists().create()

Create an edgeLabel with multiple cardinality:

schema.edgeLabel('rated').multiple().create()

Add properties to an edgeLabel:

schema.edgeLabel('rated').properties('rating','last_date').add()

Create an edgeLabel with both properties and a connection:

schema.edgeLabel('rated').multiple().ifNotExists().create()
schema.edgeLabel('rated').properties('rating','last_date').add()
schema.edgeLabel('rated').connection('recipe','reviewer').add()

Create a time-to-live (TTL) for an edgeLabel of 60 seconds. Setting a TTL will expire all edges inserted with the edgeLabel at the set TTL value.

schema.edgeLabel('createDate').ttl(60).create()

ref

DSE Graph sets TTL differently from the DSE database. The DSE database sets TTL per mutation (insertion or update) or can inherit a default value from the table schema. DSE Graph sets TTL per vertex label or edge label, and all vertices or edges will be affected by the TTL setting. DSE Graph cannot set TTL for an individual vertex or edge.

Check if an edgeLabel exists:

schema.edgeLabel('rated').exists()

Get the schema creation command for an edgeLabel using the describe() command:

schema.edgeLabel('createDate').describe()

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, info@datastax.com