property
How to specify a property from a traversal.
Synopsis
g.addV('vertexLabel')
.[ property ('property_key') ... ]
Syntax conventions | Description |
---|---|
Lowercase and uppercase | Literal keyword. Includes () . |
Italics |
Variable value. Replace with a user-defined value. |
[] |
Optional. Square brackets ( [] ) surround
optional command arguments. Do not type the square brackets. |
{} |
Group. Braces ( {} ) identify a group to choose
from. Do not type the braces. |
| |
Or. A vertical bar ( | ) separates alternative
elements. Type any one of the elements. Do not type the vertical
bar. |
... |
Repeatable. An ellipsis ( ... ) indicates that
you can repeat the syntax element as often as required. |
Description
The property()
step is a sideEffect. When a vertex is added from a traversal g using
addV
, properties can be added with property()
. For a
previously created vertex, properties can be added. A previously created vertex label must be specified. Property key-value pairs are
specified.
Examples
Create a vertex with a vertex label
person
with the properties
personId
with value 17
and name
with value
Jamie
Oliver
:g.addV('person'). property('personId', 17). property('name','Jamie Oliver').next()
Add the properties
gender
with value M
and nickname
with
value jimmy
to a person
vertex previously
created:g.V().has('person', 'name', 'Jamie Oliver'). property('gender', 'M'). property('nickname', 'jimmy')
Add the property
withSuppliedId
with value
341f9950-997c-11e7-9579-7f50358d3f8d
to a person
vertex:// user-supplied property ID g.addV('person'). property('withSuppliedId', 'propValue', T.id, UUID.fromString('341f9950-997c-11e7-9579-7f50358d3f8d'))