VerbalizePatterns

This page can be downloaded from MDrivenDesigner to act as a pattern for the verbalization of OCL expressions. The Divider between pattern and translation is 3 stars padded by a space. The initial part must be unique - the first occurrence will be used.

To handle an unknown number of parameters, but more than 2, use this pattern: <ARG_N0>,<ARG_NMINUS1>,<ARG_N>. We will use ARG_N0 for the first and ARG_N for the last and ARG_NMINUS1 for the one before the last. Separators in your pattern will be kept and repeated between ARG_N0 and followers to the one before the last.

STARTMARKER

[SELF:<NAME>:<T>] *** From the current context (of type <T> )

[MULTI:<NAME>:<COLLECTION(T)>] *** take the multilink named <NAME> that holds objects of type <T>

[SINGLE:<NAME>:<T>] *** take the singlelink named <NAME> that has an object of type <T>

[OPERATION:allinstances:<COLLECTION(T)>] *** Take all exsisting objects

[ITERATION:select:<LOOPVARNAME>:<LOOPVARTYPE>:(<ARG_1>):<COLLECTION(T)>] *** filter the list by going over all objects, in each iteration we call the 
current object <LOOPVARNAME> and check <ARG_1> - keep the objects that evaluate to true - the result is a reduced list of objects of <T>

[ITERATION:foreach:<LOOPVARNAME>:<LOOPVARTYPE>:(<ARG_1>):<COLLECTION(T)>] *** for each item in the call the current object <LOOPVARNAME> and do the 
following: <ARG_1> - the incoming list of objects of <T> is returned

[ITERATION:exists:<LOOPVARNAME>:<LOOPVARTYPE>:(<ARG_1>):System.Boolean] *** return true if the criteria <ARG_1> is met at least once for items in the 
list called <LOOPVARNAME>

[ITERATION:collect:<LOOPVARNAME>:<LOOPVARTYPE>:(<ARG_1>,<ARG_2>):<COLLECTION(T)>] *** collect <ARG_1> and <ARG_2> and build a list of a new resulting 
tuple type <T> 

[ITERATION:collect:<LOOPVARNAME>:<LOOPVARTYPE>:(<ARG_N0>,<ARG_NMINUS1>,<ARG_N>):<COLLECTION(T)>] *** collect the following arguments <ARG_N0>, 
<ARG_NMINUS1> and <ARG_N> and build a list of a new resulting tuple type <T> 

[ITERATION:<NAME>:<LOOPVARNAME>:<LOOPVARTYPE>:(<ARG_1>):<COLLECTION(T)>]

[LOOPVAR:<NAME>:<LOOPVARNAME>:<T>] *** current object of iteration <LOOPVARNAME> of type <T>

[ATTRIBUTE:<NAME>:<T>] *** take the attribut <NAME> that has the type <T>

[LISTCOERCION:<NAME>:(<ARG_1>):<T>] *** _  

[LISTCOERCION:<NAME>:(<ARG_1>):<COLLECTION(T)>] *** _ 

[OPERATION:>:(<ARG_1>):<T>] *** if it is larger (>) than <ARG_1>

[OPERATION:<:(<ARG_1>):<T>] *** check if it is smaller (<) than <ARG_1>

[OPERATION:or:(<ARG_1>):<T>] *** or (or) the following is true: <ARG_1>

[OPERATION:and:(<ARG_1>):<T>] *** and (and) also the following is true: <ARG_1>

[OPERATION:first:<T>] *** take the first object

[CONST:<NAME>:<CONSTVALUE>:<T>] *** <CONSTVALUE> (of type <T>)

[TYPE:<NAME>:<T>] *** From type <NAME>

[OPERATION:<NAME>:(<ARG_1>):<T>] *** apply operation <NAME> with argument <ARG_1>, it will return a value of type <T>

[OPERATION:<NAME>:<T>] *** run the operation <NAME>, it will return a value of type <T>

[VAR:<NAME>:System.Boolean] *** value of <NAME>

[VAR:<NAME>:<T>] *** <NAME>

[VAR:selfVM:<T>] *** selfVMXXX

[VAR:<NAME>:<COLLECTION(T)>] *** <NAME> is a list of <T> objects

[OPERATION:if:(<ARG_1>,<ARG_2>):<T>] *** if true then <ARG_1> else <ARG_2>

[OPERATION:if:(<ARG_1>,<ARG_2>):<COLLECTION(T)>] *** if true then <ARG_1> else <ARG_2>

[OPERATION::=:(<ARG_1>):<T>] *** and assign it to the result of <ARG_1> 

[OPERATION:=:(<ARG_1>):<T>] *** and check if it is equal to <ARG_1>

[OPERATION:;:(<ARG_1>):<T>] *** . <ARG_1>

[OPERATION:not:System.Boolean] *** avoid all that match

[OPERATION:oclsingleton:<T>] *** Get the singleton object of type <T>

[OPERATION:isnull:System.Boolean] *** is not assigned a value (null)

[OPERATION:notnull:System.Boolean] *** is assigned a value (not null)

[OPERATION:+:(<ARG_1>):System.String] *** append <ARG_1> to the string

[OPERATION:oclisinstate:(<ARG_1>):System.Boolean] *** and object is in state: <ARG_1>

[CONST:<NAME>:<CONSTVALUE>:<Enum Literal>] *** <CONSTVALUE>

[OPERATION:oclisinstate:(<ARG_1>):System.Boolean].[CONST:<NAME>:<CONSTVALUE>:<Enum Literal>] *** test1<CONSTVALUE>

[CONST:<NAME>:<CONSTVALUE>:<Enum Literal>].[OPERATION:oclisinstate:(<ARG_1>):System.Boolean] *** test2<CONSTVALUE>

[OPERATION:oclisinstate:(<[CONST:<NAME>:<CONSTVALUE>:<Enum Literal>]>):System.Boolean] *** test3<CONSTVALUE>

[OPERATION:oclisinstate:([CONST:<NAME>:<CONSTVALUE>:<Enum Literal>]):System.Boolean] *** test4<CONSTVALUE>

[LET:<NAME>:<LOOPVARTYPE>:<LETASSIGNEXP>:<LETACTEXP>:<T>] *** let <NAME> represent the result of <LETASSIGNEXP> in this expression: <LETACTEXP>

[LET:<NAME>:<LOOPVARTYPE>:<LETASSIGNEXP>:<LETACTEXP>:<COLLECTION(T)>] *** let <NAME> represent the result of <LETASSIGNEXP> in this expression: 
<LETACTEXP>

[OPERATION:<>:(<ARG_1>):System.Boolean] *** is NOT Equal from <ARG_1>

[OPERATION:<NAME>:(<ARG_1>,<ARG_2>):<T>] *** Execute the method <NAME> with argument <ARG_1> and <ARG_2>, and get a result of type <T> 

[OPERATION:<NAME>:(<ARG_N0>,<ARG_NMINUS1>,<ARG_N>):<T>] *** Execute the method <NAME> with argument <ARG_N0>,<ARG_NMINUS1> and <ARG_N> get a result 
of type <T>
This page was edited more than 6 months ago on 06/17/2024. What links here