Logo
NeoArc Studio

Exporting Schemas

Export data model entities to 24 schema formats: 12 SQL DDL dialects, 7 schema definition languages (GraphQL SDL, TypeScript, Prisma, Avro, Protobuf, DBML, Mongoose), 3 graph/document formats, 3 diagram notations, and GraphML.

NeoArc Studio exports data model entities to 24 schema formats across 5 categories. The unified Schema Export dialog provides format selection, multi-select group filtering, a syntax-highlighted preview, and options to copy to clipboard or download as a file.

Export Workflow

SQL DDL Export (12 Dialects)

SQL DDL export generates production-ready database scripts. Each dialect uses the correct data types, naming conventions, and constraint syntax for the target database engine.

Generated SQL Elements

Dialect Details

PostgreSQL Example

-- Generated by NeoArc Studio
-- Source: model.neoarc

CREATE TABLE customers (
  id UUID PRIMARY KEY,
  email VARCHAR(255) NOT NULL UNIQUE,
  name VARCHAR(100),
  created_at TIMESTAMP DEFAULT NOW()
);

CREATE TABLE orders (
  id UUID PRIMARY KEY,
  customer_id UUID NOT NULL,
  total DECIMAL(10, 2) NOT NULL,
  status VARCHAR(20) DEFAULT 'pending',
  order_date TIMESTAMP DEFAULT NOW()
);

ALTER TABLE orders
  ADD CONSTRAINT fk_orders_customer_id
  FOREIGN KEY (customer_id) REFERENCES customers(id);

CREATE INDEX idx_orders_customer_id ON orders(customer_id);
CREATE INDEX idx_orders_status ON orders(status);

Schema Definition Export (7 Formats)

Export model entities to schema definition languages used in application development.

GraphQL SDL

Generates GraphQL Schema Definition Language with type definitions, required fields (using !), and relationship references using [Type!] array syntax.

# Generated by NeoArc Studio

type Customer {
  id: ID!
  email: String!
  name: String
  createdAt: DateTime
  orders: [Order!]
}

type Order {
  id: ID!
  customerId: ID!
  total: Float!
  status: String
  orderDate: DateTime
  customer: Customer!
}

TypeScript Interfaces

Generates TypeScript interface definitions with optional properties (using ?) and union type enums.

// Generated by NeoArc Studio

export interface Customer {
  id: string;
  email: string;
  name?: string;
  createdAt?: Date;
}

export interface Order {
  id: string;
  customerId: string;
  total: number;
  status?: 'pending' | 'shipped' | 'delivered';
  orderDate?: Date;
}

DBML

Generates Database Markup Language with Table blocks, column settings ([pk, not null]), and Ref: lines for foreign key relationships.

// Generated by NeoArc Studio

Table customers {
  id uuid [pk]
  email varchar [not null, unique]
  name varchar
  created_at timestamp [default: `now()`]
}

Table orders {
  id uuid [pk]
  customer_id uuid [not null]
  total decimal [not null]
  status varchar [default: 'pending']
  order_date timestamp [default: `now()`]
}

Ref: orders.customer_id > customers.id

Prisma Schema

Generates Prisma model blocks with @id, @relation, and field type annotations compatible with Prisma ORM.

// Generated by NeoArc Studio

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model Customer {
  id        String   @id @default(uuid())
  email     String   @unique
  name      String?
  createdAt DateTime @default(now())
  orders    Order[]
}

model Order {
  id         String   @id @default(uuid())
  customerId String
  total      Decimal
  status     String?  @default("pending")
  orderDate  DateTime @default(now())
  customer   Customer @relation(fields: [customerId], references: [id])
}

Apache Avro

Generates Avro Protocol with record types and union nullability for optional fields.

{
  "protocol": "NeoArcSchema",
  "namespace": "com.example",
  "types": [
    {
      "type": "record",
      "name": "Customer",
      "fields": [
        {"name": "id", "type": "string"},
        {"name": "email", "type": "string"},
        {"name": "name", "type": ["null", "string"], "default": null},
        {"name": "createdAt", "type": ["null", "long"], "default": null}
      ]
    }
  ]
}

