Run SPARQL Query
run_sparql_queryExecute custom SPARQL 1.1 queries against the UniProt endpoint to retrieve protein data not covered by predefined tools, with support for multiple result formats.
Instructions
Execute an arbitrary SPARQL 1.1 query against the UniProt endpoint (SELECT / ASK / CONSTRUCT / DESCRIBE, including SERVICE federation to Rhea, OMA, Bgee, etc.). SELECT results come back as columns+rows JSON; ASK as a boolean; CONSTRUCT/DESCRIBE as raw RDF in the chosen format. A LIMIT is auto-injected into unbounded SELECTs (see _meta/truncated). This is the escape hatch for anything the typed tools do not cover -- seed queries from search_example_queries. Use uniprot://prefixes for the standard PREFIX block. Unbounded or federated queries can take 10-60 s; bound lookups (anchored on an accession/gene/taxon) return in <2 s. Signature: run_sparql_query(query, result_format=, limit=, timeout_seconds=).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | A complete SPARQL 1.1 query string. | |
| result_format | No | Result serialisation. Use json for SELECT/ASK. | json |
| limit | No | LIMIT to inject when a SELECT lacks one (capped at 10000). | |
| timeout_seconds | No | Per-call timeout override in seconds. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | ||
| _meta | No | ||
| error_code | No | ||
| message | No | ||
| retryable | No | ||
| recovery_action | No | ||
| field | No | ||
| allowed_values | No | ||
| hint | No | ||
| query_type | No | ||
| columns | No | ||
| row_count | No | ||
| rows | No | ||
| boolean | No | ||
| content_type | No | ||
| data | No | ||
| byte_length | No | ||
| truncated | No |