UJG / Editor's Draft /
GitHub
Table of Contents
  • 1Overview
  • 2Terminology
  • 3Scenario
  • 4Step
  • 5Sequence Semantics
  • 6Vocabulary
  • 7Normative Artifacts
    • 7.1Ontology
    • 7.2JSON-LD Context
    • 7.3Validation
  • 8Examples
    • 8.1Ordered Experiences With a Repeated Subject
    • 8.2Reusing a Nested Scenario
W3C Community Group Draft Report

Scenario

draft

Status of this Document

This report was published by the User Journey Graph Community Group . It is not a W3C Standard nor is it on the W3C Standards Track. Please note that under the W3C Community Contributor License Agreement (CLA) there is a limited opt-out and other conditions apply. Learn more about W3C Community and Business Groups .

Last Update
2026-12-03
Editors
  • Seva Dolgopolov
Group
User Journey Graph Community Group
Repository
View Source
License
W3C-Software-and-Document

1. Overview

This optional module defines ordered, reusable compositions of intended Graph experiences.

A Scenario represents a sequence of Steps. A Step identifies an experienced CompositeState or another Scenario.

The module depends directly on [UJG Graph] and introduces no additional traversal semantics. Documents using this module compose the Core and Graph contexts with https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld.

2. Terminology

  • Scenario: An ordered, reusable composition of intended Graph experiences.

  • Step: One intended experience of a CompositeState or a Scenario within a containing Scenario.

3. Scenario

  1. A Scenario MUST be identified by an IRI.

  2. A Scenario groups the Steps whose scenario references it.

  3. A Scenario MUST contain at least one Step.

  4. A Scenario MAY be referenced by multiple Steps.

  5. Recursive Scenario references MUST NOT form cycles.

Membership is derived from the Steps' scenario references; a Scenario does not serialize a collection of Steps.

Example node:

YAML-LD

yaml
id: urn:ujg:scenario:checkout
type: Scenario
id: urn:ujg:scenario:checkout
type: Scenario

JSON-LD

json
{
  "id": "urn:ujg:scenario:checkout",
  "type": "Scenario"
}
{
  "id": "urn:ujg:scenario:checkout",
  "type": "Scenario"
}

4. Step

  1. A Step MUST be identified by an IRI.

  2. A Step MUST declare exactly one scenario referencing its containing Scenario.

  3. A Step MUST declare exactly one subject referencing either a CompositeState or a Scenario.

  4. A Step MAY declare at most one previous referencing a Step within the same containing Scenario.

  5. A Step without previous is the root Step.

classDiagram
  class Scenario
  class CompositeState
  class Step {
    id
    scenario
    subject
    previous
  }
  Step --> "1" Scenario : scenario
  Step --> "1" CompositeState : subject (alternative)
  Step --> "1" Scenario : subject (alternative)
  Step --> "0..1" Step : previous

Example node:

YAML-LD

yaml
id: urn:ujg:step:enter-shipping
type: Step
scenario: urn:ujg:scenario:checkout
subject: urn:ujg:state:shipping-segment
id: urn:ujg:step:enter-shipping
type: Step
scenario: urn:ujg:scenario:checkout
subject: urn:ujg:state:shipping-segment

JSON-LD

json
{
  "id": "urn:ujg:step:enter-shipping",
  "type": "Step",
  "scenario": "urn:ujg:scenario:checkout",
  "subject": "urn:ujg:state:shipping-segment"
}
{
  "id": "urn:ujg:step:enter-shipping",
  "type": "Step",
  "scenario": "urn:ujg:scenario:checkout",
  "subject": "urn:ujg:state:shipping-segment"
}

5. Sequence Semantics

  1. Each Scenario MUST have exactly one root Step.

  2. All Steps within a Scenario MUST form a single connected, acyclic chain.

  3. Each Step MUST NOT have more than one successor.

  4. A Step referencing a Scenario represents the complete sequence of that Scenario.

  5. Each Step represents a distinct intended experience of its subject.

  6. Each Step is intended to follow completion of its predecessor.

  7. Scenario sequencing MUST NOT create Graph traversal, alter transition semantics or select child journey entries.

  8. Scenario sequencing describes intended progression, not Runtime event order.

Consumers reconstruct the sequence from previous links rather than serialized node order. Separate Steps may reference the same CompositeState or reuse the same Scenario. Each such Step remains a distinct intended experience. A referenced CompositeState retains its Graph semantics, including the independence of its child journeys; Scenario sequencing does not order those child journeys.

6. Vocabulary

PropertyDomainRangeCardinality
scenarioStepScenario1
subjectStepCompositeState or Scenario1
previousStepStep0..1

Consumers that do not implement this module MAY ignore Scenario semantics while preserving its RDF data.

7. Normative Artifacts

7.1. Ontology

The Scenario ontology is published at https://ujg.specs.openuji.org/ed/ns/scenario.

turtle
@prefix ujg: <https://ujg.specs.openuji.org/ed/ns/core#> .
@prefix ujggraph: <https://ujg.specs.openuji.org/ed/ns/graph#> .
@prefix ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dct: <http://purl.org/dc/terms/> .

<https://ujg.specs.openuji.org/ed/ns/scenario#> a owl:Ontology ;
  rdfs:label "UJG Scenario Editor's Draft Vocabulary"@en ;
  dct:description "Ordered, reusable compositions of intended Graph experiences"@en .

### Classes

ujgscenario:Scenario a owl:Class ;
  rdfs:subClassOf ujg:Node .

ujgscenario:Step a owl:Class ;
  rdfs:subClassOf ujg:Node .

### Properties

ujgscenario:scenario a owl:ObjectProperty ;
  rdfs:domain ujgscenario:Step ;
  rdfs:range ujgscenario:Scenario .

ujgscenario:subject a owl:ObjectProperty ;
  rdfs:domain ujgscenario:Step ;
  rdfs:range [
    a owl:Class ;
    owl:unionOf (
      ujggraph:CompositeState
      ujgscenario:Scenario
    )
  ] .

ujgscenario:previous a owl:ObjectProperty ;
  rdfs:domain ujgscenario:Step ;
  rdfs:range ujgscenario:Step .
@prefix ujg: <https://ujg.specs.openuji.org/ed/ns/core#> .
@prefix ujggraph: <https://ujg.specs.openuji.org/ed/ns/graph#> .
@prefix ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dct: <http://purl.org/dc/terms/> .

<https://ujg.specs.openuji.org/ed/ns/scenario#> a owl:Ontology ;
  rdfs:label "UJG Scenario Editor's Draft Vocabulary"@en ;
  dct:description "Ordered, reusable compositions of intended Graph experiences"@en .

### Classes

ujgscenario:Scenario a owl:Class ;
  rdfs:subClassOf ujg:Node .

ujgscenario:Step a owl:Class ;
  rdfs:subClassOf ujg:Node .

### Properties

ujgscenario:scenario a owl:ObjectProperty ;
  rdfs:domain ujgscenario:Step ;
  rdfs:range ujgscenario:Scenario .

ujgscenario:subject a owl:ObjectProperty ;
  rdfs:domain ujgscenario:Step ;
  rdfs:range [
    a owl:Class ;
    owl:unionOf (
      ujggraph:CompositeState
      ujgscenario:Scenario
    )
  ] .

ujgscenario:previous a owl:ObjectProperty ;
  rdfs:domain ujgscenario:Step ;
  rdfs:range ujgscenario:Step .

7.2. JSON-LD Context

The Scenario context is published at https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld.

json-ld
{
  "@context": {
    "@version": 1.1,
    "ujgscenario": "https://ujg.specs.openuji.org/ed/ns/scenario#",
    "Scenario": "ujgscenario:Scenario",
    "Step": "ujgscenario:Step",
    "scenario": {
      "@id": "ujgscenario:scenario",
      "@type": "@id"
    },
    "subject": {
      "@id": "ujgscenario:subject",
      "@type": "@id"
    },
    "previous": {
      "@id": "ujgscenario:previous",
      "@type": "@id"
    }
  }
}
{
  "@context": {
    "@version": 1.1,
    "ujgscenario": "https://ujg.specs.openuji.org/ed/ns/scenario#",
    "Scenario": "ujgscenario:Scenario",
    "Step": "ujgscenario:Step",
    "scenario": {
      "@id": "ujgscenario:scenario",
      "@type": "@id"
    },
    "subject": {
      "@id": "ujgscenario:subject",
      "@type": "@id"
    },
    "previous": {
      "@id": "ujgscenario:previous",
      "@type": "@id"
    }
  }
}

