Skip to content

Deal Model DSL

The DealModel DSL defines a declarative structure for modeling, validating, and rendering entertainment deal types. Each element represents a composable building block of a complete deal definition.

Why JSON Schema Matters

Each deal type references a JSON Schema in its inputs block. This schema defines the exact shape of data that instances of the deal will provide at runtime.

JSON Schema enables applications to:

PurposeDescription
FlexibilityEach deal type can define its own unique data model without modifying the DSL grammar.
ValidationEnsures inputs for each deal instance conform to expected structures.
InteroperabilityApplications and APIs can read schemas to understand the required fields, enumerations, and data relationships for any deal type.
ExtensibilitySupports deal-specific data like simple clauses, schedules, or financial parameters, without modifying the base DSL.

Example JSON Schema fragment for simple clauses:

json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "simple_clauses": {
      "type": "object",
      "properties": {
        "headline_billing": {
          "type": "string",
          "minLength": 1,
          "description": "Deal-specific text for headline billing."
        }
      },
      "additionalProperties": false
    }
  }
}

The example above defines how instance data supplies custom text for a simple clause.

Model Header

Every model begins with a header that defines its type and version.

antlr
model { deal_type: "Music Touring Performance Deal", version: 1.0.0 }
FieldTypeDescription
deal_typeTEXT or STRINGHuman-readable identifier for the deal.
versionSEMVERUnquoted Semantic Version for version tracking.

The header defines the canonical identity for versioned distribution, code generation, and documentation.

Inputs

Inputs describe the schema of deal instance data.

antlr
inputs { ref: "https://schemas.example.com/models/music-touring/performance/1.0.0.json" }

Or inline JSON Schema:

antlr
inputs {
  schema: """{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object" }"""
}
ParameterDescription
refURL or key reference to a shared JSON Schema.
schemaInline JSON Schema definition (use triple quotes).

Inputs ensure type safety and validation for all instance-level data provided to the deal runtime.

Overrides

Overrides define model-level template packs for specific clients or contexts.

antlr
overrides {
  templates: """
  { "payout": "For the performance at {{ input('/venue_name') }}, Artist shall be paid {{ money(guarantee_amount, 'USD') }} or {{ percent(pct_nbor) }} of NBOR." }
  """
}
FieldDescription
templatesJSON object defining template override text.

Overrides are applied before per-instance template customizations.

Selectors

Selectors assign readable names to JSON paths or pointers.

antlr
selectors {
  show_revenue: "$.shows[*].revenue"
  fees_path: "$..fees[*]"
}
FieldDescription
nameLogical alias used in expressions (e.g., sum(show_revenue)).
valueJSON path or pointer to source data.

Selectors simplify aggregation and computation expressions.

Variables

Variables represent reusable symbols or expressions.

antlr
var guarantee_amount
var pct_nbor
var nbor = gross_box_office - taxes - fees
ElementDescription
varDeclares a variable binding or computed expression.
nameSymbolic identifier for reuse in computations or conditions.
valueOptional expression assigned to the variable.

Variables act as symbolic placeholders for inputs or derived values.

Operators

Operators define logical or financial relationships for combining clauses.

antlr
operator { name: versus display: "vs" type: or }
FieldDescription
nameIdentifier used in expressions.
displayLabel used in contract output or UI.
typeand (additive) or or (exclusive).

Events

Events describe measurable conditions that activate clauses or blocks.

antlr
event {
  name: nbor_threshold
  description: "NBOR meets or exceeds the required threshold"
  condition: nbor >= nbor_threshold_value
}
FieldDescription
nameEvent identifier.
descriptionHuman-readable description of what triggers the event.
conditionBoolean expression determining when the event becomes true.

Events represent both time-based and performance-based triggers.

Clauses

Clauses define individual contract terms. Clauses are categorized by kind:

KindDescription
simpleTextual only. Renders provided input text via input(); no logic or payout.
guaranteeAlways pays when active; may depend on a deliverable.
contingentPayouts that occur only if an event condition is met.

Example of a simple clause sourcing its text from JSON Schema inputs:

antlr
clause {
  name: headline_billing
  kind: simple
  description: "Deal-specific headline billing text"
  template: """
  {{ input("/simple_clauses/headline_billing") }}
  """
}

Example of a financial clause:

