CG Editors GUI
by Adil KABBAJ*
* The first version of this document, prepared for the version 1.0 of Amine, has been prepared with the collaboration of Karim Bouzoubaa.
CG Notations GUI is a multi-documents, multi-lingua and multi-notations CG editors: it provides the user the opportunity to edit CGs in different forms and different languages. A CG can be edited in a linear form (LF), a CGIF form and/or a graphic form. These forms are considered as three views for the presentation of a CG. The user can switch from one view to another. Moreover, he can switch also from one language to another. Hence, CGNotations GUI provides an automatic translation of CGs, i.e. the user can express his CG in French and then switch to the English tab to get the same CG in English. Also, a CG can be stored in a linear form or in a CGIF form.
This document describes the main components and functionalities of CG Notations GUI.
At the beginning (Figure 1.a), the user has to load the ontology that will be used to manipulate CGs (by parsers and generators). To do that, he/she has to select/activate the action Ontology/Load from the menu bar. Once the selected ontology is loaded, the main frame of the CGNotations GUI is displayed (Figure 1.b). The status bar informs the user about the current CG file and the current ontology.
(a) Load an Ontology (b) CG multi-lingua and multi notations editors
Figure 1: Load an Ontology and the initial status of the CG Notations GUI
The GUI offers Multi-CGFiles Panels (a top tabbed pane) to edit several CG files. In Figure 1.b, only one panel for an untitled CG file is opened. Each CGFile Panel includes a multi-Languages Panels (a left tabbed pane) for all languages of the current ontology (in our example, English and French are the two languages associated to the current ontology). Each language panel includes a multi-CG Notations Panels (a bottom tabbed pane) for the three CG notations (LF, CGIF and Graphic Forms).
Actions Ontology/Close and Ontology/Load enable the user to close the current ontology and to load a new one. During the edition of CGs, the user needs very often to browse, consult, or update the current ontology (for instance, to change the identifier of a type, to add a new type, etc.). To respond to these needs, the menu Ontology provides the action Ontology/Run LexiconsOntology GUI which activates the LexiconsOntology GUI for the current ontology (user has not to load the current ontology in LexiconsOntology GUI, it is done implicitly). Consultation and changes of the current ontology can be done with LexiconsOntology GUI that is used in this case as an extension of CGNotations GUI.
A CG can be edited according to the LF notation, the CGIF notation, or the Graphic notations. LF and CGIF grammars are provided in CG.
Usual editor's menus are offered by CGNotations GUI (Figure 1.b): File (New, Open, Save, SaveAs, Close), Edit (Undo, Redo, Cut, Copy, Past), Font (Bold, and the possibility to choose different sizes), and Search (Find, FindAgain, Replace, ReplaceAll).
Switching from one CG Notation to another
Tabbed panes LF Editor, CGIF Editor and CG Graphic Editor provide three editors for the corresponding CG notations. The user can select one of them to edit and/or to get an automatic translation of the current CG in a specific notation. For instance, a user can edit a CG using LF editor and then, by switching to CGIF editor, get the same CG in CGIF (the translation is performed automatically by Amine). Figure 2 provides an example of this feature: it shows a simple CG edited with LF Editor (Figure 2.a)). Figure 2.b shows the result of the switch to the CGIF Editor panel. The switch is initiated by the user but the translation to CGIF is automatic.
(a) a simple CG in LF (b) The same CG in CGIF
Figure 2: CG Editors: LF and CGIF editor
With Amine 6.0, Standard CGIF notation is integrated to Amine. But previous CGIF notation is still available (user can still use pseudo-designator instead of coreferent).
sometimes, user wants to see, at the same time, both the LF and the CGIF forms of the current CG. CGNotations GUI provides this possibility via the action Ontology/Display/Show LF&CGIF. Figure 3 gives the result of such an action on the current CG.
Figure 3: LF and CGIF notations in one "look"
Let us return now to CG editors: user can edit the current CG in one of the three editors (for instance, in the CGIF editor) and any change will have an impact on the formulation of the CG in the others CG editors. Figure 4 illustrates this feature: the relation (manr #0 [Fast]) is eliminated from the CGIF notation (Figure 4.a) and if the user switches to LF editor, he will find that the LF notation of the same CG has been updated (Figure 4.b).
Figure 4: CG Editors, after change and switching from CGIF to LF editor
Let us consider now a more complex CG: an example of compound CG (Figures 5 and 6). Figure 5 provides the LF notation of the CG and figure 6 the CGIF representation of the same CG.
Figure 5: Compound CG in LF
Figure 6: Compound CG in CGIF
Switching from one language to another
Beside switching from one CG notation editor to another, user can switch also from one language to another. Consider for instance Figure 7 which illustrates the switch from English to French. Figure 7.b shows the same CG but in French and in LF. The user can of course switch to CGIF editor or to Graphic Editor to see the same CG in French and in CGIF (or in Graphic form).
Figure 7: CG Editors, switching from LF in English to LF in French
The reader may note that the translation in Figure 7.b is not complete: Eat and Apple have not been translated. The reason is that some concept types, relation types, and individuals may not have synonyms in a specific language associated to the ontology. For instance, in the current ontology (ManOntology.xml), concept types Eat and Apple have no synonyms in French. The behavior of the GUI in this situation depends on the boolean parameter "MixedLanguage": if MixedLanguage is true, the GUI will use synonyms from the main language (in our example, the main language is English) and so, the description is formulated in a mixed language (in our example, it is formulated in French with English identifiers if necessary). If the parameter MixedLanguage is false, the GUI will post an error.
This special case leads us to talk about the set of parameters that are considered by CGNotations GUI.
CGNotations GUI Parameters
CGNotations GUI controls several boolean parameters (menu Parameters):
- Mixed Language: this parameter has been introduced above. It is associated to the ontology. See Ontology for more detail.
- Ignore Case: if this parameter is true, Amine ignores case. If it is false, Amine becomes case sensitive. This parameter is associated to Identifier. See Lexicon and especially Identifier API for more detail.
- Functional CG: if this parameter is true, only functional CGs are allowed. If it is false, user is free to specify any CG. This parameter is associated to CG. See CG for more detail.
- CG Canonicity: if this parameter is true, only canonic CGs are allowed. If it is false, user is free to specify any CG. This parameter is associated also to CG. See CG for more detail.
The four parameters are provided under menu Parameters. Note that all parameters are initialized to true.
Let us consider again the situation depicted in Figure 7.a but now, the parameter Mixed Language is switch to off (Figure 8.a). Selection of the French Tab (to get the translation of the CG in French) will produce an error that is posted in the Debug Frame associated to CGNotations GUI (Figure 8.b). Indeed, all the error, warning, and information messages that concern CGNotations GUI are displayed in its Debug Frame (CGOperations GUI and Ontology GUI have their own Debug Frames).
The error reported in Figure 8.b concerns relation type identifier, it is the first abstract structure (Conceptual Structure) that has no identifier in French (Amine does not know how to say "agnt" in French ! No synonym exists for "agnt" in the French lexicon associated to the current ontology).
(a) Turn Mixed Language to false (b) The error is reported in the Debug Frame
Figure 8: CG Editors, switching from LF in English to LF in French without MixedLanguage possibility
Syntactic and semantic analysis of LF and CGIF notations
Syntactic and semantic analysis of LF and CGIF notations depend on their grammars (for syntax) and on ontology (for semantic). The previous section illustrates one kind of semantic control: no identifier is associated to an abstract object (concept type, relation type or individual) in the lexicon of the specified language. This section presents other examples that concern syntactic and semantic control. Figure 9 shows examples of syntactic errors, concerning both LF and CGIF notations.
(a) Error: -> is expected instead of - (b) Error: another argument is expected
Figure 9: Syntactic errors in LF and CGIF formulations
Note by the way when these errors are identified: each switch, from CG notation tab to another notation tab and from language tab to another language tab, involves a call to the parsing operation. If there is an error, it is reported in the Debug frame and the switch abort.
Figure 10 shows two semantic controls: Figure 10.a illustrates the semantic constraint concerning CGIF that any refeered concept should be specified before the reference. Figure 10.b illustrates the semantic constraint that any identifier (of concept type, relation type, or individual) should be already known and specified in the current ontology. Another semantic control concerns the use of identifiers according to their declaration in the ontology: for instance, an identifier of a concept type (that is not a subType of Relation) can not be used as a relation type identifier. Also, an individual identifier can not be used as a concept type or a relation type identifier. Another semantic error detected by CGNotations GUI concerns conformity: if the user enters for instance the concept [Man: John Mary] in LF Editor and he/she asks for its CGIF reformulation, an error will be issued stating that there is an attempt to create a concept with an illegal designator.
Figure 10 : semantic errors in CGIF and LF
Note: the reader may note, from figures 9 and 10, that the localization of the error is not precise enough. Indeed, it needs some improvements.
Save/Open a CG File
CG, in LF, CGIF or Graphic form, can be saved (using the action File/Save or File/SaveAs) in a text file with the suffix "lnf" for LF or "cgf" for CGIF (these suffix are added implicitly by Amine). Of course, saved CGs can be opened later, using the action File/Open.
Multi CG Files
CGNotations GUI is a multi-document interface: it allows the edition of several CG files. Each CG file is edited in a CG file panel that includes languages panels and each language panel includes a CG notations editors. For the first time, CGNotations GUI comes with an untitled CG File panel. User can use this panel to enter a new CG and/or (s)he can open an existing CG file in a new panel (Figure 11).
Figure 11: Multi CG Files
Figure 12 shows the state of the GUI after opening two CG Files: "simpleCG1" and "compoundCG1".
Figure 12: Multi CG Files (continue)
Last, user has the possibility to close the current file/tab with the action File/Close/Current tab, and also the possibility to close all files/tabs with the action File/Close/All the tabs.
CG Graphic Editor inherits graph drawing facilities from Amine's GraphDrawing. Figure 13 illustrates the integration of these facilities in CG Graphic Editor view. The left vertical too bar provides: a) "Command cursor" button to return to the command mode, b) "Text cursor" button to edit the content of a concept or of a relation, c) "Concept" button to create a new concept, d) "Relation" button to create a new relation, e) "Rearrange" button to initiate the automatic drawing algorithm of the current CG, f) Zoom -/+ buttons to activate decrease/increase of the zooming of the CG. Recall that a CG in Amine is composed of one type of node (concept) and labelled directed links that represent dyadic relations between concepts.
Figure 13: CG Graphic Editor
Like any graph drawing editor, CG Graphic Editor provides the main operations of graphic edition of a graph: creation and edition of nodes (concepts) and edges (relations), selection of nodes and edges, move of nodes or of a subgraph, cut/copy/paste a node or a subgraph, etc.
Creation of a new concept: to create a new concept, user has to select/activate Concept button from the left vertical tool bar, then move the mouse to the desired position and then left click. A text field will be displayed where the user can enter/edit/update his new concept (Figure 14). Recall that in Amine, a concept is composed of four fields: [Type :Designator =Descriptor $State]. The state field is used in the context of Synergy language. Designator field is prefixed by ":" and the descriptor by "=".
However and since Amine 6, Amine accepts also the syntax of Standard CGIF notation which includes a specification for the syntax of a concept. See the section "Integration of Standard CGIF notation in Amine" in CG for more detail.
Edition of the content of a concept; with the "Text cursor" or the Edit action : To edit the content of a concept, user has to select, from the left vertical tool bar, the "Text cursor" button and click on the concept to edit. A text field will be displayed at the place of the concept to edit this later. Another possibility is to select action "Edit" from the concept popup menu. To edit a concept with CG as descriptor, user has to do a left double click on the concept (or to select "Show/Edit Content" from the concept popup menu). A new frame will be displayed that contains the CG.
Figure 14: Create and place a new concept
Specification/edition of the concept type: A "type list" appears and the user has to select one type from the list (Figure 14). This list specifies all types in the current ontology. To enter a new type, user has to use the Ontology GUI to add the new type to the ontology and then he/she can use the type in the edition of any CG. A CG can be composed of only elements (concept types, individuals and relation types) that exist already in the ontology. New elements should be inserted first in the ontology before using them in CG.
Once the type is selected and user presses "enter" key (from the keyboard), the CG graphic editor replaces the text field with a rectangle that encloses the string (Figure 15). Note that the concept, in this new form, is not directly editable; to edit the concept, user has to select/activate the "Edit cursor" button.
Figure 15: A concept drawn as a rectangle that encloses the content of the concept
Specification/edition of the concept's designator : in accord with Amine and with Standard CGIF notation for a concept, a designator can be an individual identifier, a set of individuals identifiers, a coreferent, a variable, a number, a CG, or any other Amine object. It can be also a combination of some of these elements. See CG for more detail. Once the user tape ":" after the name of the type, a popup list of individuals appears and user has to select one elements from the list (Figure 16). If the user has to enter something other than an individual identifier, he/she has to deactivate the popup list by a click on the right button of the mouse. A click on the left button activate (again) the popup list.
Figure 16: Edition of concept's designator
Specification/edition of the concept's descriptor: a descriptor of a concept can be any Amine object, including a CG. Figure 17.a illustrates some concepts with different kinds of descriptors (elementary descriptors like an integer or a string, composite objects like a set, a list or a term). Figures 17.b,c illustrate the case of a CG: to add/edit/show a descriptor that is a CG for a concept, user has to select the concept and then right click on it to get the concept's popup menu (Figure 17.b). From this menu, user should select/activate "Show/Edit Content" button/action to get a frame for the edition of the embedded CG (Figure 17.bc).
(a) different kinds of descriptors (b) add a CG descriptor for a concept
(c) A concept with a CG as descriptor
Figure 17: Edition of concept's descriptor
Move a concept: Of course, the concept can be moved to any position (Figure 18): select the concept with a left click and then perform a drag mouse to the desired position.
Figure 18: Moving a concept
Creation/Edition of a relation: to create a relation between two concepts, user has to left click on the source concept, then move the mouse to the target concept and left click on it. The drawing of the relation can be composed of several segments (Figure 19): user has to move the mouse and click on positions that correspond to the ends of the segments, the target concept is the last position. In both case (relation with only one segment or a relation with several segments), a "relation list" is displayed where the user has to select one element from the list.
Figure 19: Edition of a relation
Zooming: User can increase or decrease the zooming of the CG (Figure 20).
(a) decrease of the zooming factor
(b) increase of the zooming factor
Figure 20: Zooming the CG
Rearrange (automatic drawing of CG): at any time, user can select/activate the automatic drawing of the current CG, by using "Rearrange" button from the left vertical tool bar or from the popup menu (Figure 21).
Figure 21: Rearrange the CG (automatic drawing)
CG Graphic Editor popup menus: CG Graphic Editor provides four kinds of popup menus (Figure 22):
General popup menu (Figure 22.a): to display this popup menu, user has to right lick on an empty space of the graphic editor. This menu contains the following actions: a) "Paste" action to paste a concept (at the point of the click) or a subgraph, b) "Clear All" to clear the content of the graphic editor, c) "Select All" to select all the content of the graphic editor, d) "New Node" to create a new concept (at the point of the click), e) "New Edge" to switch to the "relation mode" (the cursor will change accordingly) and user has to left click on the source concept and then on the target concept to create a new relation, f) "Auto-arrange" to initiate an automatic drawing of the current CG.
Concept popup menu (Figure 22.b): to display this popup menu, user has to right click on a concept. This menu provides the following actions: a) Cut to cut a concept and Copy to copy a concept, b) Edit to edit the concept, c) "Show/Edit Content" to edit the concept descriptor which is a CG, d) "State" to edit the state of the concept.
Relation popup menu (Figure 22.c): to display this popup menu, user has to right click on a relation (relation name or a segment of the relation). This menu provides two actions: cut and edit. Cut to cut the selected relation and Edit to edit the name of the relation.
Selection popup men (Figure 22.d): this popup menu is displayed after a right click on a selection. It provides two actions: Cut to cut the selection and Copy to copy the selection.
(a) General popup menu (b) Concept popup menu (c) Relation popup menu (d) Selection popup menu
Figure 22: Graphic CG Editor popup menus