Neo4j…how to get a visual representation of my dat

2019-06-04 04:44发布

问题:

I have loaded an embedded instance of Neo4j with some data, and would like to know how I can now view this graph. I saw an intro video here: http://video.neo4j.org/m9FD/how-to-get-started-with-neo4j-119/. Here the guy opened an instance in his web browser via Heroku and was able not only see the data in the graph, but also enter new data and search for both nodes and relationships. How do I see the data I have entered into the graph-database?

graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( "var/graphDb" );
        registerShutdownHook(graphDb);

        WrappingNeoServerBootstrapper srv = new WrappingNeoServerBootstrapper( graphDb );
        srv.start();

        for (Statement s : statements){

            Transaction tx = graphDb.beginTx();
            try{
                firstNode = graphDb.createNode();
                firstNode.setProperty("message", s.getFirstTerm());
                secondNode = graphDb.createNode();
                secondNode.setProperty( "message", s.getSecondTerm());

                relation = firstNode.createRelationshipTo(secondNode, s.getRelationshipType());
                //relation.setProperty("message", "crazy cruel");
                tx.success();
            }
            finally{
                tx.finish();
            }
        }
        srv.stop();

    }

回答1:

you could either

  • fire up a server as part of your embedded instance, see http://docs.neo4j.org/chunked/snapshot/server-embedded.html
  • use Neoclipse and point it to your (shut down) database, see http://vimeo.com/12014944 aand https://github.com/neo4j/neoclipse

  • install Neo4j Server http://docs.neo4j.org/chunked/snapshot/server.html, point out your database and use the webadmin tool for visualization.

Would that work?