How to Model a Graph Database
Step-by-step guide to modelling a standalone graph database schema for Neo4j using the graph diagram editor, including typed properties, key roles, 18-rule validation, and Cypher DDL export. For the model-first workflow using model.neoarc, see the Data Model guide.
Goal
Model a standalone graph database schema for Neo4j using the graph diagram editor's graph-db authoring mode. Define nodes with typed properties and key roles, connect them with labelled edges, add composite constraints, validate the schema against the built-in rules (covering core structural, semantic, and search-specific checks), and export to Cypher DDL for Neo4j.
Step 1: Create a Graph Diagram
Step 2: Set the Authoring Mode to Graph DB
The graph editor supports three authoring modes. Set it to graph-db for full schema modelling with typed properties, key roles, and validation.
| Authoring Mode | Purpose | Features |
|---|---|---|
| Mindmap | Quick brainstorming and idea mapping | Simple labels, no properties |
| Conceptual | High-level entity relationship modelling | Labels, basic properties, relationship names |
| Graph DB | Full graph database schema design | Typed properties, key roles, cardinality, composite constraints, validation, Cypher export |
Step 3: Add Nodes with Labels
Step 4: Define Typed Properties
Each node supports properties with full type information. Select a node and use the right panel to add properties.
| Property Type | Example Value |
|---|---|
| String | "John Smith" |
| Number | 42.5 |
| Integer | 100 |
| Boolean | true |
| Date | 2026-02-06 |
| DateTime | 2026-02-06T14:30:00Z |
| List | ["tag1", "tag2"] |
| Map | {"key": "value"} |
Step 5: Set Key Roles
Key roles define how properties participate in identity and referencing.
| Key Role | Abbreviation | Description |
|---|---|---|
| Primary Key | PK | Unique identifier for the node |
| Foreign Key | FK | References a property on another node |
| Natural Key | NK | Business-meaningful unique identifier (e.g. email, ISBN) |
| Surrogate Key | SK | System-generated unique identifier (e.g. UUID, auto-increment) |
| Composite | Composite | Part of a multi-property unique constraint |
Step 6: Add Edges with Cardinality
Step 7: Add Composite Constraints
Composite constraints define uniqueness across multiple properties on a single node. Use these when no single property is unique but a combination is (e.g. firstName + lastName + dateOfBirth).
Step 8: Run Validation
The graph editor validates the schema against its full rule set, covering structural, semantic, domain, and search categories.
| Category | Rules | Description |
|---|---|---|
| Structural (always enforced) | Self-referencing relationships, FK target missing | Detects invalid references and corrupt identifiers |
| Semantic (conceptual + graph-db) | Nodes should have properties, Orphan nodes, Duplicate node labels, Unlabeled relationships | Checks for naming and completeness issues |
| Domain (graph-db only) | Required properties need types, No primary key, Multiple primary keys, Unresolved foreign key | Enforces graph database schema quality rules |
Step 9: Export to Cypher DDL
Step-by-step guide to creating a Data View derived from the central data model. Define entities in model.neoarc, create a Data View, select a profile, pick entities with the entity picker, and inspect properties via the Entity Overlay.