Search This Blog

Saturday 5 May 2018

Neo4j - extracting some schema information using Cypher queries

Since schema is not a compulsion with Neo4j, I was looking at ways to get information on the type of nodes and relationships in the database.
These below are not my own queries. I came across a good link and decided to use it here.
The below java code when executed against a database collect information on the type of nodes, relations and combinations seen in the database.

Neo4j - Extracting relationship properties

Neo4j relations can also have their own properties. In the sample movie database, the ACTED_IN relationship has a roles property, which can take multiple values (An actor may play multiple roles in a Movie).
Here I take a look at accessing these values from Java.

Neo4j - Identifying a Nodes Label and a Relations Type

I wanted to find out which all person nodes are associated to a given Movie and in what roles. Consider that my Movie database has several relations -
Person acted in a movie
Person directed a movie
Person reviewed a movie
Person followed a movie ......... and many more.