You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can an Annotation specify only one annotated Classifier or more?
Pro 1:
Works well for MPS, exceptions rare
Available workaround for exceptional cases: Define a ConceptInterface with the appropriate features, have several Annotations implement that interface and annotate different targets.
For Annotation A that annotates Concept C, A can also annotate all specializations of C. That provides sufficient flexibility.
Pro 1..*:
Technically feasible
Decision: Annotation.annotates has a cardinality of 1.
Can we redefine features of extended Annotations?
Annotations specify their multiple and annotates features (#13).
If one Annotation extends another one, what happens to the values of these features?
Depending on the interpretation, might break contracts: A model checker would assure any node has at most one Trainer. However, RunningCoachis aTrainer, but a node might have several RunningCoaches.
Option 2: Only allow changes from multiple =true to multiple = false
Pro:
Maintains the contract: A node can have 0..* AnimalOwners, but at most one Trainer.
Con:
Complex constraints, hard to explain
Option 3: Cannot redefine
In any annotation inheritance hierarchy, the multiple feature can be set exactly once, or only to the same value.
Pro:
Sufficiently simple
Con:
Cannot express some cases
annotates
Option A: No limits
classDiagram
class AnimalOwner {
<<annotation>>
}
class Animal
AnimalOwner --> Animal: annotates
class Trainer {
<<annotation>>
}
AnimalOwner <|-- Trainer
class Learner
Trainer --> Learner: annotates
Loading
Pro:
Flexibility
Con:
Trainer breaks the contract of AnimalOwner: We assume an AnimalOwner always annotates an Animal. However, Traineris aAnimalOwner -- but it annotates a Learner.
Option B: specialization constraint
A sub-annotation MUST annotate a sub-concept of the super-annotation's target.
classDiagram
class AnimalOwner {
<<annotation>>
}
class Animal
AnimalOwner --> Animal: annotates
class Trainer {
<<annotation>>
}
AnimalOwner <|-- Trainer
class Learner
Animal <|-- Learner
Trainer --> Learner: annotates
Cardinality of
Annotation.annotatesCan an Annotation specify only one annotated Classifier or more?
Pro 1:
ConceptInterfacewith the appropriate features, have severalAnnotations implement that interface andannotatedifferent targets.Pro 1..*:
Decision:
Annotation.annotateshas a cardinality of 1.Can we redefine features of extended
Annotations?Annotations specify their
multipleandannotatesfeatures (#13).If one Annotation extends another one, what happens to the values of these features?
multipleOption 1: No Limits
classDiagram class AnimalOwner { <<annotation>> multiple = true } class Trainer { <<annotation>> multiple = false } AnimalOwner <|-- Trainer class RunningCoach { <<annotation>> multiple = true } Trainer <|-- RunningCoachPro:
Con:
Trainer. However,RunningCoachis aTrainer, but a node might have severalRunningCoaches.Option 2: Only allow changes from
multiple =truetomultiple = falsePro:
AnimalOwners, but at most oneTrainer.Con:
Option 3: Cannot redefine
In any annotation inheritance hierarchy, the
multiplefeature can be set exactly once, or only to the same value.Pro:
Con:
annotatesOption A: No limits
classDiagram class AnimalOwner { <<annotation>> } class Animal AnimalOwner --> Animal: annotates class Trainer { <<annotation>> } AnimalOwner <|-- Trainer class Learner Trainer --> Learner: annotatesPro:
Con:
Trainerbreaks the contract ofAnimalOwner: We assume anAnimalOwneralways annotates anAnimal. However,Traineris aAnimalOwner-- but it annotates aLearner.Option B: specialization constraint
A sub-annotation MUST annotate a sub-concept of the super-annotation's target.
classDiagram class AnimalOwner { <<annotation>> } class Animal AnimalOwner --> Animal: annotates class Trainer { <<annotation>> } AnimalOwner <|-- Trainer class Learner Animal <|-- Learner Trainer --> Learner: annotatesPro:
AnimalOwnerCon:
Option C: Cannot redefine
In any annotation inheritance hierarchy, the
annotatesfeature can be set exactly once, or only to the same value.classDiagram class AnimalOwner { <<annotation>> } class Animal AnimalOwner --> Animal: annotates class Trainer { <<annotation>> } AnimalOwner <|-- Trainer Trainer --> Animal: annotates class Doctor { <<abstract, annotation>> Integer yearsOfExpertise } class AnimalDoctor { <<annotation>> } Doctor <|-- AnimalDoctor AnimalDoctor --> Animal: annotates class HumanDoctor { <<annotation>> String specialization } Doctor <|-- HumanDoctor class Human HumanDoctor --> Human: annotates class CSharpDoctor { <<annotation>> } Doctor <|-- CSharpDoctorTrainerredefinesannotates, but to the same value as forAnimalOwner.Doctoris abstract, so it doesn't need to specifyannotates. Specialized doctors can.CSharpDoctoris invalid because it doesn't defineannotates.Pro:
Con:
Decision: Option 3 + C
multiple,annotates) cannot be redefined