7.3. Validation

The Scenario SHACL shape is published at https://ujg.specs.openuji.org/ed/ns/scenario.shape. Constraints apply to the resolved document closure, including imported definitions.

turtle
@prefix ujggraph: <https://ujg.specs.openuji.org/ed/ns/graph#> .
@prefix ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#> .
@prefix ujgscenarioshape: <https://ujg.specs.openuji.org/ed/ns/scenario.shape#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

ujgscenarioshape:ScenarioShape a sh:NodeShape ;
  sh:targetClass ujgscenario:Scenario ;
  sh:nodeKind sh:IRI ;

  sh:property [
    sh:path [ sh:inversePath ujgscenario:scenario ] ;
    sh:class ujgscenario:Step ;
    sh:nodeKind sh:IRI ;
    sh:minCount 1 ;
    sh:message "A Scenario must contain at least one Step." ;
  ] ;

  sh:property [
    sh:path [ sh:inversePath ujgscenario:scenario ] ;
    sh:qualifiedValueShape [
      sh:property [
        sh:path ujgscenario:previous ;
        sh:maxCount 0 ;
      ] ;
    ] ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedMaxCount 1 ;
    sh:message "A Scenario must have exactly one root Step without previous." ;
  ] ;

  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "Every Step must be connected to the root of its containing Scenario through previous links." ;
    sh:select """
      PREFIX ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#>
      SELECT $this ?step
      WHERE {
        ?step ujgscenario:scenario $this .
        FILTER NOT EXISTS {
          ?step ujgscenario:previous* ?root .
          ?root ujgscenario:scenario $this .
          FILTER NOT EXISTS { ?root ujgscenario:previous ?predecessor . }
        }
      }
    """ ;
  ] ;

  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "Recursive Scenario references must not form cycles." ;
    sh:select """
      PREFIX ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#>
      SELECT $this
      WHERE {
        $this (^ujgscenario:scenario/ujgscenario:subject)+ $this .
      }
    """ ;
  ] .

ujgscenarioshape:StepShape a sh:NodeShape ;
  sh:targetClass ujgscenario:Step ;
  sh:nodeKind sh:IRI ;

  sh:property [
    sh:path ujgscenario:scenario ;
    sh:class ujgscenario:Scenario ;
    sh:nodeKind sh:IRI ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
  ] ;

  sh:property [
    sh:path ujgscenario:subject ;
    sh:or (
      [ sh:class ujggraph:CompositeState ]
      [ sh:class ujgscenario:Scenario ]
    ) ;
    sh:nodeKind sh:IRI ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
  ] ;

  sh:property [
    sh:path ujgscenario:previous ;
    sh:class ujgscenario:Step ;
    sh:nodeKind sh:IRI ;
    sh:maxCount 1 ;
  ] ;

  sh:property [
    sh:path [ sh:inversePath ujgscenario:previous ] ;
    sh:maxCount 1 ;
    sh:message "A Step must not have more than one successor." ;
  ] ;

  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "A Step's previous must reference a Step in the same containing Scenario." ;
    sh:select """
      PREFIX ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#>
      SELECT $this ?previous
      WHERE {
        $this ujgscenario:scenario ?scenario ;
              ujgscenario:previous ?previous .
        FILTER NOT EXISTS { ?previous ujgscenario:scenario ?scenario . }
      }
    """ ;
  ] ;

  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "Step previous links must not form cycles." ;
    sh:select """
      PREFIX ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#>
      SELECT $this
      WHERE {
        $this ujgscenario:previous+ $this .
      }
    """ ;
  ] .
@prefix ujggraph: <https://ujg.specs.openuji.org/ed/ns/graph#> .
@prefix ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#> .
@prefix ujgscenarioshape: <https://ujg.specs.openuji.org/ed/ns/scenario.shape#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

