Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed a neo4j graph in another site?

Background

I've been using neo4j to query a fairly large (but ultimately uncomplicated) dataset. I'm writing cypher directly into the web interface and keeping a track of my queries in a text file (old-skool).

Problem

I love the results I'm getting back, so I'd like to take this another step and build a more rigorous interface around it so that I can give it to non-technical people to explore the data within some pre-programmed parameters.

I've read the node4j API reference and I'm certain I could build an interface from scratch with a combination of D3 for layout and a back-end middleware app using (for example) seraph in node.js or the neo4j rubygem.

However, the standard neo4j web interface is so good that I wonder if I could leverage it a bit further and embed the query results (including force-directed graphs) in my app, rather than start from scratch?

Possible approach

Is there any precedence for this approach? I guess the journey would be something like:

  • Construct a query in my 3rd party app
  • Query neo4j server
  • Receive iframe (or other?) response
  • Embed response in 3rd party page

Any advice on this would be ace.

like image 606
Peter MacRobert Avatar asked Oct 07 '15 02:10

Peter MacRobert


People also ask

Is Neo4j embedded?

Neo4j can be used in two modes: An embedded database in a Java application; A standalone server via REST.

How do I access Neo4j from my browser?

Neo4j Browser is the easiest way to access a Neo4j database. To establish a connection, you enter the DBMS URL, the name of the database you want to connect, and the user credentials. You can also use the :server command to manage the connection to Neo4j.

What are the disadvantages of Neo4j?

Neo4j has some upper bound limit for the graph size and can support tens of billions of nodes, properties, and relationships in a single graph. No security is provided at the data level and there is no data encryption. Security auditing is not available in Neo4j.

Can Neo4j be distributed?

With today's launch of Neo4j 4.0, the company has taken the first step in creating a distributed graph database that spans multiple physical systems. Neo4j is not yet a fully distributed graph database, even with 4.0.


2 Answers

Check out http://neo4j.com/developer/guide-data-visualization

It explains how to do it yourself but also links to other tools and frameworks that you can use for that.

You can also check out http://jexp.github.io/cy2neo for one example I created a while ago.

Usually most javascript graph visualization frameworks are easy to use.

like image 63
Michael Hunger Avatar answered Oct 17 '22 19:10

Michael Hunger


You should take a look at Neo4j GraphGists, which was created for the same purpose.

[EDITED]

If you want to access your own database with GraphGists, that seems to be possible. Caveat: I have not tried this myself.

  • GraphGist is available as open source, and you can run it locally on your own computer/server.
  • Looking in the GraphGist installation script, you can see that it clones another neo4j open source project, called rabbithole.
  • Rabbithole's Readme states that you can configure it to "expose" a local DB:

    Potential arguments for local execution:

    java org.neo4j.community.console.Console port /path/to/db [expose]
    

    ("expose" will write and read-through to the graph-db otherwise it will copy the graph content into an in-memory db)

  • Near the bottom of rabbithole's pom file, you can configure rabbithole:

                <mainClass>org.neo4j.community.console.Console</mainClass>
                <!--arguments>
                  <argument>argument1</argument>
                </arguments-->
    
    • Theoretically, if you replace argument1 with port /path/to/db expose (and uncomment the arguments tag), you will be using your own local DB.
like image 20
cybersam Avatar answered Oct 17 '22 19:10

cybersam