| Home | Trees | Indices | Help |
|---|
|
|
Wrapper around an online access to a SPARQL Web entry point.
The same class instance can be reused for subsequent queries. The values of the base Graph URI, return formats, etc, are retained from one query to the next (in other words, only the query string changes). The instance can also be reset to its initial values using the resetQuery method.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| string |
|
||
|
|||
| string |
|
||
|
|||
|
|||
| QueryResult instance |
|
||
|
|||
|
|||
compiled regular expression (see the re module of
Python)
|
pattern = re.compile(r'regular expression used to determine whether a query is of type CONSTRUCT, SELECT, ASK, or DESCRIBE. |
||
|
|||
|
baseURI the URI of the SPARQL service |
|||
|
|||
Class encapsulating a full SPARQL call.
|
Set the return format. If not an allowed value, the setting is ignored. |
Add a default graph URI.
|
Add a named graph URI.
|
Some SPARQL endpoints require extra key value pairs. E.g., in
virtuoso, one would add
|
Set the SPARQL query text. Note: no check is done on the validity of the query (syntax or otherwise) by this module, except for testing the query type (SELECT, ASK, etc). Syntax and validity checking is done by the SPARQL service itself.
|
Parse the SPARQL query and return its type (ie, SELECT, ASK, etc). Note that the method returns SELECT if nothing is specified. This is just to get all other methods running; in fact, this means that the query is erronous, because the query must be, according to the SPARQL specification, one of Select, Ask, Describe, or Construct. The SPARQL endpoint should raise an exception (via urllib) for such syntax error.
|
Set the invocation method. By default, this is GET, but can be set to POST. |
Return the URI as sent (or to be sent) to the SPARQL endpoint. The URI is constructed with the base URI given at initialization, plus all the other parameters set.
|
Internal method to create request according a HTTP method. Returns a
|
Internal method to execute the query. Returns the output of the
|
Execute the query. Exceptions can be raised if either the URI is wrong or the HTTP sends back an error (this is also the case when the query is syntactically incorrect, leading to an HTTP error sent back by the SPARQL endpoint). The usual urllib2 exceptions are raised, which therefore cover possible SPARQL errors, too. Note that some combinations of return formats and query types may not make sense. For example, a SELECT query with Turtle response is meaningless (the output of a SELECT is not a Graph), or a CONSTRUCT query with JSON output may be a problem because, at the moment, there is no accepted JSON serialization of RDF (let alone one implemented by SPARQL endpoints). In such cases the returned media type of the result is unpredictable and may differ from one SPARQL endpoint implementation to the other. (Endpoints usually fall back to one of the "meaningful" formats, but it is up to the specific implementation to choose which one that is.)
|
Macro like method: issue a query and return the converted results.
|
|
|||
patternregular expression used to determine whether a query is of type CONSTRUCT, SELECT, ASK, or DESCRIBE.
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Feb 14 13:33:49 2008 | http://epydoc.sourceforge.net |