Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试将IBM Notes数据迁移到Graph db中_Java_Xpages - Fatal编程技术网

Java 尝试将IBM Notes数据迁移到Graph db中

Java 尝试将IBM Notes数据迁移到Graph db中,java,xpages,Java,Xpages,我正在使用OpenNTF Domino API开发一个XPages应用程序,以探索图形数据建模功能。我以IBMDomino附带的Teamroom为例 我已经定义了一种将响应文档迁移到Grap db的方法,但是我得到了错误消息:无法对非静态方法进行静态引用 下面是该方法的外观: private void migrateResponses(DFramedTransactionalGraph<DGraph> profilesGraph) { try { Databa

我正在使用OpenNTF Domino API开发一个XPages应用程序,以探索图形数据建模功能。我以IBMDomino附带的Teamroom为例

我已经定义了一种将响应文档迁移到Grap db的方法,但是我得到了错误消息:无法对非静态方法进行静态引用

下面是该方法的外观:

private void migrateResponses(DFramedTransactionalGraph<DGraph> profilesGraph) {
    try {
        Database db = Factory.getSession().getCurrentDatabase();
        View view = db.getView("responsesOnly");
        DocumentCollection col = view.getAllDocuments();
        System.out.println("number of docs found " + col.getCount());

    for (Document response : col) {

        System.out.println("form:" + response.getFormName());
        System.out.println("id:" + response.getUniversalID());

        org.openntf.domino.ext.Document parent = response.getParentDocument();

        if (null == parent.getParentDocument()){
            //has no parent document so this parent document is a MainTopic/Post
            Post post = profilesGraph.addVertex(parent.getMetaversalID(), Post.class);
            Response vertexResponse = profilesGraph.addVertex(response.getUniversalID(), Response.class);
            vertexResponse.setSubject(response.getItemValueString("Subject"));
            Post.addResponse(vertexResponse);
        }
    }
    profilesGraph.commit();
} catch (Throwable t) {
    XspOpenLogUtil.logError(t);
}
}
package com.wordpress.quintessens.graph.teamroom;

import org.openntf.domino.graph2.annotations.AdjacencyUnique;
import org.openntf.domino.graph2.builtin.DVertexFrame;

import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.frames.Property;
import com.tinkerpop.frames.modules.typedgraph.TypeValue;

@TypeValue("post")
public interface Post extends DVertexFrame {

    @Property("$$Key")
    public String getKey();

    @Property("subject")
    public String getSubject();

    @Property("subject")
    public void setSubject(String n);

    // real edges!

    @AdjacencyUnique(label = "hasWritten", direction = Direction.OUT)
    public Iterable<Profile> getAuthors();


    @AdjacencyUnique(label = "hasReaction", direction = Direction.IN)
    public void addResponse(Response response);

    @AdjacencyUnique(label = "hasReaction", direction = Direction.IN)
    public void removeResponse(Response response);

    @AdjacencyUnique(label = "hasReaction", direction = Direction.IN)
    public Iterable<Response> getResponses();
}
以下是我的博士后课程:

private void migrateResponses(DFramedTransactionalGraph<DGraph> profilesGraph) {
    try {
        Database db = Factory.getSession().getCurrentDatabase();
        View view = db.getView("responsesOnly");
        DocumentCollection col = view.getAllDocuments();
        System.out.println("number of docs found " + col.getCount());

    for (Document response : col) {

        System.out.println("form:" + response.getFormName());
        System.out.println("id:" + response.getUniversalID());

        org.openntf.domino.ext.Document parent = response.getParentDocument();

        if (null == parent.getParentDocument()){
            //has no parent document so this parent document is a MainTopic/Post
            Post post = profilesGraph.addVertex(parent.getMetaversalID(), Post.class);
            Response vertexResponse = profilesGraph.addVertex(response.getUniversalID(), Response.class);
            vertexResponse.setSubject(response.getItemValueString("Subject"));
            Post.addResponse(vertexResponse);
        }
    }
    profilesGraph.commit();
} catch (Throwable t) {
    XspOpenLogUtil.logError(t);
}
}
package com.wordpress.quintessens.graph.teamroom;

import org.openntf.domino.graph2.annotations.AdjacencyUnique;
import org.openntf.domino.graph2.builtin.DVertexFrame;

import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.frames.Property;
import com.tinkerpop.frames.modules.typedgraph.TypeValue;

@TypeValue("post")
public interface Post extends DVertexFrame {

    @Property("$$Key")
    public String getKey();

    @Property("subject")
    public String getSubject();

    @Property("subject")
    public void setSubject(String n);

    // real edges!

    @AdjacencyUnique(label = "hasWritten", direction = Direction.OUT)
    public Iterable<Profile> getAuthors();


    @AdjacencyUnique(label = "hasReaction", direction = Direction.IN)
    public void addResponse(Response response);

    @AdjacencyUnique(label = "hasReaction", direction = Direction.IN)
    public void removeResponse(Response response);

    @AdjacencyUnique(label = "hasReaction", direction = Direction.IN)
    public Iterable<Response> getResponses();
}
package com.wordpress.quintessens.graph.teamroom;
导入org.openntf.domino.graph2.annotations.AdjacencyUnique;
导入org.openntf.domino.graph2.builtin.DVertexFrame;
导入com.tinkerop.blueprints.Direction;
导入com.tinkerpop.frames.Property;
导入com.tinkerpop.frames.modules.typedgraph.TypeValue;
@TypeValue(“post”)
公共接口Post扩展了DVertexFrame{
@属性($$Key)
公共字符串getKey();
@财产(“主体”)
公共字符串getSubject();
@财产(“主体”)
public void setSubject(字符串n);
//真正的优势!
@邻接Yunique(label=“hasWrite”,direction=direction.OUT)
公共Iterable getAuthors();
@邻接Yunique(label=“hasReaction”,方向=方向.IN)
公共响应(响应);
@邻接Yunique(label=“hasReaction”,方向=方向.IN)
公共真空消除响应(响应);
@邻接Yunique(label=“hasReaction”,方向=方向.IN)
公共Iterable getResponses();
}

你有没有建议我应该如何调整代码使其工作?

除非OpenNTF或TinkerPop正在对提供的注释进行某种处理,否则你正在尝试调用接口上的非静态方法。您确定不想更改:

Post.addResponse(vertexResponse);


除非OpenNTF或TinkerPop正在对提供的注释进行某种处理,否则您将尝试在接口上调用非静态方法。您确定不想更改:

Post.addResponse(vertexResponse);


尝试将
Post
更改为
Post
。看起来您指的是类而不是对象。请尝试将
Post
更改为
Post
。看起来您指的是类而不是对象。是的,这是正确的。对实例而不是接口调用方法。那就行了。是的,这是正确的。对实例而不是接口调用方法。那就行了。