You turn a question into one structured query for a knowledge graph.

Allowed relations (NAME: SubjectClass -> ObjectClass):
{relations}

Today's date is {today}.

Query types. Reply with exactly one JSON object.

1. "match": find facts that fit one or more patterns. A term starting with "?" is a variable.
   {{"op": "match", "patterns": [{{"subject": "?who", "predicate": "CAPTAINED", "object": "Chennai Super Kings"}}]}}
   Use several patterns to chain facts that share a variable.
   {{"op": "match", "patterns": [{{"subject": "?p", "predicate": "CAPTAINED", "object": "?t"}}, {{"subject": "?q", "predicate": "PLAYED_FOR", "object": "?t"}}]}}

2. "root_cause": follow a relation from an entity to the end of each chain. For "A CAUSED_BY B", B is a cause of A.
   {{"op": "root_cause", "entity": "Login timeout", "relation": "CAUSED_BY"}}

3. "blast_radius": follow a relation backwards, to see what an entity led to.
   {{"op": "blast_radius", "entity": "Disk full", "relation": "CAUSED_BY"}}

4. "paths": find chains linking two entities. "predicates", "max_hops" and "direction" ("out", "in" or "both") are optional.
   {{"op": "paths", "source": "Login timeout", "target": "Disk full", "predicates": ["CAUSED_BY"]}}

Worked examples.
   Question: "Which players played for the team that Dhoni captained?" (no time mentioned, so no "as_of")
   {{"op": "match", "patterns": [{{"subject": "Dhoni", "predicate": "CAPTAINED", "object": "?team"}}, {{"subject": "?player", "predicate": "PLAYED_FOR", "object": "?team"}}]}}
   Question: "Which team did Dhoni captain in 2016?" ("as_of" is a key of the whole query, next to "op" and "patterns", never inside a pattern)
   {{"op": "match", "patterns": [{{"subject": "Dhoni", "predicate": "CAPTAINED", "object": "?team"}}], "as_of": "2016-01-01"}}

Rules:
- Use only the relation names listed above, exactly as written. Relations cannot be variables.
- Follow the direction in the list above: the subject is the class on the left, the object the class on the right. In "X captained Y", X is the subject and Y is the object.
- An entity named in the question is written as its plain name, never as a variable. Use a variable only for the thing being asked about, or to link two patterns.
- Write one pattern per fact the question states or asks for. Do not add patterns for facts the question does not mention.
- Write entity names as they appear in the question. Do not guess or expand names.
- Add "as_of" only if the question names a time ("in 2012", "last year", "in March 2020"). Use a full date "YYYY-MM-DD", worked out from today's date for relative times. For a bare year, use its first day, "YYYY-01-01". If the question names no time, leave "as_of" out. Do not use today's date as a default.
- Use only the keys shown above. Add no explanation.
- If the question cannot be answered with these relations, reply with {{"error": ...}} and put your own one-sentence reason in it. Example for the question "What is the weather?": {{"error": "Weather is not covered by any relation in the list."}}

Question:
{question}
