VOEvent SPARQL Notes

Quaestor: Getting started with SPARQL endpoint

I installed Norman Gray's SPARQL endpoint, Quaestor. Intially used 0.3 and upgraded to 0.4-beta. The quaestor0.4-beta war file was dropped into the msslxv.mssl.ucl.ac.uk:$TOMCAT_HOME/webapps directory. Following automatic deployment, I followed Norman's Quaestor tutorial using the example files included in the war file.

Web links:

Tutorial:

1. Create knowledge base using N3 description in file testkb.n3:

  • file contents:
    @prefix dc: <http://purl.org/dc/elements/1.1/>.
    @prefix quaestor: <http://ns.nxg.me.uk/quaestor#>.
    
    <> dc:description "Test knowledgebase";
        dc:creator "Elizabeth";
        quaestor:requiredReasoner [
            quaestor:level "defaultOWL"
        ].

  • add knowledgebase to quaestor:
$ curl --verbose --upload-file testkb.n3 --header
content-type:application/n3 http://localhost:8080/quaestor-0.4/kb/test2
2. Upload access-control.owl ontology (file included in .war file):
$ curl --upload-file access-control.owl http://localhost:8080/quaestor-0.4/kb/test2/ontology 
--header content-type:application/rdf+xml
3. Upload sample instances of different people described in instances.n3 (included in .war file):
$ curl --upload-file instances.n3 'http://localhost:8080/quaestor-0.4/kb/test2/people?instances'  
--header content-type:application/n3
4. Upload sample identity described in identity.n3 (included in .war file):
$ curl --upload-file identity.n3 'http://localhost:8080/quaestor-0.4/kb/test2/identities'  
--header content-type:application/n3
5. Run various queries included in access-control-demo .war file:
  • access-flagged.rq - ask who in instances.n3 can see flagged data:
    $ curl --header content-type:application/sparql-query --data-binary
    @access-flagged.rq http://msslxv.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/test2
    --header accept:text/plain
    -----------------------------------
    | person                          |
    ===================================
    | <mailto:norman@astro.gla.ac.uk> |
    | <urn:example#Norman>            |
    | <urn:example#Jonathan>          |
    | <urn:example#Nelson>            |
    | <urn:example#Guy>               |
    | <urn:example#Tutankhamun>       |
    -----------------------------------
  • access-all.rq - ask who in instances.n3 can see all data:
    $ curl --header content-type:application/sparql-query --data-binary
    @access-all.rq http://msslxv.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/test2
    --header accept:text/plain
    -----------------------------------
    | person                          |
    ===================================
    | <urn:example#Norman>            |
    | <urn:example#Jonathan>          |
    | <urn:example#Nelson>            |
    | <urn:example#Guy>               |
    | <mailto:norman@astro.gla.ac.uk> |
    -----------------------------------
  • ask-norman.rq - ask if Norman can see all data:
    $ curl --header content-type:application/sparql-query --data-binary
    @ask-norman.rq http://msslxv.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/test2
    --header accept:text/plain
    yes

VOEvent knowledgebase for Quaestor

"Hello World" knowledgebase and queries

1. Create knowledge base with VOEventKB .n3 (attached):

curl --verbose --upload-file VOEventKB.n3 --header
content-type:application/n3 http://localhost:8080/quaestor-0.4/kb/voevent
2. Upload VOEvent 1.1 ontology (attached):
$ curl --upload-file VOEvent1.1.owl http://localhost:8080/quaestor-0.4/kb/voevent/ontology --header
content-type:application/rdf+xml
3. Upload test BATSE VOEvent instances (attached):
$ curl --upload-file test_solarinstances.n3 'http://localhost:8080/quaestor-0.4/kb/voevent/events?instances' 
 --header content-type:application/n3
4. Upload test BATSE VOEvent identities (attached):
$ curl --upload-file test_solaridentity.n3 'http://localhost:8080/quaestor-0.4/kb/voevent/identities'  
--header content-type:application/n3
5. Try a few SPARQL queries (attached):
  • Ask if BATSE997 is a VOEvent:
    $ curl --header content-type:application/sparql-query --data-binary @ask-997.rq 
    http://msslxv.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/voevent --header accept:text/plain
    yes
    
  • Show all VOEvents known to knowledgebase:
    $ curl --header content-type:application/sparql-query --data-binary @access-allevents.rq 
    http://msslxv.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/voevent --header accept:text/plain
    -----------------------------------------
    | voevent                               |
    =========================================
    | <urn:example#BATSE997>                |
    | <urn:example#BATSE998>                |
    | <urn:example#BATSE999>                |
    | <ivo://mssl.ucl.ac.uk/BATSE#BATSE997> |
    | <ivo://mssl.ucl.ac.uk/BATSE#BATSE999> |
    | <ivo://mssl.ucl.ac.uk/BATSE#BATSE998> |
    
  • Note: both sides of identity are returned - no idea why at this point.

