How to create a vertex label.


  [ partitionKey(propertyKey [, ... ]) ].
  [ clusteringKey(propertyKey[, ...]) ].
  [ ttl ].
  [ ifNotExists() ].
  [ index ].
  [ properties(property, ...).[ add() | drop() ]].
  [ cache().properties() | cache().bothE() ].
  [create() | drop() | describe() | exists() ]


A vertex label specifies a type of vertex that can be stored in DSE Graph. A vertex label can have properties defined, a partition key, clustering key, indexes, cache, and a time-to-live (TTL) to determine the life cycle of an vertex.
CAUTION: DSE Graph limits the number of vertex labels to 200 per graph.

Specify a vertex label partition key. The value consists of one or more previously created property keys, with multiple property keys forming a composite partition key. The partitionKey and clusteringKey are used to specify a user-defined vertex id, identifying the partition storage location and order within the partition, respectively.


Specify whether a vertex label can have any clustering keys. A clustering key can consist of one or more previously created property keys that specify how data will be stored within a partition.


Set a time-to-live for a vertex label.

Creating a vertex label can check for lack of current existence with ifNotExists() before creating a new vertex label.

Set an index for a vertex label.

Properties can be added to vertices and edges. A property key must be created prior to adding it to either type of element. Allowed characters for the name are alphabetical or underscore.


Create a vertexLabel meal_plan:
Create a vertexLabel ingredient if the vertex label doesn't already exist:
Add properties to a vertexLabel:
schema.vertexLabel('person').properties('nationality', 'age').add()

For indexes, see each index entry (edge index, property index, vertex index) in the Schema API.

Cache all properties for person vertices up to an hour (3600 seconds):
Enabling property cache causes index queries to use IndexCache for the specified vertex label.
Cache both incoming and outgoing made edges for person vertices up to a minute (60 seconds):
Create a time-to-live (TTL) for an vertexLabel of 60 seconds. Setting a TTL will expire all vertices inserted with the vertexLabel at the set TTL value:
Note: 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 a vertexLabel exists:
Get the schema creation command for a vertexLabel using the describe() command:
Remove a vertex label with the drop() command:
Remove a property nationality from a vertex label:
Create a vertex label using sensor_id as a partition key.
Create a vertex label with a partition key city_id and clustering key sensor_id.
Add a vertex using the schema from the last example:
graph.addVertex(label, 'fridge_sensor', 'city_id', 100, 'sensor_id', '60bcae02-f6e5-11e5-9ce9-5e5517507c66')
Create a vertex label using city_id and sensor_id as a composite partition key.
schema().vertexLabel('fridge_sensor').partitionKey('city_id', 'sensor_id').create()