Totorom

An ORM for the Tinkerpop graph stack.

Лицензия

Лицензия

Группа

Группа

org.jglue.totorom
Идентификатор

Идентификатор

totorom-parent
Последняя версия

Последняя версия

0.5.4
Дата

Дата

Тип

Тип

pom
Описание

Описание

Totorom
An ORM for the Tinkerpop graph stack.
Система контроля версий

Система контроля версий

https://github.com/BrynCooke/totorom

Скачать totorom-parent

Имя Файла Размер
totorom-parent-0.5.4.pom 3 KB
Обзор

Как подключить последнюю версию

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

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

  • totorom-tinkerpop2
  • totorom-tinkerpop2-java8-demo

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

Версии библиотеки

Версия
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0