Previous topic  Top  Next topic  Print this Topic
 

Queries

 

To invoke the query service, at least one query has to be specified. For example, using the default endpoint configuration the query

SELECT * {?s ?p ?o}

will result in the encoded URI

http://localhost:8267/services/sparql/query?query=SELECT%20*%20%7B?s%20?p%20?o%7D

Further examples are available at W3C SPARQL Protocol HTTP Examples.

More technically, the service supports both GET and POST requests. An overview of all of the parameters is provided in the following table:

Parameter

Type

Description

query

xsd:string

The SPARQL query (required)

default-graph-uri

xsd:anyURI

Explicitly set default graphs (0..n)

named-graph-uri

xsd:anyURI

Explicitly set named graphs (0..n)

debug

xsd:boolean

Switch to debug mode if true, i.e. show HTML based UI (optional)

If both by SPARQL query and via arguments default-graph-uri or named-graph-uri graphs are selected, the argument's definitions are used.

The query result will be returned in different formats, depending on the query form and HTTP content negotiation. In all cases UTF-8 is used as encoding.

SPARQL Query Form

Result Type

Result Format (MIME)

SELECT

Variable bindings

SPARQL Query Results XML Format (application/sparql-results+xml) as default or JSON (application/json)

ASK

Boolean value

CONSTRUCT

Graph

Turtle (text/turtle) as default or RDF/XML (application/rdf+xml)

DESCRIBE