OpenLink AJAX Toolkit (OAT) Wiki Web

  • Topic
  • Discussion
  • OATWikiWebEdit.InteractiveSparqlQueryBuilderQueryTutorial(Last) -- Owiki? , 2008-06-04 10:47:57 Edit owiki 2008-06-04 10:47:57

    InteractiveSparqlQueryBuilderQueryTutorial

    iSPARQL Querying Tutorial with SPARQL Query type "SELECT".

    This tutorial shows how to execute a SPARQL query with type "SELECT". You can find a rich list of Virtuoso SPARQL Queries in the References section.

    Enter and execute a query

    Choose a SPARQL query from the References list. For this example, let's use the SPARQL query, which dumps all Weblog Posts for the ODS Member "demo". You can find this SPARQL Query in either the ODS SPARQL Queries? or 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/><BR /><BR />
    prefix dcc: <http://purl.org/dc/terms/><BR /><BR />
    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)
    
    1. Go to iSPARQL demo page.

    2. By default, user name demo and password demo should be shown in the Login form. Click OK .




    3. You will now see the iSPARQL home page, with QBE tab open and default graph elements on the Canvas. Click the Clear Pane icon on the toolbar to empty the Canvas.




    4. Change the Data Source URI field value on the QBE tab to the Graph of the database against which you want to execute your query, i.e., for this example -- http://demo.openlinksw.com/dataspace




    5. Click the Advanced tab.

    6. Change the Graph value to also be http://demo.openlinksw.com/dataspace , and enter (copy-and-paste) the query chosen above into the SPARQL Query text-area:




    7. Click the Run Query button on the Advanced tab.

    8. The Result sub-tab shown below the Advanced SPARQL Query Working Canvas will present the results of executing our SPARQL Query, by default in Human readable format.




    9. Change the results table column widths by dragging the ends of the column labels.




    10. Change the output viewable mode to Machine readable , if desired




    11. View the SPARQL Query as Graph model by clicking the Load Query to QBE button shown in the Toolbar with Result, SPARQL Params, Response, and Query sub-tabs.



    Execute another query


    Now we will enter a different SPARQL query to execute, to show how the navigation buttons (grayed-out blue arrows in the toolbar of the Results tab) work. You can find this SPARQL Query in the ODS SPARQL Queries list? and also in the ODS Feed Manager SPARQL Queries list? . It should obtain a dump of all Posts within an ODS-Feeds Data Space for user "demo".




    1. Click the Run Query button on the Advanced toolbar.

    2. The Result sub-tab will present the results of the query.




    3. With the blue navigation buttons shown after the Query sub-tab, you can view the results of the first, previous, next and last executed queries. Click the furthest-left blue arrow.

    4. The results of the first query we executed -- all Weblog Posts for the ODS Member "demo" -- will be shown. Note that the content of the SPARQL Query area of the Advanced tab has also changed to match.



    References

    ODS SPARQL Queries

    • ODS SIOC Reference?
    • ODS FOAF Reference?
    • ODS SKOS Reference?
    • ODS Atom OWL Reference?
    • ODS SIOC Query Tutorial?
    • WordPress SIOC Reference?
    • MedaWiki SIOC Reference?
    • PHPBB SIOC Reference?

    ODS Applications SPARQL Queries

    Application *SIOC Reference Atom OWL query SKOS query FOAF query
    Weblog SIOCRefBlog? ODS-Weblog Data Query ODS-Weblog Data Query ODS-Weblog Data Query
    Briefcase SIOCRefBriefcase? ODS-Briefcase Data Query ODS-Briefcase Data Query ODS-Briefcase Data Query
    Feed Manager SIOCRefFeeds? ODS-Feed-Manager Data Query ODS-Feed-Manager Data Query ODS-Feed-Manager Data Query
    Wiki SIOCRefWiki? ODS-Wiki Data Query ODS-Wiki Data Query ODS-Wiki Data Query
    Calendar SIOCRefCalendar? ODS-Calendar Data Query ODS-Calendar Data Query ODS-Calendar Data Query
    Bookmark Manager SIOCRefBookmark? ODS-Bookmark-Manager Data Query ODS-Bookmark-Manager Data Query ODS-Bookmark-Manager Data Query
    Gallery SIOCRefGallery? ODS-Gallery Data Query ODS-Gallery Data Query ODS-Gallery Data Query
    Polls SIOCRefPolls? - ODS-Polls Data Query ODS-Polls Data Query
    Addressbook ODSAddressBookRef? ODS-Addressbook Data Query ODS-Addressbook Data Query ODS-Addressbook Data Query
    Discussions SIOCRefDiscussions? - ODS-Discussions Data Query ODS-Discussions Data Query
    Community SIOCRefCommunity? ODS-Community Data Query ODS-Community Data Query ODS-Community Data Query

    Other Virtuoso SPARQL Queries

    • Query Virtuoso Tutorials using SPARQL?
    • Query Virtuoso Documentation using SPARQL?

    CategorySPARQL? CategoryRDF? CategoryOpenSource? CategoryOAT? CategoryDocumentation? CategoryTutorial?