Synergy GUI

by

Adil KABBAJ

 

 

Introduction

Edition and Drawing of the state of a concept

Edition of Synergy Relation

Execution/Activation of a Synergy Program

Checking Functional Dependency 

Dynamic Programming

Java Object/Method invocation

 

Introduction

This document provides an overview of Synergy GUI. Figure 1 shows the main frame after the activation of Synergy GUI (from Amine Suite for instance).

Figure 1: The Main Frame of Synergy GUI

An untitled file (and empty space/panel) is provided. You can draw and edit a new expression/request or you can open a file that contains an expression/request. But before doing so, you should load first the required ontology that contains definitions of types used in the expression/request. Of course, if your expression/request doesn't contain any defined type, then you can edit and activate/execute your expression/request without loading any ontology. For instance, Figure 2 illustrates the opening of the file "arithmeticOpers.cgif" that contains an arithmetic expression. Since the expression is composed of primitives types only, then no ontology was loaded first.

(a) Load the contain of a file

(b) The contain of the loaded file: an arithmetic expression

Figure 2: Loading a File (without loading first an Ontology)

Primitive types (like Int, Real, Double, Boolean, String) and primitives operations (like plus, minus, multiply, divide, etc.) are specified in a particular Ontology: "Primitive Synergy Ontology" which is automatically loaded by Synergy interpreter. However and as noted before, if the expression/request contains defined types or types other than primitives types, then user should load first the required ontology (which contains these types). Figure 3 shows an example of loading an ontology in the context of Synergy GUI.

           

Figure 3: Loading an Ontology

Figure 4 shows a simple expression drawn using the graphical CG editor (after an ontology has been loaded). A Synergy expression/request is a CG. It is saved in Standard CGIF form, taking into account the graphic information (which is stored, beside the other information). A Synergy request is saved in CGIF form but it is displayed using Amine CG drawing editor. The reader should consult Graph and CG Drawing Editors and CGNotations GUI for more detail on this editor and on CGIF notation. Here, we provide only some details that concern Synergy GUI.

Figure 4: An Expression with a defined concept type (Average)

 

Edition and Drawing of the state of a concept

To provide (or change) the state of a concept, the user should click on the concept (with right-button) to get the concept popup menu. Then he/she has to select the action "state" (Figure 5.a). A popup menu is displayed near the concept and the user has to select a specific state from the list (Figure 5.b). Recall that the state of a concept is defined on the set: {steady, trigger, check-preconditions, wait-preconditions, wait-value, in-activation, wait-affectation, wait-end-affectation}. See Synergy for more detail. Figure 5.c shows the selected state "trigger". Each state is visualized in a specific way: "trigger" state is visualized with green rectangle, like: , "wait-value" state with an unfilled triangle at the left of the concept, like: , "wait-precondition" state with a filled triangle at the left of the concept, like: , "in-activation" state is visualized with red rectangle, like: and "wait-affectation" state with a filled triangle at the right of the concept, like: .

                                  

                    (a) Select State action                                                                                    (b) Select a specific state from the states list

 

    (c) visualization of Trigger state

Figure 5: Concept state

Edition of Synergy Relation

After drawing the segments of a relation, an editable comboBox is displayed that will enable the user to provide the name of the relation. This comboBox is also displayed after a left-double-click on the relation name (to change the name). Identifier of Synergy primitives relations (In, Out, Grd, Next) are provided by default in the list box (Figure 6.a). The user can select one of them (Figure 6.b) and he/she can add specific attributes (like the range, the functional attribute or one of the propagation control attribute) (Figure 6.c). After the enter (return), the combo box is removed and the identifier is drawn (Figure 6.d).

                                                    

                        (a)                        (b)                                (c)                                (d)

Figure 6: Edition of Synergy Relation

Embedded CGs and their display

When a concept with defined type is activated, a copy of the type definition is created and assigned as its descriptor. Like any context (a concept with CG as its descriptor), its new description can be displayed in a separate window by a right-click to get concept popup menu and then selection of the action "Show/Edit Content".

 

Execution/Activation of a Synergy Program

Figure 7 shows buttons that are used to manage the execution/activation of a Synergy expression/request. User can check functional dependency of his/her expression (button 1), or initiate at once the execution of the expression (button 2), or initiate system step by step execution of the expression (button 3), or initiate user step by step execution of the expression (buttons 4-6: initiate the first step with button 4, initiate next steps with button 5. If the user wants to terminate the execution of the expression without step by step, he has to activate the button 6), or stop the execution of the expression (button 7).

      

Figure 7: Activation/Execution modes of Synergy

Checking Functional Dependency

Checking functional dependency is a new function provided by Synergy since Amine 6.0. As noted in Synergy, checking functional dependency of a CG consists basically in putting to state Trigger any concept that is an income argument to other concepts (actors), and in putting to state Trigger any concept C that has a value and is an outcome argument of other concepts (actors). Also, the value of the concept C should be deleted. Then, the CG should be activated to check its functional dependency. Figures 8 and 9 illustrate this new functionality of Synergy. Figure 8 shows an expression that violates its functional dependency: Synergy CG editor allows user to set any value to any concept without checking the functional dependency of the edited CG. Figure 8 illustrates this point.

Figure 8: A CG that violates its functional dependency

To check functional dependency of the current CG, user has to activate button "Check Functional Dependency". The result is shown in Figure 9. The CG is then activated (with the mode "system step by step") to check functional dependency.

Figure 9: Initiation of Checking Functional Dependency

 

Dynamic Programming

To enable dynamic programming, user has to select/activate first "CanJoinSituation" parameter from Parameters menu (Figure 10).

Figure 10: Select "CanJoinSituation" to enable dynamic programming

Figure 11 illustrates the effect of this parameter: situations (schemata) are joined when needed in order to compute required values. See dynamic programming for more detail about dynamic programming in Synergy.

 

 

Figure 11: Dynamic Programming in Synergy

 

Java Method/Object Invocation (from Synergy program)

Like Prolog+CG, Synergy provides now the possibility to create and use Java (and Amine) objects and the possibility to call (Java) methods. Indeed, the definition of concept type has been extended to consider a Java message (ClassName.MethodName or identifier.MethodName or Variable.MethodName) as a new kind of concept type (Figure 12). Note that the complete Java class path should be specified as a String (i.e. "java.util.Stack" in Figure 12). Income/Outcome arguments and output of a method are specified as input concepts (with "in" relations) and output concepts (with out relations). Figure 12 provides an example: method New (which is a Synergy primitive that enables the creation of a new instance of the specified class) assigns the created object (a stack) to its output concept (i.e. [Object :_stack1]). Concept [_stack1.push] represents a Java message. To execute the message, Synergy determines first the reference of the variable "_stack1": to do that, Synergy locates the concept with the variable as its designator, then it considers the descriptor of the concept. As another example, let us consider the concept [Average.getDefinition]: "Average" is a type defined in the current ontology and "getDefinition" is a method of the class Type in Amine. The message "Average.getDefinition" will return the definition of the type "Average".

See Synergy for more detail.

 

 

Figure 12: Java invocation from Synergy