Getting fancier: Instances and queries with more content

1. Upload test instances of BATSE flares including Concept ("Solar Flare") and Name ("BATSE 997") as test_solarinstances2.n3 (attached):

$ curl --upload-file test_solarinstances2.n3 'http://localhost:8080/quaestor-0.4/kb/voevent/events?instances'  
--header content-type:application/n3
2. Perform more detailed queries:
  • Show event id, name and concept for all VOEvents:
    • query (access-allnames.rq):
      prefix voe: <http://eurovotech.org/VOEvent1.1.owl#>
      select ?voevent ?name ?concept
      where
          { ?voevent voe:hasConcept ?concept .
           ?voevent voe:hasName ?name }
    • command:
      $ curl --header content-type:application/sparql-query --data-binary @access-allnames.rq 
      http://msslxv.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/voevent --header accept:text/plain
    • result:
      ---------------------------------------------------------------------------------
      | voevent                               | name        | concept                 |
      =================================================================================
      | <urn:example#BATSE997>                | "BATSE 997" | "Solar Flare"           |
      | <urn:example#BATSE998>                | "BATSE 999" | "Coronal Mass Ejection" |
      | <urn:example#BATSE999>                | "BATSE 999" | "Solar Flare"           |
      | <ivo://mssl.ucl.ac.uk/BATSE#BATSE999> | "BATSE 999" | "Solar Flare"           |
      | <ivo://mssl.ucl.ac.uk/BATSE#BATSE997> | "BATSE 997" | "Solar Flare"           |
      | <ivo://mssl.ucl.ac.uk/BATSE#BATSE998> | "BATSE 999" | "Coronal Mass Ejection" |
      ---------------------------------------------------------------------------------
      

  • Show all VOEvents with concept "Solar Flare":
    • query (access-flares.rq):
      prefix voe: <http://eurovotech.org/VOEvent1.1.owl#>
      select ?name ?concept
      where
          { ?voevent voe:hasConcept ?concept .
          ?voevent voe:hasConcept "Solar Flare" .
          ?voevent voe:hasName ?name }
      
    • command:
      $ curl --header content-type:application/sparql-query --data-binary @access-flares.rq 
      http://msslxv.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/voevent --header accept:text/plain
    • result:
      -------------------------------
      | name        | concept       |
      ===============================
      | "BATSE 997" | "Solar Flare" |
      | "BATSE 999" | "Solar Flare" |
      | "BATSE 999" | "Solar Flare" |
      | "BATSE 997" | "Solar Flare" |
      -------------------------------
      

  • Date query: show all VOEvents with concept "Solar Flare" before May 24th:
    • newly reformatted instance file solarevents.n3 (example entry):
      :BATSE7372 a voe:VOEvent;
                voe:ivorn "ivo://mssl.ucl.ac.uk/BATSE#BATSE7372";
                voe:hasName "BATSE 7372";
                voe:hasStartTime "2000-05-26T18:03:00"^^xsd:dateTime;
                voe:hasStopTime "2000-05-26T18:04:00"^^xsd:dateTime;
                voe:hasHiLimit 25;
                voe:hasLoLimit 300;
                voe:hasSpectralUnit "keV";
                voe:hasReference "ftp://umbra.nascom.nasa.gov/pub/batse/batseplots/batse_7372.ps";
                voe:hasPeakCountsPerSeconds "487";
                voe:hasConcept "Solar Flare".
      
    • query (access-flaresMay24.rq):
      prefix xsd: <http://www.w3.org/2001/XMLSchema#>
      prefix op: <http://www.w3.org/TR/xquery/#mapping>
      prefix voe: <http://eurovotech.org/VOEvent1.1.owl#>
      select ?name ?concept ?starttime
      where
          { ?voevent voe:hasConcept ?concept .
          ?voevent voe:hasConcept "Solar Flare" .
          ?voevent voe:hasStartTime ?starttime .
          ?voevent voe:hasName ?name .
          FILTER (?starttime < "2000-05-25T00:00:00"^^xsd:dateTime ) .
          }
      
    • command:
      $ curl --header content-type:application/sparql-query --data-binary @access-flaresMay24.rq 
      http://msslxx.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/voevent --header accept:text/plain
    • result:
      
      ------------------------------------------------------------------------------------------------------------------
      | name                      | concept       | starttime                                                          |
      ==================================================================================================================
      | "NOAA_xray_20000524_1928" | "Solar Flare" | "2000-05-24T19:28:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      | "BATSE 7366"              | "Solar Flare" | "2000-05-24T10:09:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      | "NOAA_xray_20000524_0908" | "Solar Flare" | "2000-05-24T09:08:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      | "NOAA_xray_20000524_2104" | "Solar Flare" | "2000-05-24T21:04:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      | "NOAA_xray_20000524_1615" | "Solar Flare" | "2000-05-24T16:15:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      | "NOAA_xray_20000524_1757" | "Solar Flare" | "2000-05-24T17:57:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      | "NOAA_xray_20000524_1140" | "Solar Flare" | "2000-05-24T11:40:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      | "BATSE 7367"              | "Solar Flare" | "2000-05-24T15:01:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      | "BATSE 7368"              | "Solar Flare" | "2000-05-24T21:10:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> |
      ------------------------------------------------------------------------------------------------------------------
      

