sparql_query
Run read-only SPARQL queries (SELECT, CONSTRUCT, ASK, DESCRIBE) on Apache Jena Fuseki datasets to fetch or inspect RDF triples.
Instructions
Run a read-only SPARQL query (SELECT, CONSTRUCT, ASK or DESCRIBE).
Forms: SELECT returns rows, CONSTRUCT and DESCRIBE return triples, ASK returns a boolean. WHERE is optional -- "SELECT ?s { ?s ?p ?o }" is valid SPARQL.
Property paths are the reason to reach for SPARQL over a REST API: a/b sequence ?s foaf:knows/foaf:name ?name a|b alternative ?s (rdfs:label|skos:prefLabel) ?label a* zero or more ?s skos:broader* ?ancestor a+ one or more ?s rdfs:subClassOf+ ?super a? zero or one ^a inverse ?child ^ex:hasParent ?parent !a negated ?s !rdf:type ?o
Named graphs: GRAPH { ?s ?p ?o }, or GRAPH ?g { ... } to range over all of them. Note that a query without a GRAPH clause reads the default graph, which on many datasets is empty unless the store is configured with a union default graph.
Results are capped. A SELECT without its own LIMIT gets one appended (see default_limit), because an unbounded exploration query over even a small dataset can return hundreds of thousands of characters. Pass limit: 0 to lift the cap deliberately, and out_file to send a large result to disk instead of through the conversation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Row cap for a SELECT that sets none itself. 0 lifts it. Defaults to the server setting. | |
| query | Yes | The SPARQL query. | |
| dataset | No | Dataset name. Defaults to the configured one. | |
| out_file | No | Write the result here (inside the file sandbox) and return only the path and size. |