📋 DomainForge™ Cheat Sheet

Quick reference for common commands.


DSL Validation

1
2
3
4
5
6
7
8
# Type and unit checking
sea validate models/ --type-check --unit-check

# Full validation
sea validate models/ --all

# Single file
sea validate models/finance.sea

Projections

1
2
3
4
5
6
7
8
# Generate all projections
sea project models/ --calm --kg --sbvr --shacl

# Specific projection
sea project models/ --kg --output generated/

# Drift check
sea diff --against main --fail-on-breaking

Oxigraph

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Start
docker-compose up -d oxigraph

# Health check
curl http://localhost:7878/

# SPARQL query
curl -X POST http://localhost:7878/query \
  -H "Content-Type: application/sparql-query" \
  -d "SELECT * WHERE { ?s ?p ?o } LIMIT 10"

# Load triples
curl -X POST http://localhost:7878/store \
  -H "Content-Type: text/turtle" \
  --data-binary @model.ttl

SPARQL Prefixes

1
2
3
4
PREFIX sea: <http://sea-forge.com/schema/core#>
PREFIX sea-debt: <http://sea-forge.com/schema/debt#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

Common Queries

1
2
3
4
5
6
7
8
9
10
11
12
# All entities
SELECT ?e ?name WHERE { ?e a sea:Entity ; rdfs:label ?name }

# All flows
SELECT ?from ?to ?qty WHERE {
  ?f sea:from ?from ; sea:to ?to ; sea:quantity ?qty
}

# Count by type
SELECT ?type (COUNT(*) as ?count) WHERE {
  ?s a ?type
} GROUP BY ?type

DSL Syntax Quick Reference

# Metadata
@namespace "com.example"
@version "1.0.0"

# Dimensions & Units
Dimension "Currency"
Unit "USD" of "Currency" factor 1

# Declarations
Entity "Name" in domain
Resource "Name" unit "USD" in domain
Flow "Name" from "A" to "B" quantity 100 "USD"

# Policies
Policy name per Constraint Obligation priority 5 as:
  <expression>

# Quantifiers
forall x in collection: <expr>
exists x in collection: <expr>

# Aggregations
sum(x in flows where <pred>: x.quantity)
count(x in entities where <pred>)

Error Types

Error Meaning
SyntaxError Grammar issue
TypeError Type mismatch
UnitError Dimension mismatch
ScopeError Unknown identifier

Snapshot Commands

1
2
3
4
5
6
7
8
# Create snapshot
curl -X POST localhost:8000/graph/snapshots -d '{"version":"1.0.0"}'

# List snapshots
curl localhost:8000/graph/snapshots

# Query snapshot
curl -X POST localhost:8000/graph/snapshots/{id}/query -d '{"query":"..."}'