<docbook><section><title>InteractiveSparqlQueryBuilderQueryTutorialSelect</title><title> iSPARQL Querying Tutorial with SPARQL Query type &quot;SELECT&quot;.</title> iSPARQL Querying Tutorial with SPARQL Query type &quot;SELECT&quot;.
<para>This tutorial shows how to execute a SPARQL query with type &quot;SELECT&quot;.
You can find a rich list of Virtuoso SPARQL Queries in the <ulink url="#References">References</ulink> section.</para>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Enter and execute a query</bridgehead>
<para>Choose a SPARQL query from the <ulink url="#References">References</ulink> list.
 For this example, let&#39;s use the SPARQL query, which dumps all Weblog Posts for the ODS Member &quot;demo&quot;.
 You can find this SPARQL Query in either the <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSIOCRef">ODS SPARQL Queries</ulink> or the <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefBlog">ODS Weblog SPARQL Queries</ulink> list.</para>
<programlisting>prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;  
prefix sioc: &lt;http://rdfs.org/sioc/ns#&gt; 
prefix sioct: &lt;http://rdfs.org/sioc/types#&gt;
prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt; 
prefix dct: &lt;http://purl.org/dc/elements/1.1/&gt;
prefix dcc: &lt;http://purl.org/dc/terms/&gt;
select DISTINCT ?forum_name, ?post, ?title, ?cr, ?url 
from &lt;http://demo.openlinksw.com/dataspace&gt; 
where    
  { 
    ?forum a sioct:Weblog .
    ?forum sioc:id ?forum_name.
    ?forum sioc:scope_of ?role. 
    ?role sioc:function_of &lt;http://demo.openlinksw.com/dataspace/demo#this&gt; .
    ?forum sioc:container_of ?post. 
    optional{?post dct:title ?title}.
    optional{?post dcc:created ?cr}.
    optional{?post sioc:link ?url}.
  }
order by DESC (?cr)
</programlisting><para> </para>
<orderedlist spacing="compact"><listitem>Go to <ulink url="http://demo.openlinksw.com/isparql">iSPARQL demo</ulink> page.
</listitem>
<listitem>By default, user name <emphasis>demo</emphasis> and password <emphasis>demo</emphasis> should be shown in the Login form.
 Click <emphasis>OK</emphasis>.
<itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlQBE.png" /></figure> </listitem>
</itemizedlist></listitem>
<listitem>You will now see the iSPARQL home page, with <emphasis>QBE</emphasis> tab open and default graph elements on the Canvas.
 Click the <emphasis>Clear Pane</emphasis> icon on the toolbar to empty the Canvas.
<itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample1.png" /></figure> </listitem>
</itemizedlist></listitem>
<listitem>Change the <emphasis>Data Source URI</emphasis> 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 <ulink url="http://demo.openlinksw.com/dataspace">http://demo.openlinksw.com/dataspace</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample37.png" /></figure> </listitem>
</itemizedlist></listitem>
<listitem>Click the <emphasis>Advanced</emphasis> tab.
</listitem>
<listitem>Change the <emphasis>Graph<emphasis> value to also be <ulink url="http://demo.openlinksw.com/dataspace">http://demo.openlinksw.com/dataspace</ulink> and enter (copy-and-paste) the query chosen above into the <emphasis>SPARQL Query</emphasis> text-area: <itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample38.png" /></figure> </listitem>
</itemizedlist></emphasis></emphasis></listitem>
<listitem>Click the <emphasis>Run Query</emphasis> button on the <emphasis>Advanced</emphasis> tab.
</listitem>
<listitem>The <emphasis>Results</emphasis> sub-tab shown below the Results tab will present the results of executing our SPARQL Query, by default in <emphasis>Human readable</emphasis> format.
<itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample39.png" /></figure> </listitem>
</itemizedlist></listitem>
<listitem><emphasis>Change the results table column widths</emphasis> by dragging the ends of the column labels.
<itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample40.png" /></figure> </listitem>
</itemizedlist></listitem>
<listitem><emphasis>Change the output viewable mode<emphasis> to <emphasis>Machine readable</emphasis>, if desired <itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample40a.png" /></figure> </listitem>
</itemizedlist></emphasis></emphasis></listitem>
<listitem><emphasis>View the SPARQL Query as Graph model</emphasis> by clicking the <emphasis>Load Query to QBE</emphasis> button shown in the Toolbar.
<itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample41.png" /></figure></listitem>
</itemizedlist></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Execute another query</bridgehead>
 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 <emphasis>Results</emphasis> tab) work.
 You can find this SPARQL Query in the <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSIOCRef">ODS SPARQL Queries list</ulink> and also in the <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefFeeds">ODS Feed Manager SPARQL Queries list</ulink>.
 It should obtain a dump of all Posts within an ODS-Feeds Data Space for user &quot;demo&quot;.
<programlisting>prefix sioc: &lt;http://rdfs.org/sioc/ns#&gt;
prefix sioct: &lt;http://rdfs.org/sioc/types#&gt;
prefix dct: &lt;http://purl.org/dc/elements/1.1/&gt;
prefix dcc: &lt;http://purl.org/dc/terms/&gt;
select ?forum_name, ?channel, ?item_title, ?created
from &lt;http://demo.openlinksw.com/dataspace&gt;
where
  {
    ?forum a sioct:SubscriptionList;
                   sioc:id ?forum_name.
    ?forum sioc:scope_of ?role. 
    ?role sioc:function_of &lt;http://demo.openlinksw.com/dataspace/demo#this&gt; .
    ?forum sioc:parent_of ?channel .
    ?channel sioc:container_of ?post .
    optional{ ?post dct:title ?item_title }.
    optional{ ?post dcc:created ?created }.
  }
limit 20
</programlisting><orderedlist spacing="compact"><listitem>Click to the <emphasis>Advanced</emphasis> tab.
 Change the SPARQL Query to the above.
<itemizedlist mark="bullet" spacing="compact"><listitem>img src=&quot;InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample42.png&quot; style=&quot;wikiautogen&quot;/&gt; </listitem>
</itemizedlist></listitem>
<listitem>Click the <emphasis>Run Query<emphasis> button on the <emphasis>Advanced</emphasis> toolbar.
</emphasis></emphasis></listitem>
<listitem>The <emphasis>Result</emphasis> tab will present the results of the query.
<itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample43.png" /></figure> </listitem>
</itemizedlist></listitem>
<listitem>With the blue navigation buttons you can view the results of the first, previous, next and last executed queries.
 Click the furthest-left blue arrow.
</listitem>
<listitem>The results of the first query we executed -- all Weblog Posts for the ODS Member &quot;demo&quot; -- will be shown.
 Note that the content of the SPARQL Query area of the Advanced tab has also changed to match.
</listitem>
</orderedlist><itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="InteractiveSparqlQueryBuilderQueryTutorialSelect/isparqlSample44.png" /></figure></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3">References</bridgehead>
 <bridgehead class="http://www.w3.org/1999/xhtml:h4">ODS SPARQL Queries</bridgehead>
 <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSIOCRef">ODS SIOC Reference</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRef">ODS FOAF Reference</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRef">ODS SKOS Reference</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRef">ODS Atom OWL Reference</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VOSODSSparqlSamples">ODS SIOC Query Tutorial</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/WordPressSIOCRef">WordPress SIOC Reference</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/MediaWikiSIOCRef">MedaWiki SIOC Reference</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/PHPBBSIOCRef">PHPBB SIOC Reference</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h4">ODS Applications SPARQL Queries</bridgehead>
 
<table><title /><tgroup><thead /><tbody>
<row />
<row><entry><emphasis>Weblog</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefBlog">SIOCRefBlog</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleBlog">ODS-Weblog Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleBlog">ODS-Weblog Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleBlog">ODS-Weblog Data Query</ulink></entry></row>
<row><entry><emphasis>Briefcase</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefBriefcase">SIOCRefBriefcase</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleBriefcase">ODS-Briefcase Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleBriefcase">ODS-Briefcase Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleBriefcase">ODS-Briefcase Data Query</ulink></entry></row>
<row><entry><emphasis>Feed Manager</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefFeeds">SIOCRefFeeds</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleFeeds">ODS-Feed-Manager Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleFeeds">ODS-Feed-Manager Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleFeeds">ODS-Feed-Manager Data Query</ulink></entry></row>
<row><entry><emphasis>Wiki</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefWiki">SIOCRefWiki</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleWiki">ODS-Wiki Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleWiki">ODS-Wiki Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleWiki">ODS-Wiki Data Query</ulink></entry></row>
<row><entry><emphasis>Calendar</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefCalendar">SIOCRefCalendar</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleCalendar">ODS-Calendar Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleCalendar">ODS-Calendar Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleCalendar">ODS-Calendar Data Query</ulink></entry></row>
<row><entry><emphasis>Bookmark Manager</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefBookmark">SIOCRefBookmark</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleBookmarks">ODS-Bookmark-Manager Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleBookmarks">ODS-Bookmark-Manager Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleBookmarks">ODS-Bookmark-Manager Data Query</ulink></entry></row>
<row><entry><emphasis>Gallery</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefGallery">SIOCRefGallery</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleGallery">ODS-Gallery Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleGallery">ODS-Gallery Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleGallery">ODS-Gallery Data Query</ulink></entry></row>
<row><entry><emphasis>Polls</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefPolls">SIOCRefPolls</ulink></entry><entry>-</entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExamplePolls">ODS-Polls Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExamplePolls">ODS-Polls Data Query</ulink></entry></row>
<row><entry><emphasis>Addressbook</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAddressBookRef">ODSAddressBookRef</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleAddressbook">ODS-Addressbook Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleAddressBook">ODS-Addressbook Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleAddressBook">ODS-Addressbook Data Query</ulink></entry></row>
<row><entry><emphasis>Discussions</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefDiscussions">SIOCRefDiscussions</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleDiscussions">ODSAtomOWLRefExampleDiscussions</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleDiscussion">ODS-Discussions Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleDiscussion">ODS-Discussions Data Query</ulink></entry></row>
<row><entry><emphasis>Community</emphasis></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefCommunity">SIOCRefCommunity</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSAtomOWLRefExampleCommunity">ODS-Community Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSSKOSRefExampleCommunity">ODS-Community Data Query</ulink></entry><entry><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/ODSFOAFRefExampleCommunity">ODS-Community Data Query</ulink></entry></row>
</tbody></tgroup></table>
<bridgehead class="http://www.w3.org/1999/xhtml:h4">Other Virtuoso SPARQL Queries</bridgehead>
 <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefTutorial">Query Virtuoso Tutorials using SPARQL</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/SIOCRefDocs">Query Virtuoso Documentation using SPARQL</ulink></listitem>
</itemizedlist><para><ulink url="CategorySPARQL">CategorySPARQL</ulink> <ulink url="CategoryRDF">CategoryRDF</ulink> <ulink url="CategoryOpenSource">CategoryOpenSource</ulink> <ulink url="CategoryOAT">CategoryOAT</ulink> <ulink url="CategoryDocumentation">CategoryDocumentation</ulink> <ulink url="CategoryTutorial">CategoryTutorial</ulink></para>
</section></docbook>