Gremlin Database Queries - ashishranjandev/developer-wiki GitHub Wiki

Adding Vertex

g.AddV('Task')
.Property('id', '67989b88-45cb-4e1c-abf1-46bba72f150e')
.Property('userId', '67989b88-45cb-4e1c-abf1-46bba72f150e')
.Property('retryCount', 0)
.Property('type', 'Leavers')
.Property('accessmanagement', 'TasksGroup')
.Property('priority', 'low')
.Property('batchId', 'c54d959f-0fe7-4805-95c2-ca9612588e87')
.Property('isDeprovisioning', false)
.Property('_classname', 'com.tesco.iam.managementservice.gremlin.entities.Task')

Querying Vertex

g.V()
.hasLabel('Account')
.has('accessmanagement', '0a2ba65a-c133-4a5e-b6c8-27eee50e3370')
.has('belongsTo', '224913aa-9833-422e-b3d1-29536c67f407')

Dropping Vertex

g.V()
.hasLabel('Account')
.has('accessmanagement', '0a2ba65a-c133-4a5e-b6c8-27eee50e3370')
.has('belongsTo', '224913aa-9833-422e-b3d1-29536c67f407').drop()

Adding a Property

g.V()
.hasLabel('Account')
.has('accessmanagement', '0a2ba65a-c133-4a5e-b6c8-27eee50e3370')
.Property('active', 'Yes')

Dropping a Property

g.V(#id).properties('prop').drop()

Group Count

g.V()
.has('prop1', 'e7743c77-3bc3-4695-a5b0-95e7b0bc162b')
.hasLabel('Student')
.groupCount()
.by('status')