antlr
clause {
  name: guarantee
  kind: guarantee
  description: "Minimum guaranteed payment to the Artist"
  amount: guarantee_amount
  payable: on performance_date
  template: """
  Artist shall be paid a guaranteed fee of {{ money(guarantee_amount, "USD") }}
  for the performance on {{ date(performance_date) }} at {{ input("/venue_name") }}.
  """
}
FieldDescription
nameIdentifier for the clause.
kindType of clause: simple, guarantee, or contingent.
descriptionHuman-readable summary.
whenOptional event guard controlling activation.
amountExpression defining the financial value.
payableReference to when or how payment is due (on <date> or by_schedule <id>).
templateTriple-quoted contract text.

Clause Blocks

Clause Blocks group one or more clauses or other blocks using operators.

antlr
block {
  name: payout
  expr: guarantee versus nbor_share
  template: """
  Artist shall be paid the greater of {{ money(guarantee_amount, "USD") }}
  or {{ percent(pct_nbor) }} of NBOR for the performance on
  {{ date(performance_date) }} at {{ input("/venue_name") }}.
  """
}
FieldDescription
nameBlock identifier.
exprExpression combining clauses or blocks via operators.
templateOptional rendering template for this logical grouping.

Blocks can reference other blocks recursively.

Type

The Type defines the top-level composition of the deal model.

antlr
type {
  name: touring_performance
  compose: payout
  template: """
  The parties agree to the Performance Deal terms as set forth herein.
  """
}
FieldDescription
nameUnique type identifier.
composeRoot clause block or composition expression.
templateOptional contract language for the entire deal.

Computations

Computation Intrinsics

IntrinsicPurpose
amount(name)Evaluates a clause or block amount.
input(path)Reads a value from instance inputs.
sum(path)Aggregates numeric arrays by summation.
count(path)Counts elements at a JSON path.
min(path) / max(path)Retrieves the minimum or maximum numeric value.
plugin(name, ...)Invokes registered custom computation logic.

Computations define derived metrics and outputs.

antlr
computations {
  metric total_show_revenue = sum(show_revenue)
  metric total_fees = sum(fees_path)
  metric nbor_share_amount = pct_nbor * nbor
  output guarantee_value = amount(guarantee)
  output versus_value = amount(payout)
  output total_payout = max(guarantee_value, versus_value)
}
KeywordDescription
metricDefines a derived intermediate value.
outputDefines a named public result.

Example: Music Touring Performance Deal

This is very, very rough, incorrect, and not complete.

antlr
# touring1.dm

model { deal_type: "Music Touring Performance Deal", version: 1.0.0 }

inputs { ref: "https://schemas.example.com/models/music-touring/performance/1.0.0.json" }

selectors {
  show_revenue: "$.shows[*].revenue"
  fees_path: "$..fees[*]"
}

var performance_date
var venue_name
var guarantee_amount
var pct_nbor
var nbor
var nbor_threshold_value

operator { name: versus display: "vs" type: or }

event {
  name: nbor_threshold
  description: "NBOR meets or exceeds the required threshold"
  condition: nbor >= nbor_threshold_value
}

clause {
  name: headline_billing
  kind: simple
  description: "Deal-specific headline billing text"
  template: """
  {{ input("/simple_clauses/headline_billing") }}
  """
}

clause {
  name: guarantee
  kind: guarantee
  description: "Minimum guaranteed payment to the Artist"
  amount: guarantee_amount
  payable: on performance_date
  template: """
  Artist shall be paid a guaranteed fee of {{ money(guarantee_amount, "USD") }}
  for the performance on {{ date(performance_date) }} at {{ input("/venue_name") }}.
  """
}

clause {
  name: nbor_share
  kind: contingent
  description: "Artist share of Net Box Office Receipts"
  when: nbor_threshold
  amount: pct_nbor * nbor
  payable: by_schedule payout_schedule_id
  template: """
  Artist shall be paid {{ percent(pct_nbor) }} of the Net Box Office Receipts (“NBOR”)
  for the performance on {{ date(performance_date) }} at {{ input("/venue_name") }}.
  """
}

block {
  name: payout
  expr: guarantee versus nbor_share
  template: """
  Artist shall be paid the greater of {{ money(guarantee_amount, "USD") }}
  or {{ percent(pct_nbor) }} of NBOR (“Versus Deal”) for the performance on
  {{ date(performance_date) }} at {{ input("/venue_name") }}.
  """
}

type {
  name: touring_performance
  compose: payout
  template: """
  The parties agree to the Performance Deal terms as set forth herein.
  """
}

computations {
  metric total_show_revenue = sum(show_revenue)
  metric total_fees = sum(fees_path)
  metric nbor_share_amount = pct_nbor * nbor
  output guarantee_value = amount(guarantee)
  output versus_value = amount(payout)
  output total_payout = max(guarantee_value, versus_value)
}

Confidential. For internal use only.