Australian Statistical Geography Standard Linked Data API

Australian Statistical Geography Standard Linked Data API

SPARQL Endpoint

This page allows you to lodge SPARQL queries against the triplestore (graph database) that stores all of this systems' vocabularies'.

Interactive UI

Enter SPARQL queries in the text box below to lodge them interactively:

Example Queries

VocPrez

Here is an example query for VocPrez you can copy 'n paste into the Query UI text area above to test with. It counts the number of vocabulary Concepts in the all vocabularies in this system and will return an integer:

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT (COUNT(?c) AS ?count)
WHERE {
    ?c a skos:Concept .
}
    

SpacePrez

Here is an example query for SpacePrez for use in the Query UI above. It returns most two Features' URIs and their titles.

PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?uri ?title
WHERE {
  ?uri a geo:Feature ;
       dcterms:title|rdfs:label ?title .
}
LIMIT 2
    

Direct Queries

Query posing and encoding

If you would like to lodge queries directly against this SPARQL endpoint without using the Query UI above, first create the query, URL-encode it, and lodge it like this:

http://asgs.linked.fsdf.org.au/sparql?query={YOUR_QUERY_URL_ENCODED}

Put you query in the box below and press 'Encode' to encode it!

The query:

PREFIX geo: <http://www.opengis.net/ont/geosparql#>

SELECT ?uri
WHERE {
  ?uri a geo:Feature ;
}
LIMIT 2
    

encodes to:

PREFIX%20geo%3A%20%3Chttp%3A%2F%2Fwww.opengis.net%2Font%2Fgeosparql%23%3E%0A%0ASELECT%20%3Furi%0AWHERE%20%7B%0A%20%20%3Furi%20a%20geo%3AFeature%20%3B%0A%7D%0ALIMIT%202
    

Machine-readable responses

If you lodge your query as above with a web browser, the system will place it in the interactive UI text area (above) and you will see the result below that.

To obtain a machine-readable response to your query, you must supply an HTTP Accept header for the type of response you would like, in accordance with the SPARQL Protocol standard.

For example, to get a SPARQL JSON format response for {YOUR_QUERY_URL_ENCODED}, use the curl program like this:

curl http://asgs.linked.fsdf.org.au/sparql?query={YOUR_QUERY_URL_ENCODED} -H 'Accept: application/sparql-results+json'

SPARQL response Accept Headers

The following Media Types are to be used for machine-readable responses:

  • SPARQL response formats:
    • application/sparql-results+json
    • application/sparql-results+xml
    • text/csv
    • text/tab-separated-values
  • RDF response formats:
    • text/turtle
    • application/rdf+xml
    • application/ld+json
    • text/n3
    • application/n-triples

If you omit one of the above headers, your query will be placed into this page and the result displayed interactively.

If the header you've included doesn't match the format of the SPARQL response type, you will receive that response type's default format, e.g. text/turtle for CONSTRUCT queries, application/sparql-results+json for SELECT queries.

GET & POST queries

You can lodge both GET and POST queries against this system, as per the SPARQL Protocol standard.