UML&OCL Modeling Languages


OCL Primer (2)

use> ? let t=Set{'bill','kate','bob'} in t->collect(v|v.substring(1,2))
use> ? let t=Set{'bill','kate','bob'} in not t->includes('amy')

use> ... How to express the preceding query but not using 'includes' ?
use> ... How to get count the names starting with 'b' ?

Thus, OCL knows strings represented here by single quotes.




? let t=Set{'bill','kate','bob'} in t->select(v|v='amy')->size()=0
? let t=Set{'bill','kate','bob'} in t->select(v|v.substring(1,1)='b')->size()