简体   繁体   中英

Visualizing an Embedded Neo4j Graph Database

For the past two weeks, I have read a variety of stackoverflow posts related to the visualization of a Neo4j database, but they don't address my issue. I get ideas from one post, ideas from another, but they are not self-consistent. I've also done a number of Google searches trying to understand how to visualize an embedded Neo4j graph database, to no avail.

I've written a really simple java class and method that creates a simple graph (35 nodes and 30 relationships). The first code snippet below shows show I've created the embedded graph database. The second code snippet shows how I've been able to query the database, once populated.

I've been able to query the graph in the Java code and confirm that the nodes and relationships are correct. What I'd like to do is visualize this simple graph before moving on to the real data set that has many more nodes and relationships.

I'm doing my code development and test on an iMac running macOS 10.15 (Catalina), JetBrains IntelliJ IDE, JDK 1.8.0_221. Once I get this code working on my iMac I plan to migrate it to a GCP environment to run it at scale. I will need to crate visualizations of the database over time, so a manually intensive visualization effort is not desirable. As such, I want to stay away from visualizing the graph database using the Neo4j Desktop browser.

I tried to ingest the embedded graph database into Gephi (the preferred approach) using the Neo4j plugin. When I selected the graph database folder and clicked on open, Gephi responded with a blank dialogue box titled warning. I'm confident I did something wrong, but I don't know what I did, or didn't do properly.

Creation of Embedded Graph Database

        gdbFactory = new GraphDatabaseFactory();
        gdbService = gdbFactory.newEmbeddedDatabase(new File(gdbDirectory));

        try (Transaction databaseTransaction = gdbService.beginTx())
        {
           ...database commands...

           databaseTransaction.success();
        }

        gdbService.shutdown();

Query of Embedded Graph Database

 try (Transaction databaseTransaction = BaselineGitHubToGraphDb.gdbService.beginTx())
        {
            Result queryResult = BaselineGitHubToGraphDb.gdbService.execute(queryString);

            while (queryResult.hasNext())
            {
                Map<String, Object> row = queryResult.next();

                for (Map.Entry<String, Object> column : row.entrySet())
                {
                    linesOfText += column.getKey() + ": " + column.getValue() + "; ";
                }
                linesOfText += "\n";
            }
            System.out.printf("\t%s\n",
                    linesOfText);
            databaseTransaction.success();
        }

What I'd like to be able to do is produce a graphical representation of the graph database to verify the logic of the java code that creates the nodes, relationships, and associated properties. I'd like to do that with this small dataset, then a dataset ~ 10x larger, before moving the code to the GCP environment to test it at scale and put it to work there.

Can you either share or point me to some java code that will allow me to visualize an embedded Neo4j database using Gephi or some other means, if appropriate?

Thanks in advance for your help with this question.

It is possible to access Neo4j embedded via the Bolt protocol. Please try my new plugin and tell me if it solves your problem:

https://github.com/olir/gephi-neo4j-url-importer-plugin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM