Neo4j is a graph database management system described as an ACID-compliant transactional database with native graph storage and processing. Neo4j is by far the most popular graph database according to DB-Engines ranking. Cypher is a declarative graph query language that allows for expressive and efficient querying and updating of a property graph.
Hackolade was specially built to support the data modeling of Neo4j node labels and relationship types. The application closely follows the terminology of the database.
To be clear, Hackolade is not a graph visualization tool, but a tool for data modeling of Neo4j graph databases.
To perform data modeling for Neo4j with Hackolade, you must first download the Neo4j plugin. You can find more details on graph-specific controls in this page.
The data model in the picture below results from the reverse-engineering of the movie recommendations Neo4j sandbox. Two views of the data model are available:
1) a graph view, with familiar circular node labels
2) an Entity-Relationship Diagram (ERD) view, with the advantage of displaying properties for both node labels and relationship types:
Node labels are a semantic representation of nodes in the graph. Node labels are used to represent the role of the node in the domain, making it possible to query the graph, to define constraints, and add indexes for properties. Labels can also be used to mark temporary states of a node.
A node label usually has attributes, called "property keys" where the name (or key) is a string.
Property data types
The supported property types are:
- Number, an abstract type, which has the following subtypes:
- Spatial types:
- Point (with subtypes: WGS84, WGS84 3D, Cartesian and Cartersian 3D)
- Temporal types:
Node key constraints
A node key constraint ensures that all nodes with a particular label have a set of defined properties whose combined value is unique, and where all properties in the set are present.
Relationship types are a semantic representation of relationships in the graph. Every relationship must have one and only type, and 2 nodes can be linked by several relationship types. Relationship types are used during complex traversals across the graph, when only certain kinds of paths from node to node are necessary for a specific query.
In Neo4j, relationship types are unidirectional, going from one node label to another node label. In Hackolade we also represent relationship types that are implicitly bi-directional. For example, IS_MARRIED_TO should not require 2 relationship types, but instead be considered bi-directional. Since Neo4j does not support the bi-directional concept, marking a relationship as bi-directional in Hackolade is for documentation purposes only.
As Neo4j is a type of graph database known as 'property graph', relationship types may have attributes, or property keys, just like node labels:
In Neo4j, it is possible to create an index on a single property for any given label. A so-called composite index can also be created on more than one property for a given label.
With Neo4j version 5, new indexes types have been added: range, text, point, and full-text.
Cypher is a declarative graph query language that allows for expressive and efficient querying and updating of a property graph. Hackolade dynamically generates Cypher code as the model is created via the application.
The process to reverse-engineer uses the APOC procedure apoc.meta.subgraph() to query the database, infer the schema and represent the node labels and relationship types with their property keys, constraints, and indexes. If APOC is not available, the process falls back on the Cypher function db.schema(), but db.schema() is not preferred as it is known to have some bugs (also here.)
For more details, you may consult the Neo4j website and graph database concepts page.