ujgscenarioshape:ScenarioShape a sh:NodeShape ;
  sh:targetClass ujgscenario:Scenario ;
  sh:nodeKind sh:IRI ;

  sh:property [
    sh:path [ sh:inversePath ujgscenario:scenario ] ;
    sh:class ujgscenario:Step ;
    sh:nodeKind sh:IRI ;
    sh:minCount 1 ;
    sh:message "A Scenario must contain at least one Step." ;
  ] ;

  sh:property [
    sh:path [ sh:inversePath ujgscenario:scenario ] ;
    sh:qualifiedValueShape [
      sh:property [
        sh:path ujgscenario:previous ;
        sh:maxCount 0 ;
      ] ;
    ] ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedMaxCount 1 ;
    sh:message "A Scenario must have exactly one root Step without previous." ;
  ] ;

  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "Every Step must be connected to the root of its containing Scenario through previous links." ;
    sh:select """
      PREFIX ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#>
      SELECT $this ?step
      WHERE {
        ?step ujgscenario:scenario $this .
        FILTER NOT EXISTS {
          ?step ujgscenario:previous* ?root .
          ?root ujgscenario:scenario $this .
          FILTER NOT EXISTS { ?root ujgscenario:previous ?predecessor . }
        }
      }
    """ ;
  ] ;

  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "Recursive Scenario references must not form cycles." ;
    sh:select """
      PREFIX ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#>
      SELECT $this
      WHERE {
        $this (^ujgscenario:scenario/ujgscenario:subject)+ $this .
      }
    """ ;
  ] .

ujgscenarioshape:StepShape a sh:NodeShape ;
  sh:targetClass ujgscenario:Step ;
  sh:nodeKind sh:IRI ;

  sh:property [
    sh:path ujgscenario:scenario ;
    sh:class ujgscenario:Scenario ;
    sh:nodeKind sh:IRI ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
  ] ;

  sh:property [
    sh:path ujgscenario:subject ;
    sh:or (
      [ sh:class ujggraph:CompositeState ]
      [ sh:class ujgscenario:Scenario ]
    ) ;
    sh:nodeKind sh:IRI ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
  ] ;

  sh:property [
    sh:path ujgscenario:previous ;
    sh:class ujgscenario:Step ;
    sh:nodeKind sh:IRI ;
    sh:maxCount 1 ;
  ] ;

  sh:property [
    sh:path [ sh:inversePath ujgscenario:previous ] ;
    sh:maxCount 1 ;
    sh:message "A Step must not have more than one successor." ;
  ] ;

  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "A Step's previous must reference a Step in the same containing Scenario." ;
    sh:select """
      PREFIX ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#>
      SELECT $this ?previous
      WHERE {
        $this ujgscenario:scenario ?scenario ;
              ujgscenario:previous ?previous .
        FILTER NOT EXISTS { ?previous ujgscenario:scenario ?scenario . }
      }
    """ ;
  ] ;

  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "Step previous links must not form cycles." ;
    sh:select """
      PREFIX ujgscenario: <https://ujg.specs.openuji.org/ed/ns/scenario#>
      SELECT $this
      WHERE {
        $this ujgscenario:previous+ $this .
      }
    """ ;
  ] .

8. Examples

8.1. Ordered Experiences With a Repeated Subject

The checkout Scenario experiences shipping, payment, and shipping again. Its sequence does not require a Graph transition between those subjects.

YAML-LD

yaml
"@context":
  - https://ujg.specs.openuji.org/ed/ns/core.context.jsonld
  - https://ujg.specs.openuji.org/ed/ns/graph.context.jsonld
  - https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld
  - "@base": https://example.com/ujg/scenario/checkout
