Database Reference
In-Depth Information
5.
Let's create vertices for user and tweet:
gremlin> vivs = graph.addVertex(null)
==>v[4]
gremlin> vivs.setProperty("fname", "vivek")
==>null
gremlin> vivs.setProperty("lname", "mishra")
==>null
gremlin> vivs.setProperty("twitter_tag",
"mevivs")
==>null
gremlin> graph.V("fname","vivek")
==>v[4]
gremlin> tweet = graph.addVertex(null)
==>v[8]
6.
Next, add an edge between these two vertices:
gremlin> graph.addEdge(null, vivs, tweet,
"has_tweeted")
==>e[2V-4-1E][4-has_tweeted->8]
7.
Let's add apress_team as a user and establish and define “vivek
follows apress_team” relationship edge:
gremlin> apress = graph.addVertex(null)
==>v[12]
gremlin> apress.setProperty("fname", "apress")
==>null
gremlin> apress.setProperty("twitter_tag",
"apress_team")
==>null
gremlin> graph.addEdge(null, vivs, apress,
"following")
==>e[3r-4-22][4-following->12]
8.
We can find a vertex by its key as follows:
Search WWH ::




Custom Search