Skip to content

Instantly share code, notes, and snippets.

@metasim
Last active January 25, 2016 16:27
Show Gist options
  • Save metasim/96bc824d4bf1b806ace2 to your computer and use it in GitHub Desktop.
Save metasim/96bc824d4bf1b806ace2 to your computer and use it in GitHub Desktop.
Example of using `union` combinator in gremlin-scala.
val g = TinkerFactory.createModern().asScala
val Age = Key[Vertex]("age")
val Lang = Key[Vertex]("lang")
val trav = g.V(4)
.union(
GremlinScala(__[Vertex]).in().value(Age),
GremlinScala(__[Vertex]).out().value(Lang)
).path()
trav.toList.mkString("\n")
// res35: String =
// [v[4], v[1], 29]
// [v[4], v[5], java]
// [v[4], v[3], java]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment