如何从neo4j浏览器查看我的数据库?

时间:2015-02-03 10:58:56

标签: java database neo4j

我是neo4j的新手。我在Eclipse中创建了一个java项目来创建一个neo4j数据库及其中的一些节点。我看到在我的工作区文件夹中创建了数据库目录。但是我如何在neo4j浏览器上查看它?

以下是我使用的示例代码:

package com.neo4j.demo;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;

public class Neo4jDemoOperations {
public static void main(String args[]) {
        GraphDatabaseFactory dbFactory = new GraphDatabaseFactory();
        GraphDatabaseService db =     dbFactory.newEmbeddedDatabase("./DemoDatabase");
        try (Transaction tx = db.beginTx()) {

        Node javaNode = db.createNode(Tutorials.JAVA);
        javaNode.setProperty("TutorialID", "JAVA001");
        javaNode.setProperty("Title", "Learn Java");
        javaNode.setProperty("NoOfChapters", "25");
        javaNode.setProperty("Status", "Completed");

        Node scalaNode = db.createNode(Tutorials.SCALA);
        scalaNode.setProperty("TutorialID", "SCALA001");
        scalaNode.setProperty("Title", "Learn Scala");
        scalaNode.setProperty("NoOfChapters", "20");
        scalaNode.setProperty("Status", "Completed");

        Relationship relationship = javaNode.createRelationshipTo(
                scalaNode, TutorialRelationships.JVM_LANGIAGES);
            relationship.setProperty("Id", "1234");
            relationship.setProperty("OOPS", "YES");
            relationship.setProperty("FP", "YES");

            tx.success();
        }
        System.out.println("Done successfully");

    }
}

TutorialsTutorialRelationships是枚举。

提前致谢。

1 个答案:

答案 0 :(得分:1)

我在行

中更改了数据库的路径
org.neo4j.server.database.location=

neo4j-server.properties文件夹内的conf文件中。我在workspace文件夹中选择了路径作为数据库的路径,并且它有效!