0

UML Diagram for given problem

I have been given a task to create pre and post conditions for an operation:

getInformation(givenTitle:String):Integer

The operation should return a number of all bug reports for a project of a specified title. As for the pre conditions i have figured out the following:

context Company::getInformation(givenTitle:String):Integer
    pre: has->size() > 0 and has->exists(title = givenTitle);

Yet I have a big problem how to handle the aggregation of artifacts in projects

If it was just an association I would do the following:

    post: has->select(title = givenTitle)->first().Artifact.relatedTo->size() = result;

But I don't know how to handle the aggregation, and i can't seem to find any useful information about that on google.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Wunsz
  • 165
  • 3
  • 7

1 Answers1

0

Agreggation is not an autonomous UML element, it's just a kind of bidirectional association (with a "shared" end), so everything that applies to an association is valid.

Same goes for the composition, only the end is "composite").

And a small correction - I noticed that you use association names in OCL expressions ("has", "relatedTo", etc). To be fully complient with OCL specification, you should use the association ends' role names instead.

Aleks
  • 5,674
  • 1
  • 28
  • 54