This page presents Wodel examples for UML class diagrams. The corresponding metamodel is available here: UML Class Diagrams Ecore.
Adds a redundant constraint to the class diagram [uco1]:
cd = select one ClassDiagram where {^constraints <> null}
c = select one Constraint in cd->^constraints
deep clone c in cd->^constraints
Adds an extraneous constraint to the class diagram [uco2]:
create Constraint with {type = one Class, id = random-string(1, 4)}
Adds a redundant association to the class diagram [uas1]:
cd = select one ClassDiagram where {relations is typed Association}
a = select one Association in cd->relations
deep clone a in cd->relations
Adds a redundant derived association to the class diagram [uas2]:
cd = select one ClassDiagram where {relations is typed Association}
a1 = select one Association in cd->relations
a2 = select one Association in cd->relations where {src = a1->tar}
a3 = create Association in cd->relations with {
name = random-string(1, 4),
src = a1->src, tar = a2->tar,
copy(nsrc, a1.nsrc), copy(ntar, a2.ntar),
derived = true
}
Adds an extraneous association to the class diagram [uas3]:
create Association
with {src = one Class, tar = one Class, name = random-string(1, 4)}
Adds an extraneous derived association to the class diagram [uas4]:
create Association
with {src = one Class, tar = one Class, name = random-string(1, 4), derived = true}
Adds a redundant generalisation to the class diagram [uge1]:
cl = select one Class where {super <> null and super->super <> null}
sup1 = select one Class in cl->super where {super <> null}
sup2 = select one Class in sup1->super where {self <> cl->super}
modify cl with {super = sup2}
Adds an extraneous generalisation to the class diagram [uge2]:
c1 = select one Class where {super <> null}
s = select all Class in closure(c1->super)
c2 = select one Class where {self <> s}
modify c1 with {super = c2}
Adds a redundant class to the class diagram [ucl1]:
cd = select one ClassDiagram where {classes is typed Class}
c = select one Class in cd->classes
deep clone c in cd->classes
Adds an extraneous class to the class diagram [ucl2]:
create Class with {name = random-string(1, 4)}
Adds a redundant association class to the class diagram [ucl3]:
cd = select one ClassDiagram where {classes is typed AssociationClass}
ac = select one AssociationClass in cd->classes
clone ac in cd->classes
Adds an extraneous association class to the class diagram [ucl4]:
create AssociationClass with {name = random-string(1, 4)}
Adds a redundant attribute to a class [uat1]:
c = select one Class where {features is typed Attribute}
att = select one Attribute in c->features
deep clone att in c->features
Adds an extraneous attribute to a class [uat2]:
create Attribute with {type = one Class, name = random-string(1, 4)}
Adds a redundant operation to a class [uop1]:
c = select one Class where {features is typed Operation}
op = select one Operation in c->features
deep clone op in c->features
Adds an extraneous operation to a class [uop2]:
create Operation with {type = one Class, name = random-string(1, 4)}
Adds a redundant parameter to an operation [upa1]:
op = select one Operation where {params <> null}
p = select one Parameter in op->params
clone p in op->params
Adds an extraneous parameter to an operation [upa2]:
create Parameter with {name = random-string(1, 4)}
Removes references to a class attribute from a constraint [wco1]:
remove one PathElementCS where {pathName = one Attribute}
Changes the data type of an attribute referenced by a constraint [wco2]:
p = select one PathElementCS where {pathName = one Attribute}
a = select one Attribute in p->pathName
modify a with {type = other Class}
Removes calls to a specific operation from a constraint [wco3]:
remove one OperationCS
Replaces one arithmetic operator with another. Supported binary operators are: "add", "subtract", "multiply", "divide" [wco4]:
modify one IntLiteralExpCS with {op in ['add', 'subtract', 'multiply', 'divide']}
Adds the Boolean operator "not" to a constraint [wco5]:
inv = select one InvariantCS where {exp <> null}
create LogicExpCS in inv->exp with {op = 'not'}
Replaces the Boolean operator "and" with "or" [wco6a]:
modify one BooleanExpCS where {op = 'and'} with {op = 'or'}
Replaces the Boolean operator "or" with "and" [wco6b]:
modify one BooleanExpCS where {op = 'or'} with {op = 'and'}
Removes the Boolean operator "not" from a constraint [wco7]:
remove one LogicExpCS where {op = 'not'}
Replaces one relational operator with another. Supported operators are: "lt" , "lte", "gt" , "gte", "equals", "distinct" [wco8]:
modify one BooleanExpCS where {op in ['lt', 'lte', 'gt', 'gte', 'equals', 'distinct']}
with {op in ['lt', 'lte', 'gt', 'gte', 'equals', 'distinct']}
Removes the unary arithmetic operator "negative" from a constraint [wco9]:
modify one IntLiteralExpCS where {op = 'negative'} with {op = ''}
Swaps the source (src) and target (tar) ends of an association [was1]:
modify one Association with {swapref(src, tar)}
Changes the association kind (association, aggregation, composition or dependency) [was2]:
retype one [Association, Aggregation, Composition, Dependency]
as [Association, Aggregation, Composition, Dependency]
Changes the target (tar) multiplicity of an association (*, 0..1, 1..1 or 1..*) [was3]:
modify one Association with {ntar in ['*', '0..1', '1..1', '1..*']}
Changes the endpoints of a generalisation [wge]:
modify one Class with {super = other Class}
Changes the visibility of a class [wcl1]:
modify one Class with {visibility in {public, private, protected, package}}
Replaces a class with an association class [wcl2]:
retype one Class as AssociationClass
with {association = one Association}
Replaces an association class with a class [wcl3]:
retype one AssociationClass as Class
Sets the abstract property of a class to true [wcl4]:
modify one Class where {abstract = false} with {abstract = true}
Sets the derived property of an attribute to true [wat1]:
modify one Attribute where {derived = false} with {derived = true}
Sets the derived property of an attribute to false [wat2]:
modify one Attribute where {derived = true} with {derived = false}
Changes the data type of an attribute [wat3]:
modify one Attribute with {type = other NamedElement}
Changes the visibility of an attribute [wat4]:
modify one Attribute with {visibility in {public, private, protected, package}}
Changes the order of an operation's parameters [wop1]:
op = select one Operation where {params <> null}
p = select one Parameter in op->params
modify op with {params -= p, params += p}
Changes the visibility of an operation [wop2]:
modify one Operation with {visibility in {public, private, protected, package}}
Changes the return type of an operation [wop3]:
modify one Operation with {type = other NamedElement}
Changes the data type of a parameter [wpa]:
modify one Parameter with {type = other NamedElement}
Deletes a constraint [mco]:
remove one Constraint
Deletes an association [mas]:
remove one Association
Deletes a generalisation relationship [mge]:
l = select one Class where {super <> null}
remove one Class from c->super
Deletes a class [mcl]:
c = select one Class
remove all Relation where {src = c or tar = c}
remove all Operation where {type = c}
remove all Feature where {type = c}
remove all AssociationClass where {association = null}
remove c
Deletes an attribute [mat]:
remove one Attribute
Deletes an operation [mop]:
remove one Operation
Deletes a parameter from an operation [mpa]:
remove one Parameter
Download all the Wodel examples for UML class diagrams here.
UML Class Diagrams samples (ZIP)
UML Class Diagrams samples (TAR.GZ)
Acknowledgements
This work was funded by the Spanish Ministry of Science through project “MASSIVE” (RTI2018-095255-B-I00), and by the R&D programme of the Madrid Region through project “FORTE” (P2018/TCS-4314).
