Update 'Nested Operation Calls' example documentation ("
Hi folks, I am new to USE and working through the manual's examples. I think it is a fantastic tool!
Describe the bug I am trying to work through the "Nested Operation Calls" portion of the manual, and USE is reporting an error that seems to indicate a new limitation (perhaps) or (hopefully) implies that there is some new way to invoke operations that are defined as OCL expressions.
To Reproduce Steps to reproduce the behavior:
- Load the model shown here
- Issue the commands "!create r : Rec" and "!openter r fac(3)" as shown here.
- The second command will fail; the command line will report "Operation 'Rec::fac' is defined by a OCL expression and cannot be entered with openter."
Expected behavior The command line should show something similar to "precondition `pre1' is true" as shown in the link from step 2 above.
Desktop (please complete the following information):
- OS: Mac OS Ventura
- Java Version OpenJDK 19.0.1 2022-10-18
- USE version 7,0.1
Additional context The source line showing the error appears to be here, but I didn't see any immediate hint pointing to how I should instead have tried to invoke the operation.
Hello again,
I note that, given that the "factorial" example is still loaded AND the object "r" of type "Rec" exists, then entering "r.fac(3)" in the "Evaluate OCL expression" window, it does work ("Result:" shows "6 : Integer"). I am able to click the "Browser" button in tat dialog to see the entire nested call tree.
Trying to generate a sequence diagram at the same time, however, does not produce anything. Thanks, Chuck
Hi Chuck, I'm glad to hear you like USE.
There are different ways to define operations in USE:
-
Side-effect free query operations These are the operations defined by an OCL expression, like
facin the example. These oeprations can directly be called from other OCl expressions (like it is done in the post condition) or using the query command (startet with ? on the shell or entered directly in the OCL evaluation window. Called query operations to not show up in the sequence diagram. Maybe this should be changed in future releases. -
Operations with side-effects without a body These operations are "simulated" by the commands
!openterandopexit. Here concrete scenarios can be "executed" by changing the system state with commands likeset,create,delete, ... The operations "called" this way show up in the sequence diagram. -
Operations with side-effects with a body These operations can be defined using s tiny imperative language called SOIL.
However, adding the possibility to show query operations in the sequence diagram might be a good idea. But I see some challenges:
- Which calls to query operations should be shown? Only the direct ones or also calles from inside pre- and postconditions?
- Should a query entered in the evaluation windows show up?
- Shoul a user be able to speparate between shown und unshown queries? Like with a new command
!?or something like this.