Logo
NeoArc Studio

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 ModePurposeFeatures
MindmapQuick brainstorming and idea mappingSimple labels, no properties
ConceptualHigh-level entity relationship modellingLabels, basic properties, relationship names
Graph DBFull graph database schema designTyped 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 TypeExample Value
String"John Smith"
Number42.5
Integer100
Booleantrue
Date2026-02-06
DateTime2026-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 RoleAbbreviationDescription
Primary KeyPKUnique identifier for the node
Foreign KeyFKReferences a property on another node
Natural KeyNKBusiness-meaningful unique identifier (e.g. email, ISBN)
Surrogate KeySKSystem-generated unique identifier (e.g. UUID, auto-increment)
CompositeCompositePart 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.

CategoryRulesDescription
Structural (always enforced)Self-referencing relationships, FK target missingDetects invalid references and corrupt identifiers
Semantic (conceptual + graph-db)Nodes should have properties, Orphan nodes, Duplicate node labels, Unlabeled relationshipsChecks for naming and completeness issues
Domain (graph-db only)Required properties need types, No primary key, Multiple primary keys, Unresolved foreign keyEnforces graph database schema quality rules

Step 9: Export to Cypher DDL