Visualizing graph database - neo4j

Assuming i am working with neo4j, the only way i can think of that would visualize my mock up data is to generate cypher code and paste it into neo4j's data browser
Is there another (better, simplier?) way one can use to create visualization without using cypher? Generating cypher code seems like a complex enough task by itself.
Writing tests is of course another way of making sure relationships are set up right, but as i am learning the system, i'd like to visually see things to make sure they are set up as expected.

This gist contains an example on how to use the Neo4J Graphviz component to generate output in Graphviz DOT notation, which is supported by a range of graph visualizing software. (And of course Graphviz itself)
(Link to the original blog post where I found the example: http://blog.neo4j.org/2012/05/graph-this-rendering-your-graph-with.html)

There is a new solution to explore the content of a Neo4j graph database using a web browser: http://linkurio.us/
It allows you to search nodes by properties, inspect nodes, expand neighborhood...
Disclamer: I'm co-founder of Linkurious and Gephi.

There are some options listed on http://www.neo4j.org/develop/visualize also.

Related

Neo4j to grafana

I want to present release data complexity which is associated with each node like at epic, userstory etc in grafana in form of charts but grafana do not support neo4j database.Is there any way Directly or indirectly to present neo4j database in grafana?
I'm having the same issues and found this question among others. From my research I cannot agree with this answer completely, so I felt I should point some things out, here.
Just to clarify: a graph database may seem structurally different from a relational or time series database, but it is possible to build Cypher queries that basically return graph data as tables with proper columns as it would be with any other supported data source. Therefore this sentence of the above mentioned answer:
So what you want to do is just not possible.
is not absolutely true, I'd say.
The actual problem is, there is no datasource plugin for Neo4j available at the moment. You would need to implement one on your own, which will be a lot of work (as far as I can see), but I suspect it to be possible. For me at least, this will be too much work to do, so I won't use any approach to read data directly from Neo4j into Grafana.
As a (possibly dirty) workaround (in my case), a service will regularly copy relevant portions of the Neo4j graph into a relational database (or a time series database, if the data model is sufficiently simple for that), which Grafana is aware of (see datasource plugins), so I can query it from there. This is basically the replication idea also given in the above mentioned answer. In this case you obviously end up with at least 2 different database systems and an additional service, which is not so insanely great, but at the moment it seems to be the quickest way to resolve the problem with the missing datasource plugin. Maybe this is applicable in your case, too.
Using neo4j's graphite metrics you can actually configure data to be sent to grafana, and from there build whichever dashboards you like.
Up until recently, graphite/grafana wasn't supported, but it is now (in the recent 3.4 series releases), along with prometheus and other options.
Update July 2021
There is a new plugin called Node Graph Panel (currently in beta) that can visualise graph structures in Grafana. A prerequisite for displaying your graph is to make sure that you have an API that exposes two data frames, one for nodes and one for edges, and that you set frame.meta.preferredVisualisationType = 'nodeGraph' on both data frames. See the Data API specification for more information.
So, one option would be to setup an API around your Neo4j instance that returns the nodes and edges according to the specifications above. Note that I haven't tried it myself (yet), but it seems like a viable solution to get Neo4j data into Grafana.
Grafana support those databases, but not Neo4j : Graphite, InfluxDB, OpenTSDB, Prometheus, Elasticsearch, CloudWatch
So what you want to do is just not possible.
You can replicate your Neo4j data inside of those database, but the datamodel is really different ... (timeseries vs graph).
If you just want to have some charts, you can use Apache Zeppeline for that.

Importing SNOMED CT into Neo4J

I need to import SNOMED CT ontology into a graph database, in this case Neo4J but it could be another choice eventually.
However, I could not find a clear depiction of SNOMED CT underlying relational data model, in order to achieve this. Or at least, simplified SQL views that expose entity relantionship in a way that can be mapped to a graph database.
I would greatly appreciate any guidance or previous experiencies with this matter.
Directly trying to serialise the relational data model is probably going to be quite difficult and will take you further away from your goal.
It is worth noting that SNOMED data is actually available in RDF format already. So you get a graph structure for "free".
For example this project provides the data in a RDF format and putting RDF data into a graph is quite simple regardless of your choice of Titan or Neo4j.
Side Note:
A colleague of mine has actually worked on importing SNOMED data into a Grakn Graph, a semantic graph system we both work on. If you interested you can check out his work here. Grakn is a semantic graph solution which runs on top of Titan.
If you are looking for a sample on how to model the Concepts, Descriptions and Relationships into a Graph database. I have a sample project in Github that can upload the Snomed data into a Neo4j database.
https://github.com/pradeepvemulakonda/Snomed
Before you go into the implementation detail, I would suggest trying out the following Snomed data browser at
http://ontoserver.csiro.au/shrimp/
Once you get a feel of the concepts and relationships you can go through the implementation. You can use the following gist to understand how you can query the uploaded concepts and relationships in Neo4j.
https://neo4j.com/graphgist/95f4f165-0172-4b3d-981b-edcbab2e0a4b#listing_category=health-care-and-science
SNOMED can be loaded into MySQL using the UMLS (unified medical language system) released by NIH. Once loaded the table MRREL contains all the relations between SNOMED nodes. If you want load it right away in Neo4j you can totally skip the MySQL step and work directly with the UMLS RRF files. The RRF documentation format is not great but the files are easy to parse tabular text.
There are in fact three tables, Concepts, Descriptions and Relationships
You'll find them described here:
https://confluence.ihtsdotools.org/display/DOCTIG/3.1.+Components
Most important are the relations between Relationships and Concepts and Descriptions and Concepts.

"Resultset too large (over 1000 rows)" in neo4j browser

I'm using neo4j 2.1.2 community edition. I have loaded the CSV file which is having 2500 rows and i have created nodes and relationships among the columns. When i run the below cypher query
match (n) return count(*);
I'll get the nodes count as 17275. So when i match the nodes like match (n) return n and try to get the corresponding graph in a neo4j browser, it says
Resultset too large (over 1000 rows)
I know it's due to the nodes requested is more than 1000. So if i want to see the complete graph in neo4j browser, how can i do it?
The same query i tried in the neo4j web-admin, i wan able to get the data in tabular format but i wanted to see the data as a graph.
Also I'm not able to find neo4j-Shell in my neo4j installation bin directory. Why is that?
Thanks
Update 1
The Neo4J Web UI is built on top of D3.js using SVG: due to SVG performances in a browser when you have more than 500 nodes in a network, the user experience starts to degrade quite quickly.
Handling more than 1000 nodes adds to the technical challenge: in fact with so many nodes what happens most of the time is the "hairball" effect.
This is a blog post that might be useful (disclaimer: I am a developer for KeyLines) about visualizing big network with some design hints.
As you can imagine visualizing more than 1000 nodes is not that easy and that's why some companies such Cambridge Intelligence (KeyLines), Tom Sawyer (Perspective) or Linkourius came up with specific products for that.
You can of course build the visualization yourself for fun with open source libraries but keep in mind that it can take a very long time.
If your Neo4J project is not commercial I can suggest to have a look to Gephi to visualize it: it is a Desktop Application and it has a Neo4J adapter plugin. It can easily handle huge datasets but of course it lacks the same portability of a webapp.
In case you need ONLY a storage for your graph/data than a visualization is not required, you're right.
Original Answer
I think you might have to implement a custom visualization too see such graph in the browser, using one option of those in this page: http://www.neo4j.org/develop/visualize .
Alternatively have a look to this most extensive list here: Big data visualization using "search, show context, and expand on demand" concept
Or maybe have a different visualization approach with one of the following: Data Visualization libraries
Look at settings in neo4j browser. You can change Graph Visualization how you like. But browser can work much slower if you wanna see the complete graph.

How to visualise Neo4j graph database created from an embedded Neo4j java application

I created an application which embedded Neo4j. In that application I created and stored some nodes with some relationships. My application has saved this database to a file. I would like to visualise that data. I know I can see graphs if I fire up the Neo4j server but I do not know how to import my neo4j.db file into the Neo4j server so that I can visualise it. Any suggestions would be greatly appreciated.
Depending on your use case you might have different solutions:
Use a web-based visualization
Use a desktop application to visualize your data
Use web-based visualization
In this case you have to take care of the web-app to visualize the data.
You have basically two solutions out there: Javascript or Java applets.
For the Javascript side you have many choices: D3js, VivaGraph, SigmaJS, KeyLines.
The first three are open source and free while the last one has a commercial licence and non-free.
There're already a million questions about these libraries on SO, so I'll link you to some of those to understand the various differences.
Desktop Application
The main solutions in this case I would recommend you, depending on the kind of data are: either Gephi or Cytoscape.
In both cases I believe you have to write your own adapter to communicate with your application.
Architecture Reference
The architecture in both cases will be the following:
The controller renders a webpage with the JS visualisation framework you want to use
The controller offers a couple of JSON endpoints the client can use to query the data from the Neo4J embedded
Each query fetch the data, put in a model and render the JSON to send to the client
If you're NOT using neo4j 2.0+ then really good way to visualize your graph is by using neoclipse. https://github.com/neo4j-contrib/neoclipse/downloads
it's really handy and it has cypher support too.
Or
another quick hack is to copy your db folder (which you created by using embedded database) into $NEO4j_HOME/data/
and
change $NEO4j_HOME/conf/neo4j-server-properties file to point to
and
start your server (bin/.neo4j start). You'll be able to visualize your database at localhost:7474
I hope it helps!

How can you define and enforce a Neo4J graph's schema?

I want to achieve, with a Neo4j graph a RDBMS's ability to define and enforce a known schema. We know what our graph should look like (all the edge types and node types). So we simply want to prevent someone (developer/user) from adding an edge or node type which is "invalid" i.e. not part of the defined graph schema. How can we enforce a graphs schema? Note I am not asking about how to enforce the properties of an edge or a graph but simply how to enforce that the graph is made up if a specific set of known edge and node types.
Please help
This should probably be done on the application side. Build a wrapper/API that enforces this sort of thing, and make the developers use it. Sorry for the short answer...
Most of the language drivers or frameworks listed here provide means to define a schema:
http://www.neo4j.org/drivers
For Java we developed structr (https://github.com/structr/structr) where you define your schema in Java beans. You could start f.e. with the simple Maven archetype as shown in this screencast: http://vimeo.com/53235075
Cheers
Axel
It has to happen in a layer above Neo4j. I've been building one of those layers (Restagraph), which puts a REST interface on top of it.
It's a mite less mature than Structr, but may be worth a look. I package it in a Docker image, and it's designed so you can easily define your own schema in YAML files.

Resources