ContextMapper / context-mapper-examples

ContextMapper DSL: Examples
https://contextmapper.org/
Apache License 2.0
201 stars 78 forks source link

help with a context map that includes aggregates #28

Closed juleedev closed 1 year ago

juleedev commented 1 year ago

I'm just learning about DDD context maps.

Just for learning purposes, I'm trying to model something like this inside a cml document:

enter image description here

This is what I have so far for my cml. I have defined two aggregates. One is frontend and the other Backend Api.

ContextMap CMSRAGService {
    contains SharePointWebPart
    contains BackendApi
    contains AnswerGenerationService
  contains DocumentSummarizationService
    contains AzureOpenAiApi
  contains MSGraphSharePointApi
  contains NaturalLanguageProcessingService

    AzureOpenAiApi [OHS, PL] -> [ACL] AnswerGenerationService
  AnswerGenerationService -> DocumentSummarizationService 
  MSGraphSharePointApi [OHS, PL] -> [ACL] DocumentSummarizationService
  MSGraphSharePointApi ->  NaturalLanguageProcessingService
  NaturalLanguageProcessingService -> DocumentSummarizationService
}

BoundedContext SharePointWebPart{
    Aggregate Frontend {
    }
}

BoundedContext BackendApi
{
    Aggregate BackendApi {
    }
}

BoundedContext AnswerGenerationService

BoundedContext AzureOpenAiApi

BoundedContext NaturalLanguageProcessingService 

BoundedContext MSGraphSharePointApi 

BoundedContext DocumentSummarizationService

The problem is I don't know how to include these other services as a part of the Aggregate. I saw an example of the keyword "service" and i tried playing around with it, but it doesn't give me what I'm looking for. Just for ha has and giggles, I tried to update the BackendApi context like so:

BoundedContext BackendApi
{
    Aggregate BackendApi {
    knowledgeLevel = CONCRETE
      enum States {
    aggregateLifecycle
    CREATED, POLICY_CREATED, RECALLED
  }
    Service ContractService{
      boolean createPolicy(): write [CREATED -> POLICY_CREATED];
    }
    }
}

It doesn't actually impact the SVG that's rendered.