hydrai:ExampleQuery
A worked query a client can learn from: a natural-language intent, the query text, and the endpoint it runs against. Few-shot orientation, expressed as data.
agent.ttl at build time.The authoritative definitions
hydrai:ExampleQuery
class
example query
A worked query a client can learn from: a natural-language intent, the query text, and the endpoint it runs against. Few-shot orientation, expressed as data. Executable content: a consumer NEVER runs it verbatim — an example is a candidate routed through the consumer's query gates and executed only under the consumer's own authority (see §8.3). Structural constraints (ExampleQueryShape) are coarse defence-in-depth; they do not make a query safe.
defined by https://hydrai.org/ns/agent · see also https://hydrai.org/docs/example-query
hydrai:exampleQuery
object property
example query
Relates a service or collection to an example query it offers.
defined by https://hydrai.org/ns/agent
hydrai:intent
datatype property
The natural-language purpose an example query answers.
defined by https://hydrai.org/ns/agent
hydrai:queryText
datatype property
query text
The query string (SPARQL in 0.1). Coarsely constrained by shape (read verb, no obvious mutation keyword, length); safety is enforced at EXECUTION, not by the shape — SPARQL is not a regular language and a read-only query can still exfiltrate via SERVICE federation.
defined by https://hydrai.org/ns/agent
hydrai:overEndpoint
object property
over endpoint
The endpoint an example query runs against.
defined by https://hydrai.org/ns/agent
hydrai:ExampleQueryShape
SHACL shape
COARSE structural constraint only — defence-in-depth, never a safety guarantee. Requires a read verb, forbids the obvious mutation keywords, caps length, types the endpoint. It does NOT and CANNOT catch SERVICE-clause exfiltration; execution containment is the real wall.
sh:pathhydrai:intentsh:datatypexsd:stringsh:maxLength140sh:maxCount1
sh:pathhydrai:overEndpointsh:maxCount1sh:nodeKindsh:IRI
sh:pathhydrai:queryTextsh:datatypexsd:stringsh:maxLength2000sh:maxCount1sh:minCount1sh:pattern^\s*(SELECT|ASK|CONSTRUCT|DESCRIBE)sh:flagsish:not[sh:pattern(?i)\b(INSERT|DELETE|DROP|CLEAR|LOAD|CREATE)\b ]
How to use it
Few-shot is how an agent orients. exampleQuery is the hypermedia-native way to advertise it: an (intent, query, endpoint) tuple carried as data, so the one hand-written orchestration block a client used to carry becomes served, versioned, projectable content.
@prefix hydrai: <https://hydrai.org/ns/agent#> .
@prefix schema: <https://schema.org/> .
</Api/> hydrai:exampleQuery [
a hydrai:ExampleQuery ;
hydrai:intent "Contacts created this quarter, most recent first" ;
hydrai:queryText "SELECT ?c WHERE { ?c a schema:Person ; schema:dateCreated ?d . FILTER(?d >= '2026-07-01') } ORDER BY DESC(?d)" ;
hydrai:overEndpoint <https://example.org/sparql> ;
] .
Executable content is never run verbatim
An exampleQuery is executable, and that is exactly why a consumer never runs it as-is. It is a candidate routed through the consumer's own query gates and executed only under the consumer's own authority. The ExampleQueryShape above is coarse, defence-in-depth structural validation: it requires a read verb, forbids the obvious mutation keywords, caps length, and types the endpoint.
SERVICE federation. Safety is enforced at execution, in the client's query containment, not by the shape. The shape is a coarse filter; the execution gate is the real wall. See the safety posture.Bound semantics
The one thing core Hydra genuinely cannot say about a template variable (that two variables are the ends of a range over one property) is expressed with lowerBoundOf / upperBoundOf (harvest pending):
[] hydrai:lowerBoundOf schema:dateCreated . # ?from → ?d >= ?from
[] hydrai:upperBoundOf schema:dateCreated . # ?to → ?d <= ?to