As I stated earlier, after some time you can become comfortable enough with RDF/XML to read and write the documents manually. But why bother? If you need to manually write an RDF/XML document, you're better off doing so with a specialized RDF editor.
One of the more popular editors is IsaViz, a visual RDF/XML editing tool written in Java. In fact, like so many other RDF/XML tools, it makes use of many of the Jena classes, making Jena the most commonly used API of all (which is why it has its own chapter).
Once you've downloaded and installed IsaViz, you can run it using
on Unix or OS X or
IsaViz opens as a new project; you can either manually start creating a new RDF model or import one in either N-Triples format or from RDF/XML. We'll start with importing the test RDF/XML document into the editor, just to see how it works. You can import an existing document by selecting File, and then Import, and then selecting whether to Merge the model into the existing project or Replace it. Since the existing project doesn't have any model elements, I picked Replace and then provided the URL for the RDF/XML document.
In a surprisingly short amount of time, IsaViz loaded the model and displayed an RDF graph of it in the graph frame, as shown in Figure 7-4.
Figure 7-4. Importing monsters1.rdf RDF/XML document into IsaViz project
The full view of the model is a bit hard to read, but if you right-click on portions of the model in the Graph frame, the focus changes and the view zooms in so that you can look at the details. Left-clicking on any of the items in the model displays attribute information about the item in the Attributes frame. The complete listing of properties is shown at the bottom, in the Definitions frame. Project and model management is managed in the last frame, the Editor.
Clicking on the model, zooming in to the top resource, and left-clicking displays attribute information, as shown in Figure 7-5.
Figure 7-5. Attributes for resource
Clicking the Delete button
Figure 7-6. Properties for resource
The bottom frame window of IsaViz contains three tabbed windows, one showing the namespaces in the model, one showing the property types, and one showing the properties for the selected resource. You don't have to click on the resource within the graph to select it ”you can also use the Edit menu in the IsaViz Editor window and search for a specific resource or object value.
You can zoom in on the model, by clicking the Shift key and then right-clicking in the model and dragging to the top to zoom in and to the bottom to zoom out. Holding the Shift key and clicking on a specific item also recenters the window on that item. To move around the model, right-click
If you want to select a portion of the graph, click the Select icon in the IsaViz Editor window and then click on whatever you want to select. If you want to select a resource and all of its predicates, hold the Shift down as you select the item. The selected items are highlighted in a bold outline, as shown in Figure 7-7.
Figure 7-7. Selected
REJ has a simple interface, which makes it
Just to see how the tool works, I opened the test RDF/XML document. To the right of the document window is a little ruler. If you move the glider, the element selected changes, as shown in Figure 7-10.
You can also move the selection by clicking the plus (+) button to move up, and the minus (-) button to move the selection down. The element's position relative to the rest of the page is shown in the window below the ruler.
Once an element is selected, you can delete it and replace the element. For instance, in Figure 7-10, clicking the Remove button removes the text. Clicking on the Text radio button to the left of the control bar at the bottom sets the page up for accepting a literal. Once the value is entered in the field next to the Text radio button, I click the button
You can also add new elements, attributes, namespaces ”all using the control bar at the bottom, which changes to fit whatever option you're in, as shown in Figure 7-11. Once you've added the new element, you can then add literals, other elements, and attributes to it.
Once you're finished with the model, you can save the RDF/XML document to a new or existing file. You can also generate an N-Triples report from the model by selecting Tools and then selecting the N-Triples Report. The results are printed out in the bottom window and can also be saved.
Not a lot of