addV

How to specify a vertex.

Synopsis

g.addV('vertexLabel').
  property ('property_key', property_value) ...

Description

Vertex data is inserted using addV, a TinkerPop step. A previously created vertex label is required along with the properties that define the partition key. Additional properties can be inserted with the required properties.

Property keys and value types must be defined in the schema for vertex labels. Using property, a valid data type value must be inserted. Some data types require special handling in entering the property value:
  • Date and Time: Strings with quotes and either as LocalDate or as LocalTime, respectively.
  • All collections (Set, List, Map): Square brackets around quoted entries, followed by as Set for sets and as Map for maps. Lists only require square brackets.
  • Tuple: Square brackets around quoted entries, as Tuple after the tuple, enclosed in a second set of square brackets.
  • Geospatial properties will require as Point, as LineString, or as Polygon.
  • UUID: String with quotes and as UUID.

Examples

Create a vertex with a vertex label person with the partition key person_id and properties name, gender, nickname, and country:
g.addV('person').
   property('person_id', 'adb8744c-d015-4d78-918a-d7f062c59e8f' as UUID).
   property('name', 'Simone BECK').
   property('gender','F').
   property('nickname', ['Simca', 'Simone'] as Set).
   property('country', [['France', '1904-07-07' as LocalDate, '1991-12-20' as LocalDate] as Tuple])
Carefully study the use of special formatting for items like UUID, where as UUID must be included to convert the string to a UUID on insertion.