id: ""
type: UJGDocument
nodes:
  - id: "#checkout-page"
    type: Journey
    entries:
      - id: "#checkout-entry"
        type: JourneyEntry
        state: "#shipping"
      - id: "#payment-page-entry"
        type: JourneyEntry
        state: "#payment"
    states:
      - id: "#shipping"
        type: CompositeState
        label: Shipping
        subjourneys:
          - id: "#shipping-journey"
            type: Journey
            entries:
              - id: "#shipping-entry"
                type: JourneyEntry
                state: "#shipping-form"
            states:
              - id: "#shipping-form"
                type: State
                label: Shipping form
      - id: "#payment"
        type: CompositeState
        label: Payment
        subjourneys:
          - id: "#payment-journey"
            type: Journey
            entries:
              - id: "#payment-entry"
                type: JourneyEntry
                state: "#payment-form"
            states:
              - id: "#payment-form"
                type: State
                label: Payment form
  - id: "#checkout"
    type: Scenario
  - id: "#enter-shipping"
    type: Step
    scenario: "#checkout"
    subject: "#shipping"
  - id: "#enter-payment"
    type: Step
    scenario: "#checkout"
    subject: "#payment"
    previous: "#enter-shipping"
  - id: "#review-shipping"
    type: Step
    scenario: "#checkout"
    subject: "#shipping"
    previous: "#enter-payment"
"@context":
  - https://ujg.specs.openuji.org/ed/ns/core.context.jsonld
  - https://ujg.specs.openuji.org/ed/ns/graph.context.jsonld
  - https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld
  - "@base": https://example.com/ujg/scenario/checkout
id: ""
type: UJGDocument
nodes:
  - id: "#checkout-page"
    type: Journey
    entries:
      - id: "#checkout-entry"
        type: JourneyEntry
        state: "#shipping"
      - id: "#payment-page-entry"
        type: JourneyEntry
        state: "#payment"
    states:
      - id: "#shipping"
        type: CompositeState
        label: Shipping
        subjourneys:
          - id: "#shipping-journey"
            type: Journey
            entries:
              - id: "#shipping-entry"
                type: JourneyEntry
                state: "#shipping-form"
            states:
              - id: "#shipping-form"
                type: State
                label: Shipping form
      - id: "#payment"
        type: CompositeState
        label: Payment
        subjourneys:
          - id: "#payment-journey"
            type: Journey
            entries:
              - id: "#payment-entry"
                type: JourneyEntry
                state: "#payment-form"
            states:
              - id: "#payment-form"
                type: State
                label: Payment form
  - id: "#checkout"
    type: Scenario
  - id: "#enter-shipping"
    type: Step
    scenario: "#checkout"
    subject: "#shipping"
  - id: "#enter-payment"
    type: Step
    scenario: "#checkout"
    subject: "#payment"
    previous: "#enter-shipping"
  - id: "#review-shipping"
    type: Step
    scenario: "#checkout"
    subject: "#shipping"
    previous: "#enter-payment"

JSON-LD

