Here is a step-by-step tutorial for building an arbitrary hierarchy of linked nodes from scratch in the outline view. This could be done in a new store that you've just created, or in an existing store (as long as it's OK to modify it). Make sure that the store is opened in read/write mode rather in read-only mode, as needed for creating triples. Also make sure that the option Outline Options | Create All Nodes as Blank Nodes is not on.
You may want to resize Gruff and the window that's displaying this tutorial text, so that you can refer back to the text while pop-up menus are being displayed by Gruff.
* After creating or opening a store, first use View | Outline View to show the outline view. If there is any content in the outline view, then use Remove | Remove All Nodes to clear the view.
* Right-click the background and invoke the command Outline View Editing | Create Item for a New Triple. (That will be the only command on the pop-up menu when there is no content yet.)
* A pop-up menu will appear, asking for the way that you'd like to specify a new node. Select "Enter a Node URI or Literal String". If a menu of suggested namespaces then appears, select the first choice "Other Namespace", because the namespace that we want to use is (probably) not in the list.
* You will then be prompted to enter a string that names a node for the outline item to represent. When you see a flashing text cursor, enter the string "http://franz.com/simple#animal", and press the Enter key to accept that name. Do not include the double-quote characters, because that would create a literal, whereas we want to create a resource for that URI instead. This will intern a resource for a new node, but will not create any triples; a triple would be created only when the new outline item has a parent item to link with it.
* The new node will appear simply as "Animal" in the outline item. To see the full URIs of all resources that are in the outline, use Outline Options | Show Full URIs in Outline. The 8 key (on the main part of the keyboard) is the keyboard shortcut for that menu bar command, so you could frequently press 8 to toggle between showing full URIs and showing more easily readable "pretty" labels. For now, press 8 as needed to show the shorter labels.
* Now we are ready to create a triple by specifying a second new node, along with a predicate with which to link it to the first node. First right-click the new node for Animal to show the pop-up menu again. This is the outline view's editing menu, which will contain several commands now that there is an outline item to which commands can be applied. Most of the commands will conceptually "edit" a triple in some way, by deleting one triple and creating a replacement triple, though the commands in the second section simply create OR delete a triple.
* From the pop-up menu, invoke the command Outline View Editing | Create Item for a New Triple. (This is the same command that we used before.)
* A first pop-up menu for this command will ask whether you want to create a child or a sibling of the currently selected outline item. Select "Create Child Item". A new blank outline item will then appear just below the first item. It will be indented to the right of the first item to indicate that it is a "child" of the first item, which is the "parent" of the new item. This means that those two items represent a triple that links the nodes of the outline items. Note that the parent/child relationship pertains only to the way that the information is being displayed in the outline view, and does indicate the type of relationship that the two nodes have with each other in the triple store.
* The next pop-up menu will ask for the "direction" that the triple between the new nodes should have. Select "New Node is Object of Triple with Parent" to indicate that the node of the child outline item will be the object of a triple that you are creating, and the node of the parent outline item will be the subject of the triple. (This may be a relatively tricky point that should become clear later.)
* We now need to specify the predicate for the new triple. The first step is to specify the desired way to select a predicate, on the next pop-up menu that appears. It's problematic to choose from a large set of predicates, so this menu lets you select from one of various subsets of predicates. Select the choice "Common Predicates". The next pop-up menu will then list an arbitrary set of several often-used standard predicates. Choose "Narrower" from that list, which stands for skos:narrower (notice the full URI in the status bar as you highlight that menu choice). The word Narrower will then appear in the new outline item.
* And finally it's time to specify the node for the new outline item, which will be linked to the node of the parent outline item by a new triple. As before, a pop-up menu will ask which way you'd like to specify the node. Select "Enter a Node URI or Literal String" as before.
* This time when the menu of suggested namespace appears, it should include the choice "http://franz.com/simple#" that you typed in explicitly for the first node. Select that choice from the menu so that you don't need to type it in again.
* This time when you are prompted to enter the text, the namespace that you selected will appear as a starter string, with the text cursor at the end of it. At this time, simply type the string "goat" at the end of the namespace string and press Enter.
* Now that the new child outline item has been fully specified, a triple is created that links the item's node with the node of the parent item. The parent item says "Animal" and the child item says "Narrower Goat", which means that the triple "Animal Narrower Goat" exists in the store. Press the 8 key as usual to see all of the full URIs of the triple, and then again to return to the shorter labels.
* That general command for creating a new triple from scratch involved quite a few steps. But there are a couple of shortcut commands for the common case where you are creating multiple triples that use the same predicate. To try this out, right-click the Goat item, and this time invoke the command Outline View Editing | Create Sibling for Same Predicate. This will skip the menus for specifying the predicate and the "direction" of the new triple, and instead copy that information from the triple that links the nodes of the selected outline item and its parent item. As before, select the choice to enter a URI for the new node, and then the franz.com/simple namespace, and this time enter "hamster" as the name of the new node.
* Another way to add items more quickly is to use keyboard shortcuts. The keystrokes that are shown to the right of each command in the pop-up menu are ones that you can use without showing the menu at all. Right-click again and notice that the shortcut for "Create Sibling for Same Predicate" is the N key. Also notice the "access keys" that are printed along the left side of the menu. These are keys that you can press to select a menu command if you did show the menu. (You can also press the M key to initially show the editing menu in any view, or Shift-M to show the navigation menu.) Press Escape to dismiss the pop-up menu.
* To add another sibling item by using keyboard shortcuts, first make sure that the Hamster item is selected, and press the N key (without using the shift key), which is the shortcut for adding a sibling item. Then press the E key to select the menu choice for enterring a URI for the new node, and finally press whatever letter key is at the left side of the next menu for the franz.com/simple namespace. This time enter "fish" for the name of the new node.
* You may have noticed that so far we are creating a subclass tree, and wondered why we're not using the rdfs:subClassOf predicate. In this tutorial, that's simply to avoid any confusion from the fact that subClassOf is defined "backwards" with respect to a subclass outline. If you use that predicate and want to add a new subclass that's shown as a child outline item of its superclass, then you'll need to select "New Node is Subject of the Triple with Parent" when prompted for the triple direction, since the predicate is subClassOf rather than "subClass" or "hasSubClass". Also, by default the outline item will awkwardly say "is Sub Class Of of", to follow the general rule that's not so clear for this particular predicate. As a special exception for subClassOf, you can turn on Global Options | Derived Node and Link Labels | Display subClassOf as "Superclass", which will cause the outline item to say "Subclass". But for this tutorial we will use the predicate skos:narrower, which is more intuitive for an outline.
* You may also notice at this point that our tree is not quite right, because goats and hamsters are kinds of mammals, and mammal should be a sibling of fish in the tree. This is no problem, because we can insert a node for mammal and then shift goat and hamster under it. First select the Animal item, and press the C key to invoke the general command from the editing pop-up menu for creating an outline item. Add a child item as before, naming this one "mammal".
* The outline items from top to bottom should now be Animal, Mammal, Goat, Hamster, and Fish. We want to select Goat and shift it under Mammal, but first let's learn how to select Goat with the keyboard. Shift-right-click any item (or type Shift-M) to see the outline view's navigation menu. This is a separate pop-up menu from the editing menu that we have used so far. Some of the commands on the navigation menu are rather awkward to use from the menu itself, so just notice toward the right side of the menu that J is the keyboard shortcut for Outline View Navigation | Move Down to Next Node, and K is the shortcut to move up to the previous node. Press Escape to cancel the menu, and then press the J and K keys as needed to select Goat.
* Now we're ready to make Goat be a kind of Mammal rather than directly a kind of Animal. With the Goat item selected, press the M key to show the editing pop-up menu. Toward the bottom of the menu, note that the keyboard shortcut for Outline View Editing | Shift Rightward is Control->. But since we've shown the menu, press R to invoke that command from the menu. You will see Goat shift to the right so that it is now indented under Mammal. Internally, this deletes the triple Animal Narrower Goat and creates the triple Mammal Narrower Goat. (Notice the status bar for a message about the triple creation and deletion.)
* Next press J to select Hamster, and type Control-> to similarly shift it under Mammal. (Type Control-> by holding down the Control key and the pressing the period key, whose shifted character (at least on US English keyboards) is the greater-than character.) This shifting behavior is unique to the outline view, and makes it easy to intuitively edit a hierarchy of linked nodes such as an ontology.
* There are many more commands on both of the pop-up menus and the menu bar in the outline view that we have not covered in this tutorial. Please explore them, and remember that you can highlight any menu command and press F1 to see the help for that particular command.
* A good approach for creating an entire store in Gruff is to use the outline view to build hierarchies or ontologies such as subclasses and instances, and then use the table view to add and edit properties of individual instances. See the table view's right-click editing menu for commands for editing properties. And if nodes that have the same type often have some of the same properties, then it may be especially handy to use Edit | Edit Selected Node by Type directly from the outline view, to edit the properties of the selected instance node.
|Copyright © 2015 Franz Inc., All Rights Reserved | Privacy Statement||