You are here:
/ Dashboard / Main / InteractiveSparqlQueryBuilder / InteractiveSparqlQueryBuilderBasicTutorial

Basic iSPARQL Tutorial

  1. In this Tutorial we will show how to add create RDF Instance using iSPARQL.
  2. Go to iSPARQL demo page.
  3. Click "Ok" in the shown Login form. By default should be shown user name demo and password demo.
  4. As result will be shown the iSPARQL home page, with opened tab "QBE" and default graph elements will be shown on the Canvas. Click the "Clear Pane" icon form the toolbar in order to empty the Canvas.
  5. Now we will import the Schemas that contain the Terms to be used in the our Graph Pattern. From the Schemas window click the down-arrow and from the list select the schema with URL: http://rdfs.org/sioct/types# and click the "Import" button. Perform the same steps for the schema with URL: http://rdfs.org/sioc/ns#
  6. As result in the Schemas window under "unbound" will appear new item sioct. Click its "+" icon in order to expand it.
  7. Click the "+" icon for the Concepts Node in order to expand it.
  8. Now scroll down the shown list and drag-and-drop the Subject Node "Weblog" on to the QBE working Canvas.
  9. This will create a Subject node of Datatype 'sioct:Weblog' at the point you dragged to. It's red because it is the currently selected item.
  10. In the Subject Node window are shown the properties of the selected node. Here you can:
    1. Change the Node type: URI or Literal,
    2. Change Node Variable label value
    3. Set Node's Datatype
    4. Set the visibility property of the "Variable" by hatching or un-hatching the "Visible?" checkbox
    5. Set participation in "Order By" by hatching or un-hatching the "Order By" checkbox
  11. Adding a new node you can do from the QBE toolbar. Click the "Add mode" icon and drag-and-drop an Object Node on to the Canvas.
  12. From the Object Node window change the type to Literal and change the Variable label value ?s.
  13. Add Datatype to node you can do either from the Schemas window or to enter it manually:
    1. Now we will import the FOAF schema that contains terms to be used in the our Graph Pattern. From the Schemas window click the down-arrow and select the FOAF schema.
    2. Click the button "Import".
    3. As result under "unbound" will appear a new item: foaf. Click its "+" link in order to expand it.
    4. Will be shown 2 Nodes for the foaf schema: Concepts and Properties.
    5. Click on the Document item from the Concepts Node and drag-and-drop it on to the Node with literal type that we have created before.
    6. As result, for the selected note with literal type, in its Node window the Datatype will change to foaf:Document.
  14. Add more nodes you can do by clicking the "Add mode" icon from the QBE toolbar.
  15. Delete a node you can perform for selected node(s). Select for ex. the Node with Variable label ?s and click the "Remove" button from the QBE toolbar. You will be prompt for deletion verification. Click the button "Ok".
  16. Add connections can be done by clicking the "Connector" icon from the QBE toolbar and from a node drag to another node(s).
    1. For example, for node with Variable label ?forum drag connection to the ?post node.
    2. As result a connection will be shown between the two nodes and a Connector window will be shown above the Schema window, as this is the property window for the current selected connection.
    3. Enter in the Res Type field the value sioc:container_of and un-check the Visible?check-box.
    4. Click the "Connector" icon from the QBE toolbar and from the ?post node drag to to the ?maker node.
    5. In the Connector window check the Optional? check-box and un-check the Visible? check.box.
    6. Now we will add type for this connection. The type can be an "Attribute" (A) or "Relationship" (R) property from the schema window. "Attribute" (A) items are shown under each schema imported / Properties with icon green letter "A". "Relationship" (R) items are shown under each schema imported / Properties with icon blue letter "R". From the Schemas window go to foaf->Properties and drag the "Relationship" (R) property maker item onto the selected connection from the Canvas.
    7. As result in the Connector window for field Res Type the value will change to foaf:maker. Note that the connection line between the nodes ?post and ?maker is not solid as we set its property in the Connector window to be optional.
    8. Click the "Connector" icon from the QBE toolbar and from the ?maker node drag to the ?nick node.
    9. In the Connector window check the Optional? check-box and un-check the Visible? check-box. Enter for Res Type: foaf:nick
  17. The Final Graph Model can be viewed in the QBE working pane.
  18. Querying
    1. We have the final graph model. Before performing a querying, we need to set a proper Graph URI. For this, change the value from the Data Source URI field to: http://demo.openlinksw.com/dataspace
    2. Click the "Run" Query" button from the QBE toolbar.
    3. The results of the query will be shown in the Results tab bellow the QBE Working Canvas Area.
    4. You can view also the query results in machine readable output
    5. View the SPARQL paramaters values from the SPARQL Params tab:
      1. request:
      2. View the response values from the Response tab:
      3. View the SPARQL query produced from the graph model you have built from the Query tab:
  19. Save the Graph Model:
    1. Click the "Save As" icon from the QBE toolbar.
    2. As result will be opened the WebDAV Browser.
    3. Select a destination folder and enter in the "File name" field a file name, for ex. MySimpleTest?, and select for "File type": SPARQL Definitions (*.rq). You may also want to save the SPARQL query produced from the Graph Model in XML format, by choosing to select the file with type: Dynamic Data Web Page (*.isparql).
  20. Generate SPARQL Query from the Graph Model:
    1. Go to QBE tab.
    2. Click the "Generate" icon from the toolbar.
    3. As result will be opened the Advanced tab with SPARQL Query text-area containing the generated from the Graph SPARQL query.
    4. Use the Prefixes, Templates and Statement Help drop-down lists shown above the SPARQL Query text-area to format the SPARQL Query.
      • Note: You can revert your changes by clicking the "Get from QBE" button from the Advanced tab toolbar.
    5. Now in the SPARQL Query Working area from the Advanced tab add a new optional node to the query for foaf:phone and add order by clause for ?nick.
    6. In order to apply the query changes to the Graph model click the "Visualize" button from the Advanced tab toolbar.
  21. Change Output format and set results rows:
    1. Go to QBE tab.
    2. At the bottom of the page change from Human readable to Machine readable and select Max Rows number.
  22. Adding dataset:
    1. From the QBE toolbar click the button "Dataset".
    2. Choose Type and enter Data Source URI value.
    3. Click the button "Add".

