.

# Gremlin Query Basic Tutorials

Gremlin Query Language – Create Vertex/Node and Edge/Relationship Check If Vertex/Edge Exist – Gremlin Query – Titan Update Properties of Multiple Edges – Gremlin Query – Titan Update Properties of Multiple Vertices – Gremlin Query – Titan Create Vertex If Does Not Exist – Gremlin Query – Titan Query/Access Root Level Properties and Nested Properties… Read More »

.

# Check If Vertex/Edge Exist – Gremlin Query – Titan

Check If Vertex/Edge Exist – Gremlin Query Example 1: // Returns boolean value exist = g.V().hasLabel(‘TEST_LABEL’).has(‘property1′,’value1’).hasNext(); Example 2: // Returns boolean value exist = g.V().hasLabel(‘TEST_LABEL’).has(‘property1′,’value1’).bothE().hasNext(); Related Links:

.

# Update Properties of Multiple Edges – Gremlin Query – Titan

Update Properties of Multiple Edges e = g.V().hasLabel(‘TEST_LABEL’).has(‘property1′,’value1’).bothE(); e.property(‘property3′,’value3’).property(‘property4′,’value4’); Related Links:

.

# Update Properties of Multiple Vertices – Gremlin Query – Titan

Update Properties of Multiple Vertices v = g.V().hasLabel(‘TEST_LABEL’).has(‘property1′,’value1’).has(‘property2′,’value2’); v.property(‘property3′,’value3’).property(‘property4′,’value4’); Related Links:

.

# Create Vertex If Does Not Exist – Gremlin Query – Titan

Create Vertex If Does Not Exist Return a vertex with given label and property. If the vertex does not exist, a new vertex is created and returned to vertexObject. vertexObject = g.V().hasLabel(‘VERTEX_LABEL’).has(‘property’,’value’).tryNext().orElseGet{ graph.addVertex(label, ‘VERTEX_LABEL’, ‘property’, ‘value’); }; Related Links: