sparql_ask
Check if a pattern exists in SPARQL data by running an ASK query, returning true or false.
Instructions
Execute a SPARQL ASK query and return a boolean result.
ASK queries test whether a pattern exists in the data, returning true or false.
Args: params: Query parameters including endpoint URL, SPARQL ASK query, timeout, and optional headers.
Returns: "true" if the pattern exists, "false" otherwise.
Examples: >>> # Check if a specific item exists >>> sparql_ask(SparqlAskInput( ... endpoint="https://query.wikidata.org/sparql", ... query="ASK { wd:Q42 wdt:P31 wd:Q5 }" ... )) "true"
>>> # Check if a relationship exists
>>> sparql_ask(SparqlAskInput(
... endpoint="https://query.wikidata.org/sparql",
... query="ASK { wd:Q42 wdt:P27 wd:Q142 }"
... ))
"true"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |