Lesson 4 challenge

Hi,

I have a question about the Advent of SysML v2, Lesson 4 challenge.

The requirement on the item is:
”- The gift bag should contain at least a toy train, a teddy bear, and a candy cane. “

However with:
item giftbag redefines payload : BottomlessGiftbag {

            item toyTrain subsets gifts;

            item teddyBear subsets gifts;

            item candyCane subsets gifts;

        }

We only define toyTrain, teddyBear, candyCane as part of gifts, so if they exits, they are part of gifts, but this doesn’t mean that every instance of BottomlessGiftbag will contain at least one toyTrain, teddyBear, candyCane, as required. Or does it?

Happy to get your feedback.

Hi Maurice,

You are very close, and I hope you already got your answer in esson 5. If you also set the multiplicity if each item to [1..*], it will require any giftbag (the usage in your case) to have at least one of these among the gifts.

In lesson 4, we did not really care about multiplicities yet, so you are right that this challenge was a bit loose. As you progress with the lessons, we will slowly become more and more rigorous :slight_smile: