iSPARQL Querying Tutorial with SPARQL Query type "CONSTRUCT".

This tutorial shows how to execute a SPARQL query with type "CONSTRUCT". 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 sender, nick, and name details for all Weblog posts. You can find this SPARQL Query in the ODS FOAF Queries List?.


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT
{
  ?post foaf:maker ?maker .
  ?maker foaf:nick ?nick .
  ?maker foaf:name ?fname .
}
FROM <http://id.myopenlink.net/dataspace>
WHERE
   {
    ?forum a sioct:Weblog .
    ?forum sioc:container_of ?post.
    OPTIONAL { ?post foaf:maker ?maker }.
    OPTIONAL { ?maker foaf:nick ?nick  } .
    OPTIONAL { ?maker foaf:name ?fname } .
  }
  1. Go to http://cname/isparql, for ex. http://id.myopenlink.net/isparql
  2. The iSPARQL initialization window will be shown:



  3. On successful initialization will be presented the iSPARQL Advanced tab open with a default SPARQL query:

    SELECT * WHERE {?s ?p ?o}





  4. Go to QBE tab:



  5. Click the Clear Pane icon on the toolbar to empty the Canvas.







  6. 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., http://id.myopenlink.net/dataspace



  7. Click the Advanced tab.
  8. Change the Graph value to also be as in our example http://id.myopenlink.net/dataspace and enter (copy-and-paste) the query chosen above into the SPARQL Query text-area:



  9. Click the Run Query button on the Advanced tab.
  10. The Results sub-tab shown below the Results tab will present the results of executing our SPARQL Query. By default is View -> Navigator mode.



  11. You can change the visualization to:
    • Raw Triples mode:



    • Grid View mode:



    • SVG Graph mode:



      • Equal distances drop-down menu offers Equal distances (default) or All nodes at once.



      • Random drop-down menu, active only when "All nodes at once" is chosen, offers nodes positioning of Random (default) or Circle.



      • Show all nodes drop-down menu lets you limit the displayed nodes by their distance from the selected node, from 1 (default) to 4; for example, Selected up to distance 3.



      • Medium distance drop-down menu adjusts distances between nodes, making depiction clearer or more overlapped. Options are Medium distance (default), Close distance, and Far distance.



      • Planar drop-down menu adjusts model shape between Planar (default) and Pseudo-spherical.



      • Labels only on one element drop-down menu determines which nodes are labeled -- Labels only on one element (default), Up to distance from 1 to 4, or Labels on all elements.



    • Images mode.
    • Google Maps v3 mode:
  12. You can view your SPARQL Query with type "CONSTRUCT" as a Graph model by clicking the "Load Query to QBE" button.



References

ODS SPARQL Queries

ODS Applications SPARQL Queries

ODS Application NameSIOC ReferenceSPARQL Query Using Atom OWL OntologySPARQL Query Using SKOS OntologySPARQL Query Using FOAF Ontology
WeblogSIOCRefBlogODS-Weblog Data QueryODS-Weblog Data QueryODS-Weblog Data Query
BriefcaseSIOCRefBriefcaseODS-Briefcase Data QueryODS-Briefcase Data QueryODS-Briefcase Data Query
Feed ManagerSIOCRefFeedsODS-Feed-Manager Data QueryODS-Feed-Manager Data QueryODS-Feed-Manager Data Query
WikiSIOCRefWikiODS-Wiki Data QueryODS-Wiki Data QueryODS-Wiki Data Query
CalendarSIOCRefCalendarODS-Calendar Data QueryODS-Calendar Data QueryODS-Calendar Data Query
Bookmark ManagerSIOCRefBookmarkODS-Bookmark-Manager Data QueryODS-Bookmark-Manager Data QueryODS-Bookmark-Manager Data Query
GallerySIOCRefGalleryODS-Gallery Data QueryODS-Gallery Data QueryODS-Gallery Data Query
PollsSIOCRefPolls-ODS-Polls Data QueryODS-Polls Data Query
AddressbookODSAddressBookRefODS-Addressbook Data QueryODS-Addressbook Data QueryODS-Addressbook Data Query
DiscussionsSIOCRefDiscussionsODSAtomOWLRefExampleDiscussionsODS-Discussions Data QueryODS-Discussions Data Query
CommunitySIOCRefCommunityODS-Community Data QueryODS-Community Data QueryODS-Community Data Query

Other Virtuoso SPARQL Queries

Related

CategorySPARQL CategoryRDF CategoryOpenSource CategoryOAT CategoryDocumentation CategoryTutorial