Working of your code

Let's take a look at a simple Hello World application code for Neo4j and understand what goes on under the hood when you try to perform some simple operations on Neo4j through the Java API. Here is the code for a sample app:

import org.neo4j.graphdb.*; import org.neo4j.kernel.EmbeddedGraphDatabase; /** * Example class that constructs a simple graph with * message attributes and then prints them. */ public class NeoOneMinute { public enum MyRelationshipTypes implements RelationshipType { KNOWS } public static void main(String[] args) { GraphDatabaseService graphDb = new EmbeddedGraphDatabase("var/base"); Transaction tx = graphDb.beginTx(); try { Node node1 = graphDb.createNode(); Node node2 = graphDb.createNode(); Relationship ...

Get Neo4j High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.