Skip to content
CONTEXT MAPPER
  • Docs
  • Language Reference
  • Generators
  • News
  • Background
  • Get Involved
    Introduction
    • Welcome
    • Getting started
    • Create CML Project
    • Examples
    • Usage as Library
    • Frequently Asked Questions
    Language Reference (Core)
    • CML Reference - Introduction
    • Language Semantics
    • Context Map
    • Bounded Context
    • Domain and Subdomain
    • Domain Vision Statement
    • Partnership
    • Shared Kernel
    • Customer/Supplier
    • Conformist
    • Open Host Service
    • Anticorruption Layer
    • Published Language
    • Responsibility Layers
    • Knowledge Level
    • Aggregate
    • Tactic DDD Syntax
    • Application and Process Layer
    • User Requirements
    • Stakeholders
    • Value Registers
    • Imports
    Analysis and Design Transformations
    • Rapid Object-oriented Analysis and Design
    • Story Splitting (PoC)
    • Stakeholder and Value Modelling Transformations
    Architectural Refactorings (ARs)
    • Architectural Refactorings
    • AR-1: Split Aggregate by Entities
    • AR-2: Split Bounded Context by Features
    • AR-3: Split Bounded Context by Owner
    • AR-4: Extract Aggregates by Volatility
    • AR-5: Extract Aggregates by Cohesion
    • AR-6: Merge Aggregates
    • AR-7: Merge Bounded Contexts
    • AR-8: Extract Shared Kernel
    • AR-9: Suspend Partnership
    • AR-10: Change Shared Kernel to Partnership
    • AR-11: Change Partnership to Shared Kernel
    Value-Driven Analysis and Design
    • Value-Driven Analysis and Design (VDAD) Support
    Service Cutter
    • Context Map Suggestions with Service Cutter
    • Service Cutter Configuration File (.servicecutter.yml)
    Reverse Engineering
    • Context Map Discovery
    Generators
    • Generators Overview
    • Context Map Generator
    • PlantUML Generator
    • BPMN Sketch Miner Generator
    • MDSL (Micro-)Service Contracts Generator
    • Service Cutter Generators
    • Generic Generator (Templating)
    Tutorials
    • Model Event Storming Results in Context Mapper
    • Event Sourcing and CQRS Modeling in Context Mapper
    • Generate Microservices From Context Map Using JHipster
    • Systematic Service Decomposition with Context Mapper and Service Cutter
    • Validating the Implementation against the Model (with ArchUnit)
    IDE Plugins and Extensions
    • Visual Studio Code Extension
    • Online IDE (no longer supported)
    • Eclipse Plugin
    • Feature Support

    Domain and Subdomain

    As bounded contexts, domains are defined on the root level of a CML (*.cml) file. They provide a container to specify all subdomains which are then referenced on a bounded context with the implements keyword. A bounded context can also implement the compete domain. Have a look at bounded context for an example.

    Syntax

    The following example illustrates how you can specify a domain with subdomains in CML:

    /* Syntax example: Domain and Subdomains */
    Domain Insurance {
      domainVisionStatement = "Insurance domain vision statement ..."
    
      Subdomain CustomerManagementDomain {
        type = CORE_DOMAIN
        domainVisionStatement = "Subdomain managing everything customer-related."
    
        Entity Customer {
          String firstname
          String familyname
        }
    
        /* Add more entities ... */
      }
    
      Subdomain ContractManagementDomain {}
    
      /* Add more subdomains ... */
    }
    

    Note that the equal sign (=) to assign an attribute value as done in the example above is optional and can be omitted.

    Subdomain Type

    With the type keyword you specify of which type your subdomain is. The following types exist:

    • CORE_DOMAIN
    • SUPPORTING_DOMAIN
    • GENERIC_SUBDOMAIN

    Implemented Features

    The CML language supports the specification of user requirements or features in the form of use cases or user stories. With the supports keyword you can specify which user requirements a Subdomain implements. An example:

    /* Syntax example for Subdomain that supports specific user requirements: */
    Domain Insurance {
      domainVisionStatement = "Insurance domain vision statement ..."
    
      Subdomain CustomerManagementDomain supports CreateCustomers, CreateCustomerAddresses {
        type = CORE_DOMAIN
        domainVisionStatement = "Subdomain managing everything customer-related."
    
        Entity Customer {
          String firstname
          String familyname
        }
      }
    
    }
    
    UserStory CreateCustomers {
      As an "Insurance Employee"
        I want to "create" a "Customer" with its "firstname", "lastname"
      so that "I am able to manage the customers data and offer them insurance contracts."
    }
    
    UserStory CreateCustomerAddresses {
      As an "Insurance Employee"
        I want to "create" an "Address" for a "Customer"
        I want to "update" an "Address" for a "Customer"
      so that "I am able to manage the customers addresses."
    }
    

    Domain Vision Statement

    With the domainVisionStatement keyword you can specify a vision statement for domains and subdomains, according to the DDD Domain Vision Statement pattern.

    Entities

    In order to provide further details about your subdomain and which domain objects are part of it, you can use entities within a subdomain. Note that the used Entity rule is integrated from the Sculptor DSL. For more details about the features and possibilities of this Entity rule, we refer to the Sculptor documentation. An example of a simple entity with attributes is illustrated above.

    Note that only entities can be used within the subdomains. It is not possible to use Aggregates or other tactic DDD concepts within them. The entities within subdomains are only used for business modeling purposes and not respected by the generator tools. Generators respect the domain model within Bounded Contexts.
    Improve this page on GitHub
    ← PreviousBounded Context Next →Domain Vision Statement
    © 2026 Context Mapper contributors
    • GitHub
    • Get Involved
    • Background & Publications
    • RSS