SPARQLString
Converts natural language questions into SPARQL queries for a specified endpoint using an LLM and optional context, then validates parsing and required projections.
Instructions
Writes a SPARQL query for an endpoint from a natural language question, using an LLM.
`projection` names the variables the query must project (because what follows reads them from its rows).
`context` holds operations (e.g. a SELECT that inventories predicates, or looks a label up) whose
results are shown to the model as what the endpoint holds, before it writes the query.
A query that does not parse or lacks the projection goes back to the model, a few times at most.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"endpoint": "<endpoint>",
"question": "<question>"
},
"name": "SPARQLString"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Operations whose results show the model what the endpoint holds. | |
| endpoint | Yes | The SPARQL endpoint the query is for. | |
| question | Yes | The natural language question to convert into a SPARQL query. | |
| projection | No | Variable names the query must be a SELECT projecting. |