In this post, we are going to make use of the Grails GORM for Neo4j to create a Graph database representing the simplified Sequence Ontology shown in the image below:
NB: Before we get started, I am using the following versions and the IntelliJ IDE:
thoba at xps in ~
$ sdk c
Using:
gradle: 2.14
grails: 3.1.9
groovy: 2.4.7
To get started, we need to install the plugin into our Grails application (soneo) by editing the build.gradle file and adding the plugin as a dependency.
By default Neo4j will be used in embedded mode, the default directory for the Neo4j datastore is data/neo4j.
We will modify our controllers to use dynamic scaffolding, so they will all have the following, replacing {DomainName} with the appropriate domain name:
With this in place, we can run our app using the grails run-app command, pointing our browser to localhost:8080 and start to populate data.
In order for us to view our data in Neo4j, we are going to make use of a slightly modified docker image (thoba/neo4j_galaxy_ie:soneo) to cater for user permissions as, by default, docker runs as root.
Also, our application is integrated with Neo4j in embedded mode. This means that one program and only one program can read and write to the database at a time. We will have to stop grails and run the following:
$ cd soneo
$ docker run -d\-eNEO4J_UID=$(id-u)-eNEO4J_GID=$(id-g)-eNEO4J_AUTH=none \-v\$(pwd)/data/neo4j:/data \-p 7474:7474 \
thoba/neo4j_galaxy_ie:soneo
When we see our running container via docker ps, we can point our browser to localhost:7474. Clicking on the IS_A relationship on the side shall present data similar to the graph depicted below:
Leave a comment