Skip to content

Commit 22fafea

Browse files
committed
docs: introduce docs folder and move SPARQL Protocol docs
The change introduces a docs folder and moves the `SPARQL 1.2 Protocol Client Implementation` docs section to a separate md file.
1 parent ab0d8f3 commit 22fafea

2 files changed

Lines changed: 46 additions & 52 deletions

File tree

README.md

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -370,58 +370,6 @@ The `sparqlx.types.RDFParseSource` is the exact type expected by the `source` pa
370370
> `sparqlx.SPARQLWrapper.from_rdf_source` creates an `rdflib.Dataset` internally in order to support RDF Quad sources.
371371
372372

373-
## SPARQL 1.2 Protocol Client Implementation
374-
375-
`sparqlx` aims to provide a convenient Python interface for interacting with SPARQL endpoints according to the [SPARQL 1.2 Protocol](https://www.w3.org/TR/sparql12-protocol/).
376-
377-
The SPARQL Protocol provides a specification for HTTP operations targeting SPARQL Query and Update endpoints.
378-
379-
> "[The SPARQL 1.2 Protocol] describes a means for conveying SPARQL queries and updates to a SPARQL processing service and returning the results via HTTP to the entity that requested them."
380-
> (SPARQL 1.2 Protocol - Abstract)
381-
382-
Generally, the SPARQL 1.2 Protocol defines the following HTTP operations for SPARQL operations:
383-
384-
- GET (query)
385-
- URL-encoded POST (query and update)
386-
- POST directly (query and update)
387-
388-
See [2.2 Query Operation](https://www.w3.org/TR/sparql12-protocol/#query-operation) and [2.3 Update Operation](https://www.w3.org/TR/sparql12-protocol/#update-operation).
389-
390-
391-
`sparqlx` uses <b>URL-encoded POST</b> for both Query and Update operations by default.
392-
393-
This allows to send a Request Content Type in the Accept Header and both the Query/Update Request strings and Query/Update Parameters in the Request Message Body.
394-
395-
`sparqlx` also implements GET (for query operations) and POST-direct (for query and update operations); the SPARQL Operation method can be set via the `query_method: typing.Literal["GET", "POST", "POST-direct"]` and `update_method: typing.Literal["POST", "POST-direct"]` parameters in the `SPARQLWrapper` class.
396-
397-
398-
399-
400-
401-
### SPARQL Protocol Request Parameters
402-
403-
The SPARQL Protocol also specifies the following request parameters:
404-
405-
- version (0 or 1)
406-
- default-graph-uri (0 or more)
407-
- named-graph-uri (0 or more)
408-
409-
for **Query Operations**, where `default-graph-uri` and `named-graph-uri` correspond to SPARQL `FROM` and `FROM NAMED` respectively, and, if present, take precedence over SPARQL clauses.
410-
411-
- version (0 or 1)
412-
- using-graph-uri (0 or more)
413-
- using-named-graph-uri (0 or more)
414-
415-
for **Update Operations**, where `using-graph-uri` and `using-named-graph-uri` correspond to SPARQL `USING` and `USING NAMED`, and likewise take precedence over SPARQL clauses.
416-
417-
418-
SPARQL Protocol request parameters are reflected in the `sparqlx` API:
419-
420-
- Methods implementing query operations take `default_graph_uri` and `named_graph_uri` parameters.
421-
- Methods implementing udpate operations take `using_graph_uri` and `using_named_graph_uri` parameters.
422-
- Both query and update methods take a `version` parameter.
423-
424-
425373
## Recipes
426374

427375
The following is a loose collection of `sparqlx` recipes.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SPARQL 1.2 Protocol Client Implementation
2+
3+
`sparqlx` aims to provide a convenient Python interface for interacting with SPARQL endpoints according to the [SPARQL 1.2 Protocol](https://www.w3.org/TR/sparql12-protocol/).
4+
5+
The SPARQL Protocol provides a specification for HTTP operations targeting SPARQL Query and Update endpoints.
6+
7+
> "[The SPARQL 1.2 Protocol] describes a means for conveying SPARQL queries and updates to a SPARQL processing service and returning the results via HTTP to the entity that requested them."
8+
> (SPARQL 1.2 Protocol - Abstract)
9+
10+
Generally, the SPARQL 1.2 Protocol defines the following HTTP operations for SPARQL operations:
11+
12+
- GET (query)
13+
- URL-encoded POST (query and update)
14+
- POST directly (query and update)
15+
16+
See [2.2 Query Operation](https://www.w3.org/TR/sparql12-protocol/#query-operation) and [2.3 Update Operation](https://www.w3.org/TR/sparql12-protocol/#update-operation).
17+
18+
19+
`sparqlx` uses <b>URL-encoded POST</b> for both Query and Update operations by default.
20+
21+
This allows to send a Request Content Type in the Accept Header and both the Query/Update Request strings and Query/Update Parameters in the Request Message Body.
22+
23+
`sparqlx` also implements GET (for query operations) and POST-direct (for query and update operations); the SPARQL Operation method can be set via the `query_method: typing.Literal["GET", "POST", "POST-direct"]` and `update_method: typing.Literal["POST", "POST-direct"]` parameters in the `SPARQLWrapper` class.
24+
25+
## SPARQL Protocol Request Parameters
26+
27+
The SPARQL Protocol also specifies the following request parameters:
28+
29+
- version (0 or 1)
30+
- default-graph-uri (0 or more)
31+
- named-graph-uri (0 or more)
32+
33+
for **Query Operations**, where `default-graph-uri` and `named-graph-uri` correspond to SPARQL `FROM` and `FROM NAMED` respectively, and, if present, take precedence over SPARQL clauses.
34+
35+
- version (0 or 1)
36+
- using-graph-uri (0 or more)
37+
- using-named-graph-uri (0 or more)
38+
39+
for **Update Operations**, where `using-graph-uri` and `using-named-graph-uri` correspond to SPARQL `USING` and `USING NAMED`, and likewise take precedence over SPARQL clauses.
40+
41+
42+
SPARQL Protocol request parameters are reflected in the `sparqlx` API:
43+
44+
- Methods implementing query operations take `default_graph_uri` and `named_graph_uri` parameters.
45+
- Methods implementing udpate operations take `using_graph_uri` and `using_named_graph_uri` parameters.
46+
- Both query and update methods take a `version` parameter.

0 commit comments

Comments
 (0)