Dataset NASA
Published 7th March 2011
Type SPARQL Endpoint
Users 40

SPARQL Endpoint

Use the SPARQL 1.1 query language to perform structured queries against a dataset. Useful for performing precise queries against a dataset whose structure you understand.

Documentation

Endpoint URL

http://api.kasabi.com/dataset/nasa/apis/sparql
Login to test this query using our experimental API explorer

Authentication

You will need your API key (on your dashboard) in order to authenticate to this API. You have two options for authentication:

  • By URL Parameter -- add the apikey parameter to your request URL, with your key as the value
  • By Request Header -- add a custom HTTP header called X_KASABI_APIKEY to your HTTP request, with your key as the value

For more information on Kasabi authentication options read the authentication documentation. Your API key will need to be authorized to use this service.

Parameters

This API supports the following request parameters:

Parameter NameParameter Value(s)Required?Notes
queryURL encoded SPARQL queryYesThis is the query to execute against the dataset
outputShort name for desired response formatNoSupports selecting response format using url parameter rather than HTTP Accept header.

HTTP Response Codes

Clients should be prepared to receive any valid HTTP response code. The following table lists the most frequently used codes

CodeMeaning
200 OKSuccessful Request
400 Bad RequestMissing or malformed SPARQL query
401 Not AuthorizedAPI key is not authorized to access the data

Please also review our additional notes on response codes.

Response Formats

Query Type Response Format Accept Header output parameter Notes
SELECT or ASK application/sparql-results+json application/sparql-results+json json Return results in SPARQL JSON results format
SELECT or ASK application/sparql-results+xml application/sparql-results+json xml Return results in SPARQL XML results format
CONSTRUCT or DESCRIBE application/rdf application/rdf rdf (or xml) Return results as RDF/XML
CONSTRUCT or DESCRIBE application/rdf application/rdf rdf (or xml) Return results as RDF/XML
CONSTRUCT or DESCRIBE application/json application/json json Return results as RDF/JSON
CONSTRUCT or DESCRIBE text/turtle text/turtle turtle Return results as Turtle
CONSTRUCT or DESCRIBE text/plain text/plain ntriples Return results as NTriples

Sample Queries

This example query will list the name, agency and mass of all spacecraft launched on 16th July 1969. Simply change the date to select launches on an alternate date.

Query: 
PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?agency ?mass WHERE { ?launch space:launched "1969-07-16"^^xsd:date. ?spacecraft space:launch ?launch; foaf:name ?name; space:agency ?agency; space:mass ?mass. }
Login to test this query using our experimental API explorer Permalink to this sample query

Find the identifier and label for disciplines (subject categories) against which spacecraft launches have been classified. 

Query: 
PREFIX space: <http://purl.org/net/schemas/space/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT * WHERE { ?subject rdfs:label ?label; rdf:type space:Discipline. }
Login to test this query using our experimental API explorer Permalink to this sample query

Lists the identifier, name and URL of an image associated with 100 spacecraft. Adjust the LIMIT to select more or less data, and add an OFFSET to page through the dataset.

Note: As not all spacecraft have images associated with them, an OPTIONAL clause is used to find those properties.

Query: 
PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?spacecraft ?name ?image WHERE { #This pattern must be bound ?spacecraft foaf:name ?name. #Anything in this block doesn't have to be bound OPTIONAL { ?spacecraft foaf:depiction ?image. } } LIMIT 100
Login to test this query using our experimental API explorer Permalink to this sample query

Generates descriptions of all spacecraft launched on 16th July 1969. Adjust the date to describe data on a different date.

Query: 
#Ex. 15 #Describe spacecraft launched on 16th July 1969 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DESCRIBE ?spacecraft WHERE { ?launch space:launched "1969-07-16"^^xsd:date. ?spacecraft space:launch ?launch. }
Login to test this query using our experimental API explorer Permalink to this sample query

DESCRIBE ?prop {

  ?subject ?prop ?object

}

Query: 
DESCRIBE ?prop { ?s ?prop ?o }
Login to test this query using our experimental API explorer Permalink to this sample query
Create a sample query