SPARQL to Simile Timeline

Using XSL references via Virtuoso calls

Press key to advance.

http://goo.gl/xXqGZ

Having issues seeing the presentation? Read the disclaimer

Background

Approach

  • Simple exercise that builds off previous example with KML
  • Steps
    • Build a SPARQL call...
    • Build an XSL transform file... (one time event)
    • Issue the request and enjoy the results
Too much talk for too simple a demo..  so let's get to it...
						
Background

The SPARQL

PREFIX gmd: <http://www.isotc211.org/2005/gmd>
PREFIX oai_voc: <http://www.mediaspaces.info/vocab/oai-pmh.rdf#>
PREFIX taxon: <http://www.chronos.org/taxa/#>
SELECT DISTINCT ?uri ?author ?genus ?species ?fad_stage ?lad_stage ?fad_ma ?lad_ma ?chamber_arrangement ?test_outline ?coiling_axis ?edge_view ?umbilical_or_test_sutures ?shell_porosity ?wall_texture ?aperture ?aperture_border ?accessory_apertures ?periphery ?main_image_url
WHERE {
   ?uri ?key ?value .
   ?uri taxon:author ?author .
   ?uri taxon:current_genus ?genus .
   ?uri taxon:species ?species .
   ?uri taxon:fad_stage ?fad_stage .
   ?uri taxon:lad_stage ?lad_stage .
   ?uri taxon:fad_ma ?fad_ma .
   ?uri taxon:lad_ma ?lad_ma .
   ?uri taxon:chamber_arrangement ?chamber_arrangement .
   ?uri taxon:test_outline ?test_outline .
   ?uri taxon:coiling_axis ?coiling_axis .
   ?uri taxon:edge_view ?edge_view .
   ?uri taxon:umbilical_or_test_sutures ?umbilical_or_test_sutures .
   ?uri taxon:shell_porosity ?shell_porosity .
   ?uri taxon:wall_texture ?wall_texture .
   ?uri taxon:aperture ?aperture .
   ?uri taxon:aperture_border ?aperture_border .
   ?uri taxon:accessory_apertures ?accessory_apertures .
   ?uri taxon:periphery ?periphery .
   ?uri taxon:main_image_url ?main_image_url.
FILTER (regex(?uri, "taxa")) .
}
						
Background

The XSL

  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sparql="http://www.w3.org/2005/sparql-results#">
      <xsl:template match="/sparql:sparql/sparql:results">
          <data>
              <xsl:for-each select="sparql:result">
                  <event>
                      <xsl:attribute name="isDuration">true </xsl:attribute>
                      <xsl:attribute name="start"> <xsl:value-of select="sparql:binding[@name='fad_ma']/sparql:literal"/> </xsl:attribute>
                      <xsl:attribute name="end"> <xsl:value-of select="sparql:binding[@name='lad_ma']/sparql:literal"/> </xsl:attribute>
                      <xsl:attribute name="title"> <xsl:value-of select="sparql:binding[@name='genus']/sparql:literal"/> <xsl:text>  </xsl:text> <xsl:value-of select="sparql:binding[@name='species']/sparql:literal"/></xsl:attribute>
                      <xsl:attribute name="image"> <xsl:value-of select="sparql:binding[@name='main_image_url']/sparql:literal"/> </xsl:attribute>
                      <xsl:attribute name="link"> <xsl:value-of select="sparql:binding/sparql:uri"/> </xsl:attribute>
                  </event>
              </xsl:for-each>
          </data>
      </xsl:template>
  </xsl:stylesheet>
 
                      
Results

Results


curl --data-urlencode query@foram.sparql
--data-urlencode xslt-uri=http://data.oceandrilling.org/models/sparqlToTimeline.xsl
--data-urlencode form=xml http://data.oceandrilling.org/sparql > taxaTimeline.xml