Totorom Tinkerpop2

An ORM for the Tinkerpop2 graph stack.

License

License

GroupId

GroupId

org.jglue.totorom
ArtifactId

ArtifactId

totorom-tinkerpop2
Last Version

Last Version

0.5.4
Release Date

Release Date

Type

Type

jar
Description

Description

Totorom Tinkerpop2
An ORM for the Tinkerpop2 graph stack.

Download totorom-tinkerpop2

How to add to project

<!-- https://jarcasting.com/artifacts/org.jglue.totorom/totorom-tinkerpop2/ -->
<dependency>
    <groupId>org.jglue.totorom</groupId>
    <artifactId>totorom-tinkerpop2</artifactId>
    <version>0.5.4</version>
</dependency>
// https://jarcasting.com/artifacts/org.jglue.totorom/totorom-tinkerpop2/
implementation 'org.jglue.totorom:totorom-tinkerpop2:0.5.4'
// https://jarcasting.com/artifacts/org.jglue.totorom/totorom-tinkerpop2/
implementation ("org.jglue.totorom:totorom-tinkerpop2:0.5.4")
'org.jglue.totorom:totorom-tinkerpop2:jar:0.5.4'
<dependency org="org.jglue.totorom" name="totorom-tinkerpop2" rev="0.5.4">
  <artifact name="totorom-tinkerpop2" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jglue.totorom', module='totorom-tinkerpop2', version='0.5.4')
)
libraryDependencies += "org.jglue.totorom" % "totorom-tinkerpop2" % "0.5.4"
[org.jglue.totorom/totorom-tinkerpop2 "0.5.4"]

Dependencies

compile (4)

Group / Artifact Type Version
com.google.code.gson : gson jar 2.3
junit : junit jar 4.11
com.tinkerpop.gremlin : gremlin-java jar 2.6.0
com.google.guava : guava jar 16.0.1

provided (2)

Group / Artifact Type Version
javax.enterprise : cdi-api jar 1.1
org.springframework : spring-beans jar 4.0.1.RELEASE

test (2)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.9.5
com.codahale.metrics : metrics-core jar 3.0.2

Project Modules

There are no modules declared in this project.

Totorom

An ORM / OGM for the Tinkerpop graph stack.

Discussion at https://groups.google.com/forum/#!forum/totorom

This project has been created as an alternative to the Tinkerpop Frames project. If you like Gremlin and you like Java then you will like this!

<dependency>
    <groupId>org.jglue.totorom</groupId>
    <artifactId>totorom-tinkerpop2</artifactId>
    <version>0.5.4</version>
</dependency>

It's just a way to give typed context to your gremlin queries:

public class Person extends FramedVertex {

  public String getName() {
    return getProperty("name");
  }
  
  public void setName(String name) {
    setProperty("name", name); //Properties are simple method calls
  }

  public List<Knows> getKnowsList() {
    return outE("knows").toList(Knows.class); //Gremlin natively supported
  }
  
  public List<Person> getFriendsOfFriends() {
    return out("knows").out("knows").except(this).toList(Person.class); //Gremlin natively supported
  }
  
  public Knows addKnows(Person friend) {
    return addEdge("knows", friend, Knows.class); //Elements are automatically unwrapped
  }
}

public class Knows extends FramedEdge {

  public void setYears(int years) {
    setProperty("years", years);
  }
  
  public int getYears() {
    return getProperty("years");
  }
}


public class Programmer extends Person {

}

And here is how you interact with the framed elements:

public void testBasic() {

  Graph g = new TinkerGraph();
  FramedGraph fg = new FramedGraph(g);
  Person p1 = fg.addVertex(Person.class);
  p1.setName("Bryn");
  
  Person p2 = fg.addVertex(Person.class);
  p2.setName("Julia");
  Knows knows = p1.addKnows(p2);
  knows.setYears(15);
  
  Person bryn = fg.V().has("name", "Bryn").next(Person.class);
  
  
  Assert.assertEquals("Bryn", bryn.getName());
  Assert.assertEquals(15, bryn.getKnowsList().get(0).getYears());
  

}

Using TypeResolver.Java will save the type of Java class the element was created with for use later:

public void testJavaTyping() {
  Graph g = new TinkerGraph();
  FramedGraph fg = new FramedGraph(g, FrameFactory.Default, TypeResolver.Java);//Java type resolver
  //Also note FrameFactory.Default. Other options are CDI and Spring.
  
  Person p1 = fg.addVertex(Programmer.class);
  p1.setName("Bryn");
  
  Person p2 = fg.addVertex(Person.class);
  p2.setName("Julia");
  
  Person bryn = fg.V().has("name", "Bryn").next(Person.class);
  Person julia = fg.V().has("name", "Julia").next(Person.class);
  
  Assert.assertEquals(Programmer.class, bryn.getClass());
  Assert.assertEquals(Person.class, julia.getClass());
}

This project uses code derived from the Tinkerpop project under the apache licence and or tinkerpop licence.

Copyright 2014-Infinity Bryn Cooke

http://opensource.org/licenses/Artistic-2.0

Versions

Version
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0