Share via


Defining Compartment Shape Maps

Compartment shapes have multiple compartments, which must be mapped separately. The following procedure shows how to create a compartment for a component shape that is mapped to one class, and then map the compartment to a domain property on a second class.

To define compartment mapping on a compartment shape

  1. Create a Domain-Specific Language Tools solution by using the MinimalLanguage solution template.

  2. Add two domain classes and name them FirstClass and SecondClass.

  3. Create an embedding relationship from the ExampleModel domain class to FirstClass.

  4. Create an embedding relationship from FirstClass to SecondClass.

  5. On the diagram, right-click SecondClass, point to Add, and then click Domain Property. Name the property SecondClassDomainProperty.

  6. Add a compartment shape and name it FirstClassShape.

  7. Map FirstClass to FirstClassShape as follows.

    1. In the Toolbox, select the Diagram Element Map tool, and then draw a line from FirstClass to FirstClassShape.

    2. Select the line between First Class and FirstClassShapeand click the DSL Details window. Make sure that the Shape box shows FirstClassShape, the Domain class box shows FirstClass, and the Parent element path box shows ExampleModelHasFirstClasses.ExampleModel/!ExampleModel.

  8. Add a compartment to FirstClassShape by right-clicking the shape on the diagram, pointing to Add, and then clicking Compartment. Name the new compartment SecondClassCompartment.

  9. Select the line between First Class and FirstClassShape, click the DSL Details window, and then click the Compartment Maps tab. Select SecondClassCompartment.

  10. In the Displayed elements collection path box, use the tree view to locate the FirstClassHasSecondClasses relationship and then select SecondClass.

  11. In the Display property box, select SecondClassDomainProperty.

  12. You must add a toolbox item for FirstClass before a user of your domain-specific language can add this element to the diagram. For information about how to add toolbox items, see Customizing Tools and the Toolbox.

See Also

Other Resources

Domain-Specific Language Tools Glossary

Change History

Date

History

Reason

July 2008

Rewrote and refactored project.

Content bug fix.