0

我已经将一堆数据加载到我的 java 应用程序的数据库中。但是,当我启动 Web 管理服务器时,我只能看到默认的 1 个节点,1 个关系。我如何(指向?)此服务器到我在 EmbeddedGraphdatabase 实例中指定的数据文件?如果有帮助,我已经包含了一段代码。谢谢!

// The path to my data files is var/graphDb/full_abstract1. I want Web Admin to point HERE
graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( "var/graphDb/full_abstract1" );
registerShutdownHook(graphDb);

Transaction tx = graphDb.beginTx();
    int count = 0;
    try {
        for (org.openbel.framework.common.model.Statement s : statements) {

            firstNode = graphDb.createNode();
            String str = s.getSubject().toBELShortForm();
            firstNode.setProperty("getSubject()", str);

            secondNode = graphDb.createNode();
            String str0 = s.getObject().toBELShortForm();
            secondNode.setProperty( "getObject()", str0);

            // have to convert the Relationship Type
            org.openbel.framework.common.enums.RelationshipType r = s.getRelationshipType();
            RelationshipType r_neo = makeNeoRType(r);
            relation = firstNode.createRelationshipTo(secondNode, r_neo);

            tx.success();
            out.println("# statements: " +count++);
        }
    }
    finally {
        tx.finish();
    }
    // Some debug code, to make sure I get all the nodes I expect.
    for (Node n : graphDb.getAllNodes()) {
        for (Relationship r : n.getRelationships()) {
            out.println("Node Id: " +n.getId());
            out.println("Relationship Type: " +r.getType());
        }
    }
    out.println("Done");
4

1 回答 1

2

您编辑conf/neo4j-server.properties并将数据库路径设置为var/graphDb/full_abstract1

您还可以将 Web 界面作为 Java 应用程序的一部分启动,请参阅:http ://docs.neo4j.org/chunked/snapshot/server-embedded.html

于 2012-08-23T22:28:38.870 回答