ASGS OGC LD API
SPARQL
This page allows you to lodge SPARQL queries against the triplestore (graph database) that stores all of this systems' vocabularies.
Use the interactive Query UI below to lodge queries interactively or send queries directly to the system using the instructions below that.
Interactive UI
Enter SPARQL queries in the text box below to lodge them interactively:
Example Queries
Count of Features
This example counts the number of Features (geo:Feature) in a Dataset
PREFIX geo: <http://www.opengis.net/ont/geosparql#> SELECT (COUNT(?features) AS ?features_count) { ?features a geo:Feature }
Feature within a Feature Collection and Dataset
Here is an example query that selects the name of five Features, their parent Feature Collections, and the Feature Collections' parent Dataset. Features in Datasets which conform to the OGC LD API specification must be part of (dcterms:isPartOf) a Feature Collection (geo:FeatureCollection), which in turn must be part of a Dataset (dcat:Dataset).
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 ?feature_label ?fc_label ?dataset_label { ?feature a geo:Feature ; rdfs:label ?feature_label ; dcterms:isPartOf ?featureCollection . ?featureCollection rdfs:label ?fc_label ; dcterms:isPartOf ?dataset . ?dataset rdfs:label ?dataset_label } LIMIT 5
Feature Description
This query describes the properties of a Feature:
PREFIX geo: <http://www.opengis.net/ont/geosparql#> DESCRIBE ?feature { ?feature a geo:Feature } LIMIT 1
Direct Queries
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.surroundaustralia.com/sparql?query={YOUR_QUERY_URL_ENCODED}
You can use the query encoder below to URL-encode your query.
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.surroundaustralia.com/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
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.
Query Encoder
Enter your SPARQL query into this text box and click "URL Encode" to URL encode it. That will
generate a single encoded string with spaces replaced by "%20" and other character replacements
which you can then use in place of {YOUR_QUERY_URL_ENCODED}
above.
You might like to test out your query first using the Query UI above too.
Alternates Profiles
Different views of and formats:
Alternate Profiles ?Different Media Types (HTML, text, RDF, JSON etc.) and different information model views, profiles, are available for this resource.