Skip to content

Gremlin 0.7 Released

January 22, 2011

Gremlin is a domain specific language for traversing graphs. Gremlin 0.7 (Gremopoly) is a major improvement over Gremlin 0.6 and below. Gremlin 0.7 makes use of Groovy as its host language. Given that Groovy is a superset of Java, it is possible to seamlessly integrate with Blueprints, Pipes, and the standard Java JDK. There is no more awkward disjoint between Gremlin and the engine it is built upon — namely Java and TinkerPop.

Here is a collection of Gremlin 0.7 code snippets to provide a flavor of the language.

    • What are vertex 1′s friends’ names?
  • g.v(1).outE[[label:'friend']].inV.name
    
    • What are vertex 1′s friends’ friends’ names who are not vertex 1′s friends?
  • x = []
    g.v(1).outE[[label:'friend']].inV.aggregate(x)
       .outE[[label:'friend']].inV.except(x).name
    
    • What are the names of vertex 1′s friends who are friends with vertex 2?
  • g.v(1).outE[[label:'friend']].inV
       .outE[[label:'friend']].inV[[id:2]].back(4).name
    
    • How many steps away from vertex 1 is vertex 2 in the friendship subgraph?
  • s = 0; r = true; // s will be solution
    g.v(1).outE[[label:'friend']].inV.loop(3)
       {if(r & it.object==g.v(2)) {s=it.loops; r=false}; r}
    

    These basic examples touch at what is possible when maneuvering a graph with Gremlin. As the graphical domain model becomes more complex and the way in which vertices relate to each other yield increasingly sophisticated abstract relationships, Gremlin becomes an indispensable tool for arbitrary property graph traversal, query, and ultimately, problem-solving.

    For those that process RDF, Gremlin provides connectivity to the OpenRDF Sail framework (see Sail and Blueprints). Moreover, with Gremlin, you can traverse the Web of Data in real-time.

    The move to Groovy as Gremlin’s host language will speed up the development and ease the maintenance of Gremlin. This is a big step for all of us that love to traverse graphs.

    About these ads

    From → Gremlin

    One Comment

    Trackbacks & Pingbacks

    1. Tweets that mention Gremlin 0.7 Released « Marko A. Rodriguez -- Topsy.com

    Comments are closed.

    Follow

    Get every new post delivered to your Inbox.

    Join 140 other followers

    %d bloggers like this: