.. _section-KB Graph: KB Graph ~~~~~~~~ The **KB Graph** plugin can be used to visualize how individuals in the KB are related based on selected properties. In the **Sunflower** project navigation tree, double click family.flr to load it. Click the **KB Graph** tab to launch the plugin. Initially all individual instances and properties in the KB are included in the graph, showing individuals in **gray** and property values in **green**. This is the **Instances** view, as seen in :numref:`figure-KB-Graph-initial-view.png`. .. _figure-KB-Graph-initial-view.png: .. figure:: ../../figs/KB-Graph-initial-view.png :alt: The initial view of family.flr in **KB Graph** The initial view of family.flr in **KB Graph** Located to the left across the top of the **KB Graph** window is the **Limit To Properties** input bar. The graph can be filtered to include only those properties entered here. The **Quick Search** input bar, located at the bottom of the window, is used to look up individuals in a busy graph. These 2 input bars are highlighted in :numref:`figure-KB-Graph-initial-view2.png`. .. _figure-KB-Graph-initial-view2.png: .. figure:: ../../figs/KB-Graph-initial-view2.png :alt: **Limited To Properties** and **Quick Search** in **KB Graph** **Limited To Properties** and **Quick Search** in **KB Graph** Type **spouse** in the **Limit To Properties** input bar and hit return. The graph is reduced to those individual instances in the KB with spousal relationships, as seen in :numref:`figure-KB-Graph-spouse.png`. .. _figure-KB-Graph-spouse.png: .. figure:: ../../figs/KB-Graph-spouse.png :alt: **KB Graph** showing spousal relationships **KB Graph** showing spousal relationships Next to **spouse**, type a comma followed by **child** and hit return. This adds all child relationships in the KB to the graph, as seen in :numref:`figure-KB-Graph-spouse-child.png`. In general, multiple properties, separated by commas, can be entered in **Limit To Properties** to view KB relationships based on the set of selected properties. .. _figure-KB-Graph-spouse-child.png: .. figure:: ../../figs/KB-Graph-spouse-child.png :alt: **KB Graph** showing both spousal and children relationships **KB Graph** showing both spousal and children relationships The **View Dependencies from Selected Node** and **View Dependencies to Selected Node** filters, as illustrated in :numref:`figure-KB-Graph-window.png`, are for viewing connections from the perspective of a single individual. Since these 2 filters must be applied to an individual, they become activated only after an individual is selected in the graph. .. _figure-KB-Graph-window.png: .. figure:: ../../figs/KB-Graph-window.png :alt: The **View Dependencies from Selected Node** and **View Dependencies to Selected Node** icons in **KB Graph** The **View Dependencies from Selected Node** and **View Dependencies to Selected Node** icons in **KB Graph** Click to select individual **Greg**. This node turns **yellow** indicating it is now the selected node. All other nodes which have **spouse** or **child** relationships to **Greg** are also highlighted, using different colors for different relationships, as seen in :numref:`figure-KB-Graph-greg.png`. Also notice that the **View Dependenices from Selected Node** and **View Dependencies to Selected Node** filters are now enabled. To select a new node, simply click the new node to switch. To deselect the currently selected node without selecting a new node, simply click anywhere in the background of the **KB Graph** window. .. _figure-KB-Graph-greg.png: .. figure:: ../../figs/KB-Graph-greg.png :alt: **KB Graph** with **Greg** highlighted **KB Graph** with **Greg** highlighted With **Greg** selected, uncheck the filter **View Dependencies to Selected Node** to suppress spouse and child relationships to Greg. The graph is updated to reflect spouse and child relationships from **Greg**, as shown in :numref:`figure-KB-Graph-spouse-child-from-Greg.png`. .. _figure-KB-Graph-spouse-child-from-Greg.png: .. figure:: ../../figs/KB-Graph-spouse-child-from-Greg.png :alt: **KB Graph** showing spouse and child relationships from **Greg** **KB Graph** showing spouse and child relationships from **Greg** Click **Reset** to restore the graph to the default **Instances** view. Repeat typing **spouse,child** in **Limit To Properties** and hit return, then click to select **Greg**. Uncheck the filter **View Dependencies from Selected Node** this time. The graph is updated to show spouse and child relationships from other individuals to **Greg**, as seen in :numref:`figure-KB-Graph-spouse-child-to-Greg.png`. Note that placements of individual nodes in the **Instances** view after a **Reset** may be slightly different each time. .. _figure-KB-Graph-spouse-child-to-Greg.png: .. figure:: ../../figs/KB-Graph-spouse-child-to-Greg.png :alt: **KB Graph** showing spouse and child connections from other individuals to **Greg** **KB Graph** showing spouse and child connections from other individuals to **Greg** Do **Reset** again to return to the default view. Click in the background to deselect **Greg**. Double click individual **Isobel** in the graph. This produces a relationship graph centered on **Isobel**, as seen in :numref:`figure-KB-Graph-Isobel1.png`. In general, double clicking an individual in the graph filters the graph on that individual and limits the graph to relationships pertaining to that individual. .. _figure-KB-Graph-Isobel1.png: .. figure:: ../../figs/KB-Graph-Isobel1.png :alt: **KB Graph** centered on **Isobel** **KB Graph** centered on **Isobel** Type **child** in "Limit To Properties". This reduces relationships in the graph to only child relationships for **Isobel**, namely, **Emma** and **Eric** have child **Isobel**, and **Isobel** has child **Otavio**, as seen in :numref:`figure-KB-Graph-Isobel2.png`. .. _figure-KB-Graph-Isobel2.png: .. figure:: ../../figs/KB-Graph-Isobel2.png :alt: **child** relationships for **Isobel** **child** relationships for **Isobel** The **Quick Search** utility located at the bottom of **KB Graph** can help highlight a node in a busy graph. A list of possible choices for highlighting is available by typing **CTRL + Space** in the **Quick Search** input bar, as shown in :numref:`figure-KB-Graph-ctrl-space.png`. .. _figure-KB-Graph-ctrl-space.png: .. figure:: ../../figs/KB-Graph-ctrl-space.png :alt: **CTRL + Space** reveals a list of possible choices for **Quick Search** **CTRL + Space** reveals a list of possible choices for **Quick Search** The little **blue i** icon to the left of the input bar, when hovered over with the mouse, shows a helpful reminder message of the **CTRL + SPACE** choice list, as shown in :numref:`figure-KB-Graph-ctrl-space-i.png`. .. _figure-KB-Graph-ctrl-space-i.png: .. figure:: ../../figs/KB-Graph-ctrl-space-i.png :alt: Message displayed when **blue i** icon is hovered over Message displayed when **blue i** icon is hovered over To use **Quick Search** to highlight a node, do **Reset**. Click inside the **Quick Search** input bar to enable input. Either directly type **Isobel** or use **CTRL + Space** and select **Isobel** from the list, then hit return. The **Isobel** node changes color to **yellow** and becomes easily identified in the graph, as seen in :numref:`figure-KB-Graph-Isobel.png`. Note that **Quick Search** is case insensitive, which means inputting **isobel** or **Isobel** will find and highlight the same node. .. _figure-KB-Graph-Isobel.png: .. figure:: ../../figs/KB-Graph-Isobel.png :alt: Node **Isobel** is highlighted in **KB Graph** using **Quick Search** Node **Isobel** is highlighted in **KB Graph** using **Quick Search** To highlight multiple nodes using **Quick Search**, simply add additional names one after another in the input bar, separated by commas. For example, after **Isobel**, type **,Carla,John,Louisa** and hit return. This will highlight additional nodes **Carla**, **John** and **Louisa**, as shown in :numref:`figure-KB-Graph-Isobel-Carla-John-Louisa.png`. Another way to highlight a group of nodes in **KB Graph** is to use the click and drag method to define a rectangular region within the graph. When the mouse is released, nodes encompassed within the rectangular region will be highlighted. .. _figure-KB-Graph-Isobel-Carla-John-Louisa.png: .. figure:: ../../figs/KB-Graph-Isobel-Carla-John-Louisa.png :alt: Nodes **Carla**, **John** and **Louisa** are also highlighted Nodes **Carla**, **John** and **Louisa** are also highlighted In **KB Graph**, a highlighted node can be dragged to another location in the graph. If there are multiple highlighted nodes, they move together as a group when one of the highlighted nodes is dragged. :numref:`figure-KB-Graph-Isobel-Carla-John-Louisa-moved.png` shows the effect of clicking to highlight node **Isobel** then dragging it to the right. Other highlighted nodes **Carla**, **John** and **Louisa** are moved in the same manner as well. .. _figure-KB-Graph-Isobel-Carla-John-Louisa-moved.png: .. figure:: ../../figs/KB-Graph-Isobel-Carla-John-Louisa-moved.png :alt: Nodes **Isobel**, **Carla**, **John** and **Louisa** are relocated as a group Nodes **Isobel**, **Carla**, **John** and **Louisa** are relocated as a group Nodes highlighted using **Quick Search** can be deselected by removing their names in the **Quick Search** input bar and hitting return. Alternatively, a mouse click anywhere in the backgroud will also deselect highlighted nodes. Class Diagram +++++++++++++ Besides being used to display relationships among individual instances, **KB Graph** can also be used to display relationships among classes based on properties selected. The **Classes** button in the **KB Graph** window, as shown in :numref:`figure-KB-Graph-class-button.png`, is used for showing class relationships. .. _figure-KB-Graph-class-button.png: .. figure:: ../../figs/KB-Graph-class-button.png :alt: **Classes** button in **KB Graph** **Classes** button in **KB Graph** With family.flr loaded in **Sunflower**, click to launch the **KB Graph** plugin. In the **KB Graph** window, type **spouse,child** in the **Limit To Properties** input bar and hit return. Spouse and child relationships of individuals are displayed in the **KB Graph** window, as seen in :numref:`figure-KB-Graph-spouse-child.png`. Now switch to **Classes** mode by selecting the **Classes** button. The **Person** class to which the 2 selected properties belong is now displayed in the **KB Graph** window, as shown in :numref:`figure-KB-Graph-spouse-child-as-class.png`. The self referencing arcs emanating from **spouse** and **child** indicate that both properties are instances of the **Person** class, as defined in family.flr. .. _figure-KB-Graph-spouse-child-as-class.png: .. figure:: ../../figs/KB-Graph-spouse-child-as-class.png :alt: **KB Graph** shows **Person** class to which properties **spouse** and **child** belong **KB Graph** shows **Person** class to which properties **spouse** and **child** belong Add **height** to the **Limit To Properties** input bar, and hit return. The **height** property is not added to the **KB Graph**, as shown in :numref:`figure-KB-Graph-spouse-child-height-as-class-1.png`. This is because the **eng_val#Length** class to which **height** belongs is not defined in the local file family.flr. .. _figure-KB-Graph-spouse-child-height-as-class-1.png: .. figure:: ../../figs/KB-Graph-spouse-child-height-as-class-1.png :alt: Property **height** does not show up with class it belongs to in **KB Graph** Property **height** does not show up with class it belongs to in **KB Graph** To see **height** added to **KB Graph**, check the **Show All Resources** box to include classes from other imported resources. Then property **height** and class **eng_val#Length** show up, as illustrated in :numref:`figure-KB-Graph-spouse-child-height-as-class-2.png`. .. _figure-KB-Graph-spouse-child-height-as-class-2.png: .. figure:: ../../figs/KB-Graph-spouse-child-height-as-class-2.png :alt: **KB Graph** shows the **eng_val#Length** and **Person** classes to which the 3 properties: **spouse**, **child** and **height** belong **KB Graph** shows the **eng_val#Length** and **Person** classes to which the 3 properties: **spouse**, **child** and **height** belong