Logo
NeoArc Studio

Cypher Export for Neo4j

Export graph diagrams to Neo4j Cypher DDL. Generate node constraints, relationship definitions, and property indexes for deployment to Neo4j databases.

Graph diagrams in Graph DB mode can be exported to Neo4j Cypher DDL (Data Definition Language). The CypherExportService generates constraints, indexes, and sample data creation statements from your schema.

Export Contents

The Cypher export includes several sections:

Example Export

This example shows Cypher output for a simple e-commerce schema with Customer and Order nodes.

// Generated by NeoArc Studio
// Source: ecommerce-schema.graph-diagram.json
// Generated: 2026-02-05T14:30:00Z

// ============================================
// CONSTRAINTS
// ============================================

// Customer constraints
CREATE CONSTRAINT customer_pk IF NOT EXISTS
FOR (n:Customer) REQUIRE n.id IS UNIQUE;

CREATE CONSTRAINT customer_email_unique IF NOT EXISTS
FOR (n:Customer) REQUIRE n.email IS UNIQUE;

// Order constraints
CREATE CONSTRAINT order_pk IF NOT EXISTS
FOR (n:Order) REQUIRE n.id IS UNIQUE;

// ============================================
// INDEXES
// ============================================

CREATE INDEX customer_name_idx IF NOT EXISTS
FOR (n:Customer) ON (n.name);

CREATE INDEX order_customerId_idx IF NOT EXISTS
FOR (n:Order) ON (n.customerId);

CREATE INDEX order_status_idx IF NOT EXISTS
FOR (n:Order) ON (n.status);

// ============================================
// NODE TEMPLATES
// ============================================

// Customer node
// Description: A registered customer in the system
CREATE (n:Customer {
  id: $id,           // uuid, PK, required
  email: $email,     // string, unique, required
  name: $name,       // string, indexed
  createdAt: $createdAt  // datetime
});

// Order node
// Description: A customer order
CREATE (n:Order {
  id: $id,           // uuid, PK, required
  customerId: $customerId,  // uuid, FK -> Customer.id, indexed
  status: $status,   // string, enum: [pending,shipped,delivered], indexed
  total: $total,     // float, min: 0.01
  orderDate: $orderDate  // datetime
});

// ============================================
// RELATIONSHIP TEMPLATES
// ============================================

// Customer -[PLACED]-> Order (1:N)
MATCH (a:Customer {id: $customerId})
MATCH (b:Order {id: $orderId})
CREATE (a)-[:PLACED {date: $date}]->(b);

Constraint Types

NeoArc generates different constraint types based on property configuration.

Property Comments

Exported Cypher includes inline comments documenting each property:

Relationship Export

Edges are exported as relationship templates with their properties and cardinality noted in comments.

// Customer -[PLACED]-> Order (1:N)
// The customer who placed the order
MATCH (a:Customer {id: $customerId})
MATCH (b:Order {id: $orderId})
CREATE (a)-[:PLACED {
  date: $date,       // datetime, required
  channel: $channel  // string, enum: [web,mobile,phone]
}]->(b);

Multi-Label Nodes

Nodes with multiple labels export with all labels in the CREATE statement.

// Person:Employee node
CREATE (n:Person:Employee {
  id: $id,
  name: $name,
  employeeId: $employeeId,
  department: $department
});

Exporting Cypher

Neo4j Compatibility

Exported Cypher uses syntax compatible with Neo4j 4.x and 5.x:

Using Exported Cypher