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

iSPARQL Querying Tutorial with SPARQL Query type "SELECT".

In this tutorial we will show how to execute a SPARQL query with type "SELECT". A rich list of Virtuoso SPARQL Queries you can find in the References section.

Enter a query and execute

  1. Choose a SPARQL query from the References list. For example, let's use the SPARQL query, which dumps all Weblog Posts for a given ODS Member "demo". You can find this SPARQL Query in the ODS SPARQL Queries list and also in the ODS Weblog SPARQL Queries list.

    prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix sioc: <http://rdfs.org/sioc/ns#> prefix sioct: <http://rdfs.org/sioc/types#> prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix dct: <http://purl.org/dc/elements/1.1/> prefix dcc: <http://purl.org/dc/terms/> select DISTINCT ?forum_name, ?post, ?title, ?cr, ?url from <http://demo.openlinksw.com/dataspace> where { ?forum a sioct:Weblog . ?forum sioc:id ?forum_name. ?forum sioc:scope_of ?role. ?role sioc:function_of <http://demo.openlinksw.com/dataspace/demo#this> . ?forum sioc:container_of ?post. optional{?post dct:title ?title}. optional{?post dcc:created ?cr}. optional{?post sioc:link ?url}. } order by DESC (?cr)

  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. Change the "Data Source URI" field value from the QBE tab to: http://demo.openlinksw.com/dataspace as the query we are going to execute will be against the database with this Graph.
  6. Go the Advanced tab.
  7. Change the "Graph" value also to: http://demo.openlinksw.com/dataspace and enter in the "SPARQL Query" text-area the query we have chosen above:
  8. Click the "Run Query" button from the Advanced tab.
  9. The Result sub-tab shown bellow the Advanced SPARQL Query Working Canvas will present by default in a Human readable mode the results of executing our SPARQL Query.
  10. You can change the results table columns width by dragging the ends of the column labels:
  11. You can change the output viewable mode to Machine readable
  12. View the SPARQL Query as Graph model you can do by clicking the "Load Query to QBE" button shown in the Toolbar with Result, SPARQL PArams, Response and Query sub-tabs.
  13. Now we will enter a different SPARQL query to execute, in order to view how the navigation buttons, shown as gray-out blue arrows in the toolbar of the Results tab are working.
    1. Suppose we are on the Advanced tab. Change the SPARQL Query with the following one

      prefix sioc: <http://rdfs.org/sioc/ns#> prefix sioct: <http://rdfs.org/sioc/types#> prefix dct: <http://purl.org/dc/elements/1.1/> prefix dcc: <http://purl.org/dc/terms/> select ?forum_name, ?channel, ?item_title, ?created from <http://demo.openlinksw.com/dataspace> where { ?forum a sioct:SubscriptionList; sioc:id ?forum_name. ?forum sioc:scope_of ?role. ?role sioc:function_of <http://demo.openlinksw.com/dataspace/demo#this> . ?forum sioc:parent_of ?channel . ?channel sioc:container_of ?post . optional{ ?post dct:title ?item_title }. optional{ ?post dcc:created ?created }. } limit 20

    2. Click the "Run Query" button from the Advanced tab toolbar.
    3. The Result sub-tab will present the results of executing our SPARQL Query.
    4. With the blue navigation buttons shown after the "Query" sub-tab you can view the results of the first executed query, previous, next and last. Click the most left aligned blue arrow.
    5. As result will be shown the results from executing the SPARQL Query which dumps all Weblog Posts for a given ODS Member "demo". Note also that also in the SPARQL Query area in the Advanced tab the query also has changed to the first one we have executed for Weblog posts.

References

List of Virtuoso SPARQL Queries

ODS SPARQL Queries
ODS Applications SPARQL Queries
ODS Application Name SIOC Atom OWL SKOS FOAF
Weblog SIOCRefBlog Query ODS-Weblog Data using SPARQL and Atom OWL Ontology Query ODS-Weblog Data using SPARQL and SKOS Ontology Query ODS-Weblog Data using SPARQL and FOAF Ontology
Briefcase SIOCRefBriefcase Query ODS-Briefcase Data using SPARQL and Atom OWL Ontology Query ODS-Briefcase Data using SPARQL and SKOS Ontology Query ODS-Briefcase Data using SPARQL and FOAF Ontology
Feed Manager SIOCRefFeeds Query ODS-Feed-Manager Data using SPARQL and Atom OWL Ontology Query ODS-Feed-Manager Data using SPARQL and SKOS Ontology Query ODS-Feed-Manager Data using SPARQL and FOAF Ontology
Wiki SIOCRefWiki Query ODS-Wiki Data using SPARQL and Atom OWL Ontology Query ODS-Wiki Data using SPARQL and SKOS Ontology Query ODS-Wiki Data using SPARQL and FOAF Ontology
Calendar SIOCRefCalendar Query ODS-Calendar Data using SPARQL and Atom OWL Ontology Query ODS-Calendar Data using SPARQL and SKOS Ontology Query ODS-Calendar Data using SPARQL and FOAF Ontology
Bookmark Manager SIOCRefBookmark Query ODS-Bookmark-Manager Data using SPARQL and Atom OWL Ontology Query ODS-Bookmark-Manager Data using SPARQL and SKOS Ontology Query ODS-Bookmark-Manager Data using SPARQL and FOAF Ontology
Gallery SIOCRefGallery Query ODS-Gallery Data using SPARQL and Atom OWL Ontology Query ODS-Gallery Data using SPARQL and SKOS Ontology Query ODS-Gallery Data using SPARQL and FOAF Ontology
Polls SIOCRefPolls - Query ODS-Polls Data using SPARQL and SKOS Ontology Query ODS-Polls Data using SPARQL and FOAF Ontology
Addressbook ODSAddressBookRef Query ODS-Addressbook Data using SPARQL and Atom OWL Ontology Query ODS-Addressbook Data using SPARQL and SKOS Ontology Query ODS-Addressbook Data using SPARQL and FOAF Ontology
Discussions SIOCRefDiscussions - Query ODS-Discussions Data using SPARQL and SKOS Ontology Query ODS-Discussions Data using SPARQL and FOAF Ontology
Community SIOCRefCommunity Query ODS-Community Data using SPARQL and Atom OWL Ontology Query ODS-Community Data using SPARQL and SKOS Ontology Query ODS-Community Data using SPARQL and FOAF Ontology
Other Virtuoso SPARQL Queries

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