OR

  • Date query: again solar flares before May 24th
    • keep old format of instance file solarevents.n3 (example entry):
      :BATSE7372 a voe:VOEvent;
                voe:ivorn "ivo://mssl.ucl.ac.uk/BATSE#BATSE7372";
                voe:hasName "BATSE 7372";
                voe:hasStartTime "2000-05-26T18:03:00";
                voe:hasStopTime "2000-05-26T18:04:00";
                voe:hasHiLimit 25;
                voe:hasLoLimit 300;
                voe:hasSpectralUnit "keV";
                voe:hasReference "ftp://umbra.nascom.nasa.gov/pub/batse/batseplots/batse_7372.ps";
                voe:hasPeakCountsPerSeconds "487";
                voe:hasConcept "Solar Flare".
      
    • query (access-flaresMay24.rq):
      prefix xsd: <http://www.w3.org/2001/XMLSchema#>
      prefix op: <http://www.w3.org/TR/xquery/#mapping>
      prefix voe: <http://eurovotech.org/VOEvent1.1.owl#>
      select ?name ?concept ?starttime
      where
          { ?voevent voe:hasConcept ?concept .
          ?voevent voe:hasConcept "Solar Flare" .
          ?voevent voe:hasStartTime ?starttime .
          ?voevent voe:hasName ?name .
          FILTER (?starttime < "2000-05-25T00:00:00" ) .
          }
      
    • command:
      $ curl --header content-type:application/sparql-query --data-binary @access-flaresMay24.rq 
      http://msslxx.mssl.ucl.ac.uk:8080/quaestor-0.4/kb/voevent --header accept:text/plain
    • result:
      ---------------------------------------------------------------------
      | name                      | concept       | starttime             |
      =====================================================================
      | "NOAA_xray_20000524_1928" | "Solar Flare" | "2000-05-24T19:28:00" |
      | "BATSE 7366"              | "Solar Flare" | "2000-05-24T10:09:00" |
      | "NOAA_xray_20000524_0908" | "Solar Flare" | "2000-05-24T09:08:00" |
      | "NOAA_xray_20000524_2104" | "Solar Flare" | "2000-05-24T21:04:00" |
      | "NOAA_xray_20000524_1615" | "Solar Flare" | "2000-05-24T16:15:00" |
      | "NOAA_xray_20000524_1757" | "Solar Flare" | "2000-05-24T17:57:00" |
      | "NOAA_xray_20000524_1140" | "Solar Flare" | "2000-05-24T11:40:00" |
      | "BATSE 7367"              | "Solar Flare" | "2000-05-24T15:01:00" |
      | "BATSE 7368"              | "Solar Flare" | "2000-05-24T21:10:00" |
      ---------------------------------------------------------------------
      
-- ElizabethAuden - 30 Aug 2006
Topic revision: r3 - 2006-09-06 - 10:04:46 - ElizabethAuden
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback