Forked from bassem-mf/GettingStartedTutorial1Commands.txt
Created
February 24, 2021 22:14
-
-
Save cvamsikrishna11/55da4c6ffd9ae806e79465b7f5f60223 to your computer and use it in GitHub Desktop.
Getting Started With Graph Databases, Apache TinkerPop, and Gremlin - Tutorial 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an instance of the "Modern" toy graph | |
graph = TinkerFactory.createModern() | |
// Create the traversal source | |
g = graph.traversal() | |
// Get all vertices | |
g.V() | |
// Get the vertex with the ID "1" | |
g.V(1) | |
// Get the value of the "name" property on the vertex with the ID "1" | |
g.V(1).values('name') | |
// Start from the vertex with ID "1" and get the outgoing edges labeled "knows" | |
g.V(1).outE('knows') | |
// Get the names of the people vertex "1" knows (long version) | |
g.V(1).outE('knows').inV().values('name') | |
// Get the names of the people vertex "1" knows (concise version) | |
g.V(1).out('knows').values('name') | |
// Get the names of the people vertex "1" knows who are over the age of 30 | |
g.V(1).out('knows').has('age', gt(30)).values('name') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment