Peapod:Impl 不是抽象的,不会覆盖 peapod.FramedVertexTraversal 中的抽象方法 start()

Peapod: Impl is not abstract and does not override abstract method start() in peapod.FramedVertexTraversal

开始进行一些基本的修改以创建域模型。 我得到了泰坦 运行,添加了它的众神图,并使用 gremlin 成功遍历了它。

但是当我尝试创建一个 FramedGraph 时,我得到以下堆栈跟踪:

java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at peapod.internal.runtime.FramerRegistry.lambda$register(FramerRegistry.java:47)
at java.lang.Iterable.forEach(Iterable.java:75)
at peapod.internal.runtime.FramerRegistry.register(FramerRegistry.java:45)
at peapod.FramedGraph.<init>(FramedGraph.java:73)
at my.domain.model.Main.main(Main.java:28)
Caused by: java.lang.RuntimeException: Uncompilable source code - my.domain.model.vertices.Person$Impl is not abstract and does not override abstract method start() in peapod.FramedVertexTraversal
at my.domain.model.vertices.Person$Impl$PersonFramer.<clinit>(Person$Impl.java:14)
... 10 more

这是我的脚本:

public static void main(String[] args) {
    System.out.println("--- Creating Titan client ---");
    TitanGraph graph = TitanFactory.open("path/to/titan-1.0.0-hadoop1/conf/titan-cassandra-es.properties");
    //GraphTraversalSource gremlin = graph.traversal();
    System.out.println("--- Creating FramedGraph ---");
    try {
        FramedGraph g = new FramedGraph(graph, Package.getPackage("my.domain.model"));

        //GraphOfTheGodsFactory.load(graph);
        //Vertex saturn = gremlin.V().has("name", "saturn").next();
        //System.out.println(saturn.value("name"));
        System.out.println("--- Creating Person Vertex and adding it to the graph ---");
        Person person = g.addVertex(Person.class);
        System.out.println("--- Setting its name ---");
        person.setName("alice");

        System.out.println("--- Retriving all Persons with name ---");
        List<Person> persons = g.V(Person.class).has("name", "alice").toList();

        assert 1 == persons.size() : "More than one Person vertex found.";

        g.close();
    } catch (ExceptionInInitializerError e) {
        e.printStackTrace();
    } catch (Exception ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    } 

    graph.close();
}

我抽象的人class:

package my.domain.model.vertices;

import peapod.annotations.Vertex;

@Vertex
public abstract class Person{
  public abstract String getName();
  public abstract void setName(String name);
}

我正在使用 Titan 1.0.0 Hadoop1,可能是版本问题,因为 peapod 使用 Tinkerpop 3.0.0.M9-incubating 而 titan 似乎使用 Tinkerpop 3.0.1-incubating

Peapod 的 Willem。我测试了你的 类.

Peapod 需要 Java 8 并使用接口 类 中定义的默认方法。请务必使用 Java 8 兼容性进行编译。

将此添加到您的 Maven pom.xml 文件

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>