Open ronaldtse opened 3 years ago
The last example looks confusing and does not quite fit into the object notation we are trying to stick with. Maybe use something like this:
class Article {
generalizes Warehouse constraint 'xor'
generalizes Store constraint 'xor'
}
class Warehouse {}
class Store {}
or:
class Article {
generalizes Warehouse, constraint 'xor'
generalizes Store, constraint 'xor'
}
class Warehouse {}
class Store {}
There is an issue here because the xor
constraint applies to multiple relationships.
The "->" relationship is called a "supplier and client relationship". We can give it the keyword of "supplies" or "provides".
How about something like:
class Article {
supplies Warehouse as "relationship1"
}
class Warehouse
class Store {
provides Article as "relationship2"
}
constraint MyXor {
type xor
end relationship1
end relationship2
}
or
class Article
class Warehouse
class Store
association "relationship1" supplies {
begin Article
end Warehouse
}
association "relationship2" provides {
end Article
begin Store
}
constraint MyXor {
type xor
end relationship1
end relationship2
}
class Article { supplies Warehouse as "relationship1" } class Warehouse class Store { provides Article as "relationship2" }
constraint MyXor { type xor end relationship1 end relationship2 }
We already decided to use association syntax on diagram objects, so I think the first example you have is more suitable:
class Article {
supplies Warehouse as "relationship1"
}
class Warehouse
class Store {
provides Article as "relationship2"
}
constraint MyXor {
type xor
end relationship1
end relationship2
}
Although I don't think that type
is a suitable name for it, maybe use something like text
? If you introduce this keyword we can also use a shorthand syntax for constant associations:
constraint MyXor {
type xor
relationship1
relationship2
}
Can constraint be owned by end of the association? In the example you used end
keyword, can it be start
one?
We already decided to use association syntax on diagram objects, so I think the first example you have is more suitable:
"xor" is a special operation in UML, it's not supposed to be generic text.
Can constraint be owned by end of the association? In the example you used end keyword, can it be start one?
By end
I was just using the convention that in UML they call the connection point the "association end" (also in the XMI). In XML there is the "owner end" vs "member end".
This is a work in progress of the UML.xmi file trying to be simplified into our syntax, haven't worked out the rest yet... e.g.
association A_ownedAttribute_owningSignal {
memberEnd Signal#ownedAttribute
memberEnd A_ownedAttribute_owningSignal#owningSignal
ownedEnd "owningSignal" {
type Signal
association A_ownedAttribute_owningSignal
subsettedProperty A_attribute_classifier#classifier
subsettedProperty NamedElement#namespace
lowerValue LiteralInteger
}
}
Constraints
Constraints-Notation & Semantics
‘{‘ [<name> ‘:’]<Boolean expression> ‘}’
xor
constraint is predefined in UML and can be graphically written between associations.Proposal: 1:
(OCL) constraint named "Salary":
xor constraint: