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
- 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)
- Go to iSPARQL demo page.
- Click "Ok" in the shown Login form.
By default should be shown user name demo and password demo.
-
- 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.
-
- 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.
-
- Go the Advanced tab.
- 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:
-
- Click the "Run Query" button from the Advanced tab.
- 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.
-
-
You can change the results table columns width by dragging the ends of the column labels:
-
-
You can change the output viewable mode to Machine readable
-
-
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.
-
- 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.
- 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
- 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".
-
- Click the "Run Query" button from the Advanced tab toolbar.
- The Result sub-tab will present the results of executing our SPARQL Query.
-
- 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.
- 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.
-
- Suppose we are on the Advanced tab.
Change the SPARQL Query with the following one
References
List of Virtuoso SPARQL Queries
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
Other Virtuoso SPARQL Queries