Please enable JavaScript.
Coggle requires JavaScript to display documents.
Graph DB with Cosmos DB and Gremlin (Gremlin (Commands (g.V( ) (it gets…
Graph DB with Cosmos DB and Gremlin
Gremlin
Adding a vertex
:> g.addV('vertexName').property('property_1_name','property_1_value',..).property('property_2_name','property_2_value')
Showing a vertex value
:> g.V( ).values('property_name')
Commands
TinkerFactory.createModern()
it creates a graph, example: graph = TinkerFactory.createModern()
graph.traversal()
The TraversalSource provides additional information to Gremlin... g = graph.traversal()
g.V( )
it gets all graph vertexes
g.V(index)
g.V( ).values( )
it gets all values from all vertexes
g.V(index).values(valueName)
g.V(vertexName).addE(edgeLabel).to(g.V(vertexName))
it creates an edge between 2 vertexes
g.V(1).outE('knows')
it gets the edges with label knows
g.V(1).outE('knows').inV().values('name')
it gets the values in the property name from edges with label knows
g.V(1).out('knows').has('age', gt(30)).values('name')
it gets values in the property name from the vertexes where age is greater then 30..