json
{
  "@context": [
    "https://ujg.specs.openuji.org/ed/ns/core.context.jsonld",
    "https://ujg.specs.openuji.org/ed/ns/graph.context.jsonld",
    "https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld",
    {
      "@base": "https://example.com/ujg/scenario/checkout"
    }
  ],
  "id": "",
  "type": "UJGDocument",
  "nodes": [
    {
      "id": "#checkout-page",
      "type": "Journey",
      "entries": [
        {
          "id": "#checkout-entry",
          "type": "JourneyEntry",
          "state": "#shipping"
        },
        {
          "id": "#payment-page-entry",
          "type": "JourneyEntry",
          "state": "#payment"
        }
      ],
      "states": [
        {
          "id": "#shipping",
          "type": "CompositeState",
          "label": "Shipping",
          "subjourneys": [
            {
              "id": "#shipping-journey",
              "type": "Journey",
              "entries": [
                {
                  "id": "#shipping-entry",
                  "type": "JourneyEntry",
                  "state": "#shipping-form"
                }
              ],
              "states": [
                {
                  "id": "#shipping-form",
                  "type": "State",
                  "label": "Shipping form"
                }
              ]
            }
          ]
        },
        {
          "id": "#payment",
          "type": "CompositeState",
          "label": "Payment",
          "subjourneys": [
            {
              "id": "#payment-journey",
              "type": "Journey",
              "entries": [
                {
                  "id": "#payment-entry",
                  "type": "JourneyEntry",
                  "state": "#payment-form"
                }
              ],
              "states": [
                {
                  "id": "#payment-form",
                  "type": "State",
                  "label": "Payment form"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": "#checkout",
      "type": "Scenario"
    },
    {
      "id": "#enter-shipping",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#shipping"
    },
    {
      "id": "#enter-payment",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#payment",
      "previous": "#enter-shipping"
    },
    {
      "id": "#review-shipping",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#shipping",
      "previous": "#enter-payment"
    }
  ]
}
{
  "@context": [
    "https://ujg.specs.openuji.org/ed/ns/core.context.jsonld",
    "https://ujg.specs.openuji.org/ed/ns/graph.context.jsonld",
    "https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld",
    {
      "@base": "https://example.com/ujg/scenario/checkout"
    }
  ],
  "id": "",
  "type": "UJGDocument",
  "nodes": [
    {
      "id": "#checkout-page",
      "type": "Journey",
      "entries": [
        {
          "id": "#checkout-entry",
          "type": "JourneyEntry",
          "state": "#shipping"
        },
        {
          "id": "#payment-page-entry",
          "type": "JourneyEntry",
          "state": "#payment"
        }
      ],
      "states": [
        {
          "id": "#shipping",
          "type": "CompositeState",
          "label": "Shipping",
          "subjourneys": [
            {
              "id": "#shipping-journey",
              "type": "Journey",
              "entries": [
                {
                  "id": "#shipping-entry",
                  "type": "JourneyEntry",
                  "state": "#shipping-form"
                }
              ],
              "states": [
                {
                  "id": "#shipping-form",
                  "type": "State",
                  "label": "Shipping form"
                }
              ]
            }
          ]
        },
        {
          "id": "#payment",
          "type": "CompositeState",
          "label": "Payment",
          "subjourneys": [
            {
              "id": "#payment-journey",
              "type": "Journey",
              "entries": [
                {
                  "id": "#payment-entry",
                  "type": "JourneyEntry",
                  "state": "#payment-form"
                }
              ],
              "states": [
                {
                  "id": "#payment-form",
                  "type": "State",
                  "label": "Payment form"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": "#checkout",
      "type": "Scenario"
    },
    {
      "id": "#enter-shipping",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#shipping"
    },
    {
      "id": "#enter-payment",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#payment",
      "previous": "#enter-shipping"
    },
    {
      "id": "#review-shipping",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#shipping",
      "previous": "#enter-payment"
    }
  ]
}

8.2. Reusing a Nested Scenario

Two distinct Steps in the checkout Scenario reference the same address Scenario. Each represents that Scenario's complete sequence before the following Step begins.

YAML-LD

yaml
"@context":
  - https://ujg.specs.openuji.org/ed/ns/core.context.jsonld
  - https://ujg.specs.openuji.org/ed/ns/graph.context.jsonld
  - https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld
  - "@base": https://example.com/ujg/scenario/reuse
id: ""
type: UJGDocument
nodes:
  - id: "#account"
    type: Journey
    entries:
      - id: "#account-entry"
        type: JourneyEntry
        state: "#address-form"
    states:
      - id: "#address-form"
        type: CompositeState
        label: Address form
        subjourneys:
          - id: "#address-journey"
            type: Journey
            entries:
              - id: "#address-entry"
                type: JourneyEntry
                state: "#address-fields"
            states:
              - id: "#address-fields"
                type: State
                label: Address fields
  - id: "#address"
    type: Scenario
  - id: "#enter-address"
    type: Step
    scenario: "#address"
    subject: "#address-form"
  - id: "#checkout"
    type: Scenario
  - id: "#shipping-address"
    type: Step
    scenario: "#checkout"
    subject: "#address"
  - id: "#billing-address"
    type: Step
    scenario: "#checkout"
    subject: "#address"
    previous: "#shipping-address"
"@context":
  - https://ujg.specs.openuji.org/ed/ns/core.context.jsonld
  - https://ujg.specs.openuji.org/ed/ns/graph.context.jsonld
  - https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld
  - "@base": https://example.com/ujg/scenario/reuse
id: ""
type: UJGDocument
nodes:
  - id: "#account"
    type: Journey
    entries:
      - id: "#account-entry"
        type: JourneyEntry
        state: "#address-form"
    states:
      - id: "#address-form"
        type: CompositeState
        label: Address form
        subjourneys:
          - id: "#address-journey"
            type: Journey
            entries:
              - id: "#address-entry"
                type: JourneyEntry
                state: "#address-fields"
            states:
              - id: "#address-fields"
                type: State
                label: Address fields
  - id: "#address"
    type: Scenario
  - id: "#enter-address"
    type: Step
    scenario: "#address"
    subject: "#address-form"
  - id: "#checkout"
    type: Scenario
  - id: "#shipping-address"
    type: Step
    scenario: "#checkout"
    subject: "#address"
  - id: "#billing-address"
    type: Step
    scenario: "#checkout"
    subject: "#address"
    previous: "#shipping-address"

JSON-LD

json
{
  "@context": [
    "https://ujg.specs.openuji.org/ed/ns/core.context.jsonld",
    "https://ujg.specs.openuji.org/ed/ns/graph.context.jsonld",
    "https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld",
    {
      "@base": "https://example.com/ujg/scenario/reuse"
    }
  ],
  "id": "",
  "type": "UJGDocument",
  "nodes": [
    {
      "id": "#account",
      "type": "Journey",
      "entries": [
        {
          "id": "#account-entry",
          "type": "JourneyEntry",
          "state": "#address-form"
        }
      ],
      "states": [
        {
          "id": "#address-form",
          "type": "CompositeState",
          "label": "Address form",
          "subjourneys": [
            {
              "id": "#address-journey",
              "type": "Journey",
              "entries": [
                {
                  "id": "#address-entry",
                  "type": "JourneyEntry",
                  "state": "#address-fields"
                }
              ],
              "states": [
                {
                  "id": "#address-fields",
                  "type": "State",
                  "label": "Address fields"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": "#address",
      "type": "Scenario"
    },
    {
      "id": "#enter-address",
      "type": "Step",
      "scenario": "#address",
      "subject": "#address-form"
    },
    {
      "id": "#checkout",
      "type": "Scenario"
    },
    {
      "id": "#shipping-address",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#address"
    },
    {
      "id": "#billing-address",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#address",
      "previous": "#shipping-address"
    }
  ]
}
{
  "@context": [
    "https://ujg.specs.openuji.org/ed/ns/core.context.jsonld",
    "https://ujg.specs.openuji.org/ed/ns/graph.context.jsonld",
    "https://ujg.specs.openuji.org/ed/ns/scenario.context.jsonld",
    {
      "@base": "https://example.com/ujg/scenario/reuse"
    }
  ],
  "id": "",
  "type": "UJGDocument",
  "nodes": [
    {
      "id": "#account",
      "type": "Journey",
      "entries": [
        {
          "id": "#account-entry",
          "type": "JourneyEntry",
          "state": "#address-form"
        }
      ],
      "states": [
        {
          "id": "#address-form",
          "type": "CompositeState",
          "label": "Address form",
          "subjourneys": [
            {
              "id": "#address-journey",
              "type": "Journey",
              "entries": [
                {
                  "id": "#address-entry",
                  "type": "JourneyEntry",
                  "state": "#address-fields"
                }
              ],
              "states": [
                {
                  "id": "#address-fields",
                  "type": "State",
                  "label": "Address fields"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": "#address",
      "type": "Scenario"
    },
    {
      "id": "#enter-address",
      "type": "Step",
      "scenario": "#address",
      "subject": "#address-form"
    },
    {
      "id": "#checkout",
      "type": "Scenario"
    },
    {
      "id": "#shipping-address",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#address"
    },
    {
      "id": "#billing-address",
      "type": "Step",
      "scenario": "#checkout",
      "subject": "#address",
      "previous": "#shipping-address"
    }
  ]
}

Copyright © 2026 the Contributors to the ujg/modules/scenario, published by the User Journey Graph Community Group under the W3C Community Contributor License Agreement (CLA) . A human-readable summary is available.

GitHub Matrix room

generated by Speculator