.. _section-Semantic Content Assistance: Semantic Content Assistance ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Eclipse auto-completion keyboard short-cut (usually **CTRL-space**) activates the Semantic Content Assist feature in **Sunflower**. This feature offers auto-completion and suggestion of appropriate content based on current context being edited. Below we will give some examples of the feature. Scroll to the end of the **Sunflower Text Editor** window, type **CTRL-space**. A Semantic Content Assist menu pops up, offering **Create a fact**, **Create a rule** and **Create a query** as the top level input choices, as seen in :numref:`figure-Text-Editor-Semantic-Assistance-1.png`. .. _figure-Text-Editor-Semantic-Assistance-1.png: .. figure:: ../../figs/Text-Editor-Semantic-Assistance-1.png :alt: Possible top level input choices in a list Possible top level input choices in a list Select **Create a fact** and hit return. A line with the initial content **fact.** gets inserted in the **Text Editor**. Type **CTRL-space** again, a 2nd level Semantic Content Assist menu pops up, offering the next set of appropriate choices when creating a fact. These include **create an instance of a class** and **create a subclass of a class**, as shown in :numref:`figure-Text-Editor-Semantic-Assistance-2.png`. .. _figure-Text-Editor-Semantic-Assistance-2.png: .. figure:: ../../figs/Text-Editor-Semantic-Assistance-2.png :alt: Possible context types after user specifies intent to create a fact Possible context types after user specifies intent to create a fact Choose **create an instance of with properties** and hit return. A line which contains **newIndividual : newClass [ ]** is inserted in the **Text Editor**, with **newIndividual** highlighted, as shown in :numref:`figure-Text-Editor-Semantic-Assistance-3.png`. .. _figure-Text-Editor-Semantic-Assistance-3.png: .. figure:: ../../figs/Text-Editor-Semantic-Assistance-3.png :alt: Initial **create an instance of** statement from Semantic Context Assist Initial **create an instance of** statement from Semantic Context Assist The highlighted field indicates the **Text Editor** is ready for its input. Type **Michael** to replace **newIndividual**, followed by a tab character. The tab character advances the input focus to the next field **newClass**. With **newClass** as the new input field, Semantic Context Assist offers a menu of possible classes to choose from, as seen in :numref:`figure-Text-Editor-Semantic-Assistance-4.png`. This list of possible classes is derived from the classes in the import closure. .. _figure-Text-Editor-Semantic-Assistance-4.png: .. figure:: ../../figs/Text-Editor-Semantic-Assistance-4.png :alt: Semantic Context Assist offers choices for a possible class Semantic Context Assist offers choices for a possible class Choose **Man** and hit return. The input cursor advances to the inside of the frame symbol **[ ]**. Type **CTRL-space** to invoke Semantic Context Assist and see it offer a menu with the choice to add the first property to the instance we are creating, as shown in :numref:`figure-Text-Editor-Semantic-Assistance-5.png`. .. _figure-Text-Editor-Semantic-Assistance-5.png: .. figure:: ../../figs/Text-Editor-Semantic-Assistance-5.png :alt: Semantic Context Assist offers choice to add first property Semantic Context Assist offers choice to add first property Choose **Add first property** and hit return. A menu pops up with a list of properties for class **Man**, as well as a potential **newProperty**, as seen in :numref:`figure-Text-Editor-Semantic-Assistance-6.png`. The property list offered depends on the class in context. Semantic Context Assist offers properties specifically for **Man** because we are creating an instance of class **Man**. .. _figure-Text-Editor-Semantic-Assistance-6.png: .. figure:: ../../figs/Text-Editor-Semantic-Assistance-6.png :alt: Semantic Context Assist lists all current properties of class **Man** Semantic Context Assist lists all current properties of class **Man** Choose an existing property such as **birthDate** and hit return. The property name **birthDate** is added to the instance, and the cursor is advanced to the input position of the the property value, as shown in :numref:`figure-Text-Editor-Semantic-Assistance-7.png`. .. _figure-Text-Editor-Semantic-Assistance-7.png: .. figure:: ../../figs/Text-Editor-Semantic-Assistance-7.png :alt: Property **birthDate** is inserted and cursor advances to property value input position Property **birthDate** is inserted and cursor advances to property value input position Type in **"1975-10-06"^^\date** for the value, followed by **CTRL-space** to call up the Semantic Context Assist menu choices again. This time the list of menu choices contains **Add another property** to allow another property to be added, as shown in :numref:`figure-Text-Editor-Semantic-Assistance-8.png`. .. _figure-Text-Editor-Semantic-Assistance-8.png: .. figure:: ../../figs/Text-Editor-Semantic-Assistance-8.png :alt: After adding the first property, **CTRL-space** offers the choice of adding another property After adding the first property, **CTRL-space** offers the choice of adding another property After specifying the value of the 2nd property, Semantic Context Assist can be invoked again with **CTRL-space** to add yet another property. Note that the file being edited must be saved in order for Semantic Context Assist to pick up the changes made and offer them as updated menu choices.