Protocol Buffers

Generates Protobuf message blocks with sequential field numbers and optional annotations for nullable fields.

// Generated by NeoArc Studio
syntax = "proto3";

package schema;

message Customer {
  string id = 1;
  string email = 2;
  optional string name = 3;
  optional int64 created_at = 4;
}

message Order {
  string id = 1;
  string customer_id = 2;
  double total = 3;
  optional string status = 4;
  optional int64 order_date = 5;
}

Mongoose Schema

Generates Mongoose schema definitions with new Schema({}), validation options, and ObjectId references for relationships.

// Generated by NeoArc Studio
const mongoose = require('mongoose');

const CustomerSchema = new mongoose.Schema({
  id: { type: String, required: true, unique: true },
  email: { type: String, required: true, unique: true },
  name: { type: String },
  createdAt: { type: Date, default: Date.now }
});

const OrderSchema = new mongoose.Schema({
  id: { type: String, required: true, unique: true },
  customerId: { type: mongoose.Schema.Types.ObjectId, ref: 'Customer', required: true },
  total: { type: Number, required: true },
  status: { type: String, default: 'pending' },
  orderDate: { type: Date, default: Date.now }
});

Graph and Document Export (3 Formats)

Neo4j Cypher DDL

Generates Cypher statements for creating constraints, indexes, node templates, and relationship patterns. Compatible with Neo4j 4.x and 5.x. For detailed documentation, see the dedicated Cypher Export guide.

JSON Schema (draft-07)

Generates JSON Schema with $defs entries for each entity, typed properties, required arrays, and constraint annotations.

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "NeoArc Schema",
  "$defs": {
    "Customer": {
      "type": "object",
      "properties": {
        "id": { "type": "string", "format": "uuid" },
        "email": { "type": "string" },
        "name": { "type": "string" }
      },
      "required": ["id", "email"]
    }
  }
}

NeoArc JSON

Exports in the native NeoArc graph format via the diagramming-core library. Useful for programmatic consumption or backup.

Diagram Notation Export (3 Formats)

Mermaid ERD

Generates Mermaid erDiagram syntax with entity blocks, typed attributes, and cardinality lines.

erDiagram
    Customer {
        uuid id PK
        string email
        string name
        datetime createdAt
    }
    Order {
        uuid id PK
        uuid customerId FK
        float total
        string status
        datetime orderDate
    }
    Customer ||--o{ Order : "places"

PlantUML ERD

Generates PlantUML entity blocks with stereotypes, typed fields, and relationship lines.

@startuml

entity "Customer" as Customer {
  * id : uuid <<PK>>
  --
  * email : string <<unique>>
  name : string
  createdAt : datetime
}

entity "Order" as Order {
  * id : uuid <<PK>>
  --
  * customerId : uuid <<FK>>
  * total : float
  status : string
  orderDate : datetime
}

Customer ||--o{ Order

@enduml

XML Schema (XSD)

Generates XML Schema Definition with complex types, elements, and restrictions for validation.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="Customer">
    <xs:sequence>
      <xs:element name="id" type="xs:string"/>
      <xs:element name="email" type="xs:string"/>
      <xs:element name="name" type="xs:string" minOccurs="0"/>
      <xs:element name="createdAt" type="xs:dateTime" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

Graph Exchange Export (GraphML)

Generates GraphML XML with <node> and <edge> elements, property data keys, and attribute values. GraphML files can be imported into tools such as yEd, Gephi, and NetworkX.

Group Filtering

The export dialog includes a multi-select group filter for targeting specific subdomains of the model.

Common Export Architecture

All non-SQL export services share a common interface, making the export process consistent across formats.

interface SchemaExportOptions {
  nodes: GraphNode[];
  edges: GraphEdge[];
  compositeConstraints: GraphCompositeConstraint[];
  title?: string;
}

The resolveSimpleType() helper normalises parameterised type names (e.g., varchar(255) to string) for consistent type mapping across all export services. SQL DDL export additionally uses the DatabaseProfileService for dialect-specific type resolution and naming conventions.

Related