-
Notifications
You must be signed in to change notification settings - Fork 20
SPARQL 1.1 Protocol
According with W3C specs [1], the SPARQL Protocol consists of two operations: query and update. Since the SPARQL 1.1 Protocol is built on top of HTTP, each operation is defined in terms of:
- HTTP method
- HTTP parameters
- HTTP Request body
- HTTP response body
default-graph-uri and named-graph-uri parameters are not yet supported.
The query operation is used to send a SPARQL query to a service and receive the results of the query. SolRDF accepts queries issued in one of the following ways:
When using the GET method, clients must URL percent encode all parameters. The query string can be indicated by means of the "q" or "query" parameter.
curl "http://localhost:8080/solr/store/sparql" \
--data-urlencode "q=SELECT * WHERE { ?s ?p ?o } LIMIT 10" \
-H "Accept: application/sparql-results+json"
or
curl "http://localhost:8080/solr/store/sparql" \
--data-urlencode "query=SELECT * WHERE { ?s ?p ?o } LIMIT 10" \
-H "Accept: application/sparql-results+json"
When using this method, clients must URL percent encode the "q" or "query" parameter and include within the request body via the application/x-www-form-urlencoded media type. The content type header of the HTTP request must be set to application/x-www-form-urlencoded and the HTTP method is set to POST.
curl -X POST "http://localhost:8080/solr/store/sparql" \
--data-urlencode "q=SELECT * WHERE { ?s ?p ?o } LIMIT 10" \
-H "Content-type: application/x-www-form-urlencoded"
When using this method, clients send the query directly and unencoded in the HTTP request message body without any parameter. The HTTP method must be POST and the content type header must be set to application/sparql-query.
curl -X POST "http://localhost:8080/solr/store/sparql" \
--data-binary "SELECT * WHERE { ?s ?p ?o } LIMIT 10" \
-H "Content-type: application/sparql-query"
The update operation is used to send a SPARQL update request to a service. Differently from the query operation we described below, the update parameter can contain one or more operations, separated by a semicolon. SolRDF accepts updates issued in one of the following ways:
When using this method, clients must URL percent encode the "update" parameter and include within the request body via the application/x-www-form-urlencoded media type. The content type header of the HTTP request must be set to application/x-www-form-urlencoded and the HTTP method is set to POST.
curl -X POST "http://localhost:8080/solr/store/sparql" \
--data-urlencode "update=INSERT DATA {<a> <b> <x>}" \
-H "Content-type: application/x-www-form-urlencoded"
Or
curl -X POST "http://localhost:8080/solr/store/sparql" \
--data-urlencode "update=INSERT DATA {<a> <b> <x>}; DELETE DATA {<c> <d> <e>}" \
-H "Content-type: application/x-www-form-urlencoded"
When using this method, clients send the update command(s) directly and unencoded in the HTTP request message body without any parameter. The HTTP method must be POST and the content type header must be set to application/sparql-update.
curl -X POST "http://localhost:8080/solr/store/sparql" \
--data-binary "INSERT DATA {<a> <b> <x>}; DELETE DATA {<c> <d> <e>}" \
-H "Content-type: application/sparql-update"
1. Introduction
2. User Guide
2.1 Get me up and running
2.2 Add Data
2.3 RDF Mode
2.3.1 SPARQL 1.1 Protocol
2.3.1.1 Query
2.3.1.2 Update
2.3.3 Graph Store Protocol
2.4 Hybrid mode
2.4.1 Querying
2.4.2 Faceted search
2.4.2.1 Fields
2.4.2.2 Objects queries
2.4.2.3 Objects ranges queries
2.5 Deployments
2.6.1 Standalone
2.6.2 SolrCloud
2.6 Message Catalog
3. Developer Guide
3.1 Development Environment
3.2 (Java) Client API
3.3 Solr Configuration
3.3.1 schema.xml
3.3.2 solrconfig.xml
3.4 Components
3.4.1 Stream Loader
3.4.2 Query Parser
3.4.3 Search Component
3.4.4 Facet Component
3.4.5 Response Writer
4. Continuous Integration
5. Roadmap
6. Mailing lists