Other iSPARQL Features

  1. Auto arrange of the Graph Model:
    1. Go to QBE tab.
    2. Click the "Auto" arrange" icon from the toolbar.
    3. As result the Graph model will be changed so to be more compact.
  2. Group selected nodes of the Graph Model:
    1. Go to QBE tab.
    2. Selected several nodes from the Graph. You can do this by selecting the nodes holding the "Schift" key from your keyboard.
    3. Click the "Group Selected" icon from the toolbar.
    4. As result the selected nodes will be shown on the Canvas in one-color area as grouped. You may want to set from the Group window which will be shown above the Schemas window:
      1. Change the Group Type: Graph, Optional, Union or Construct
      2. Set Group's ID label.
  3. Add Named Graph(s) to the SPARQL query:
    1. Go to the Advanced tab.
    2. Go to the Named Graph(s) sub-tab.
    3. In the shown form enter value for "Named Graph" and click the button "Add".
    4. Right aligned to the sub-tab Named Graph(s) will be shown the number of added Graphs.
  4. Add statement to the SPARQL query:
    1. Go to the Advanced tab.
    2. You can add statement to the SPARQL Query either from the --Statement Help-- drop-down list or from the shortcut button "Statement Help" shown right after it.
    3. Click the button "Statement Help".
    4. As result will be shown the Statement Help- window. To add a statement, simply click on its name from the window.

Virtuoso and the Virtuoso Website are Copyright (C) OpenLink Software 2006-
SourceForge.net Logo