---
title: CREATE Semantic Definitions
url: https://nexyron.tech/docs/cypher/clauses/schema-and-admin/create-abstraction-definitions
description: The abstraction catalog now has direct Cypher DDL for the schema level objects that were previously procedure only:
---

# CREATE Semantic Definitions

## Generic Description

The abstraction catalog now has direct Cypher DDL for the schema-level objects that were previously procedure-only:

-   `CREATE FEATURE`
-   `CREATE INTERVENTION`
-   `CREATE SCENARIO`
-   `CREATE SNAPSHOT`
-   `CREATE SPLIT POLICY`
-   `CREATE DATASET`
-   `CREATE MODEL`
-   `CREATE POLICY`
-   `CREATE ANALYSIS RUN`
-   `CREATE REPORT`

The common shape is:

```cypher
CREATE FEATURE 'actor.base_score' OPTIONS {
  abstraction: 'Member',
  subject_type: 'ACTOR',
  grain: 'actor_day',
  output_type: 'FLOAT',
  as_of_mode: 'snapshot',
  refresh_mode: 'batch',
  query: 'MATCH (u:User) RETURN u.id AS subject_id, 1.0 AS value'
}
```

Analysis-run and report definitions use the same `OPTIONS` shape:

```cypher
CREATE ANALYSIS RUN ChurnSeparabilityRules OPTIONS {
  kind: 'separability_filter',
  lens: 'ChurnInvestigation',
  target_abstraction: 'Member',
  target_feature: 'churned',
  confidence: 0.82,
  segment: 'low_activity',
  reason: 'Low recent activity separates churned members in the current feature snapshot.'
}
```

For analysis runs and reports, Nexyron lifts the stable identity fields out of `OPTIONS` when the definition is stored. `kind` is treated as the artifact subtype, while the catalog object's semantic family remains `ANALYSIS_RUN` or `REPORT`. The lifted fields are `artifact_type`, `status`, `slug`, `description`, `definition`, `content`, `content_type`, `source`, and `query`. Remaining keys stay in the registered options map. List/read procedures expose `content` as its own column instead of duplicating large report or dataset payloads inside `options_json`.

This matters most for generated wiki-style reports. `description`, `definition`, `query`, `slug`, and visible text extracted from `content` are the searchable report identity. For saved wiki reports, `content` is the canonical cards array JSON: each card carries its rendered HTML plus hidden source ids and origins. That avoids storing both a joined HTML blob and a duplicate `cards` option. The semantic embedding path reads visible card HTML and ignores hidden provenance metadata such as card ids, source ids, node ids, and origin maps.

## Consumer-Level Explanation

Use these clauses when the object you are creating is part of the database contract, not just an ad hoc runtime action.

That means:

-   a feature definition belongs in schema
-   a snapshot contract belongs in schema
-   a dataset contract belongs in schema
-   a model contract belongs in schema
-   a policy contract belongs in schema
-   an analysis-run ruleset, scorer, filter, or projector belongs in schema when it should be reusable and executable later
-   a report definition belongs in schema when it should be queryable and reusable from Cypher rather than only stored as UI state

By contrast, actions such as `BUILD`, `MATERIALIZE`, `SERVE`, `DECIDE`, `APPLY`, and `EVALUATE` are still runtime operations and remain procedures.

## Conceptual Explanation

These clauses close the gap between `CREATE ABSTRACTION` and the rest of the abstraction platform.

Before this change, Nexyron already had first-class abstractions in Cypher, but the next layers still had to be declared with `CALL nexyron.*_register(...)`.

Now the abstraction stack has a more coherent DDL story:

-   abstractions are schema
-   abstraction definitions built on top of abstractions are also schema
-   execution against those definitions is runtime
-   lens abstractions capture durable viewpoints, while analysis runs capture executable rules or scoring definitions

That split is the logical one.

## Advanced Example

```cypher
CREATE SNAPSHOT actor_daily_snapshot OPTIONS {
  subject_type: 'ACTOR',
  subject_abstraction: 'Member',
  grain: 'actor_day',
  as_of_mode: 'snapshot',
  features: ['actor.base_score', 'actor.visit_gap_30d']
};

CREATE DATASET training_set OPTIONS {
  snapshot: 'actor_daily_snapshot',
  label_query: 'MATCH (u:User) RETURN u.id AS subject_id, CASE WHEN u.status = \"churned\" THEN 1 ELSE 0 END AS value',
  split_policy: 'random_holdout',
  status: 'active'
};

CREATE MODEL churn_linear_v1 OPTIONS {
  snapshot: 'actor_daily_snapshot',
  model_kind: 'linear',
  output_type: 'FLOAT',
  score_mode: 'logistic',
  bias: 0.0,
  weights: [{feature: 'actor.base_score', weight: 1.0}],
  version: 70,
  status: 'active'
};

CREATE POLICY email_high_risk OPTIONS {
  model: 'churn_linear_v1',
  intervention: 'RetentionEmail',
  action_type: 'retention_email',
  max_actions: 500,
  status: 'active'
};

CREATE REPORT churn_investigation_summary OPTIONS {
  kind: 'semantic_search_wiki_report',
  slug: 'churn-investigation-summary',
  definition: 'Churn investigation summary',
  description: 'A generated report explaining behavioral dropout and churn risk.',
  content_type: 'application/vnd.nexyron.semantic-search-wiki-report.cards+json',
  content: '[{"card_id":"wiki_123:card:cover","row_role":"cover","html":"<article class=\"search-row layout-full\"><h2 class=\"row-title\">Churn investigation summary</h2></article>","source_item_ids":["knowledge_abstraction:ChurnRisk"],"origins":{"observed_business_data":{"nodes":[],"edges":[]},"abstractions":["ChurnRisk"]}}]',
  source: 'client_semantic_search',
  lens: 'ChurnInvestigation',
  analysis_run: 'ChurnSeparabilityRules',
  abstraction_selection: ['Member'],
  status: 'draft'
};
```

## Real Use Cases

-   Define abstraction assets in migration files instead of burying them inside application startup code.
-   Review feature and policy contracts in the same Cypher-oriented workflow as other schema changes.
-   Keep abstraction platform declarations readable to database-first users who expect `CREATE ...` syntax.
-   Persist separability rules as `ANALYSIS_RUN` definitions so applying the rules later does not require a new LLM call.
-   Store reusable report contracts in the target database when a report should be part of the abstraction graph contract instead of only a private Studio layout.

## Real Limitations And Tradeoffs

-   The `OPTIONS { ... }` map is intentionally a literal schema payload. It is not a free-form runtime expression language.
-   These clauses create catalog objects. They do not build snapshots, materialize datasets, score models, or apply policies.
-   `CREATE ANALYSIS RUN` stores executable abstraction metadata. The initial built-in application path exposes deterministic fields from the stored analysis-run metadata; fuller analysis-run engines can extend the same catalog object without changing the public DDL.
-   `CREATE REPORT` stores a report definition. First-class report text such as `description`, `definition`, `query`, and visible card text from `content` is indexed for semantic rediscovery. Generated wiki reports should store their card list in `content`; internal card provenance stays inside each card block and is ignored for semantic identity.
-   `CREATE ...` here preserves schema-style semantics: it is for declaration, not silent replacement. Use `IF NOT EXISTS` when that behavior is what you want.
