Create derive
Concludes what the organization's rules derive from the graph, with a proof for every conclusion: the rule, and each support as the assertion in force it…
POST /v1/graph/derive
| Address | https://api.hanzo.ai/v1/graph/derive |
| Method | POST |
| Operation | graphDerive |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Concludes what the organization's rules derive from the graph, with a proof for every conclusion: the rule, and each support as the assertion in force it rests on or as the derived atom it is.
The rules are assertions — (rule:<name>, rule, <text>), Datalog over
the organization's relations, with recursion, stratified negation and the
builtins = and != — and the graph is read the way resolve reads it, so a
retraction, an until and a declared cardinality all apply. Nothing derived is
stored unless an admin asks to file it. Without names assertions to derive
without, and the answer then says what would be lost, and what gained, if
they had never been filed.
Time: as_of and as_known place the graph and the rules it is read with, as they place a resolve; either absent is now. Filing takes neither: a filed conclusion holds from the instant it was derived.
Request
5 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
as_known | body | string | — | AsKnown is how much this plane had heard, RFC 3339 — of the statements and of the rules — so a past answer is reproducible. |
as_of | body | string | — | AsOf derives from the graph as it stood at an instant of the world, RFC 3339: the statements that held then. |
file | body | boolean | — | File files each tuple Derived lists as an assertion: (subject, predicate, object) from the instant it was derived at, open, its source the rule, its evidence… |
predicates | body | string[] | — | Predicates are what to derive: every tuple the rules in force conclude of each, with its proof. |
without | body | string[] | — | Without is assertion IDs, of statements or of rules, to derive without as though they had never been filed. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | graph.graphDeriveOut | ok |
default | problem-details | refused |
200 body — 49 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
as_known | body | string | — | AsKnown is the knowledge instant it was taken at, RFC 3339, the same way. |
as_of | body | string | — | AsOf is the instant the graph was read at, RFC 3339: the one asked for, or the server's clock when none was. |
bound | body | integer (int64) | — | Bound is the most tuples one evaluation derives. |
cut | body | string | — | Cut names the bound that stopped it: tuples, at Bound tuples derived, or steps, at Steps rows examined. |
derived | body | graph.graphConclusion[] | — | Derived is every tuple of the predicates asked for that the rules derive, ordered by predicate, subject and object. |
derived[].decay | body | number (double) | — | Decay is the product of the confidences of the distinct statements the proof rests on: how much certainty survives the derivation. |
derived[].from | body | string | — | From is the latest start among the statements the proof rests on, RFC 3339. |
derived[].object | body | string | — | Object is its second argument. |
derived[].predicate | body | string | — | Predicate is the relation concluded. |
derived[].rule | body | string | — | Rule is the rule that concluded it, rule:<name>. |
derived[].rule_id | body | string | — | RuleID is the ID of the assertion stating that rule's text as it was in force. |
derived[].subject | body | string | — | Subject is the tuple's first argument. |
derived[].supports | body | graph.graphSupport[] | — | Supports are the rule's positive atoms as they matched, in the order the rule writes them. |
derived[].supports[].assertion | body | string | — | Assertion is the ID of the statement in force the atom rests on. |
derived[].supports[].object | body | string | — | Object is its second argument. |
derived[].supports[].predicate | body | string | — | Predicate is the relation the supporting atom is of. |
derived[].supports[].subject | body | string | — | Subject is its first argument. |
derived[].until | body | string | — | Until is the earliest until any of those statements states, RFC 3339. Absent is open. |
derived[].weakest | body | string | — | Weakest is the ID of the statement with the lowest confidence among them, the first on a tie: the link the conclusion is only as strong as. |
filed | body | graph.graphAssertOut | — | |
filed.duplicate | body | integer (int64) | — | Duplicate is how many members this plane already held. |
filed.reasons | body | string[] | — | Reasons names why each refused member was refused, in the order sent. |
filed.recorded | body | integer (int64) | — | Recorded is how many members became new rows. |
filed.refused | body | integer (int64) | — | Refused is how many members were turned away — a missing entity, a timestamp that is not RFC 3339, a confidence outside [0,1], a relation whose declared domain… |
gained | body | graph.graphAtom[] | — | Gained is each that holds only without them — a negation those assertions had been refuting. |
gained[].object | body | string | — | Object is its second argument. |
gained[].predicate | body | string | — | Predicate is the relation the tuple is of. |
gained[].subject | body | string | — | Subject is its first argument. |
lemmas | body | graph.graphConclusion[] | — | Lemmas is every derived tuple of any other predicate a proof in Derived cites, in the same order, so every support that is not an assertion can be followed to… |
lemmas[].decay | body | number (double) | — | Decay is the product of the confidences of the distinct statements the proof rests on: how much certainty survives the derivation. |
lemmas[].from | body | string | — | From is the latest start among the statements the proof rests on, RFC 3339. |
lemmas[].object | body | string | — | Object is its second argument. |
lemmas[].predicate | body | string | — | Predicate is the relation concluded. |
lemmas[].rule | body | string | — | Rule is the rule that concluded it, rule:<name>. |
lemmas[].rule_id | body | string | — | RuleID is the ID of the assertion stating that rule's text as it was in force. |
lemmas[].subject | body | string | — | Subject is the tuple's first argument. |
lemmas[].supports | body | graph.graphSupport[] | — | Supports are the rule's positive atoms as they matched, in the order the rule writes them. |
lemmas[].supports[].assertion | body | string | — | Assertion is the ID of the statement in force the atom rests on. |
lemmas[].supports[].object | body | string | — | Object is its second argument. |
lemmas[].supports[].predicate | body | string | — | Predicate is the relation the supporting atom is of. |
lemmas[].supports[].subject | body | string | — | Subject is its first argument. |
lemmas[].until | body | string | — | Until is the earliest until any of those statements states, RFC 3339. Absent is open. |
lemmas[].weakest | body | string | — | Weakest is the ID of the statement with the lowest confidence among them, the first on a tie: the link the conclusion is only as strong as. |
lost | body | graph.graphAtom[] | — | Lost is each tuple of the predicates asked for, asserted or derived, that holds with everything and not without the assertions Without names. |
lost[].object | body | string | — | Object is its second argument. |
lost[].predicate | body | string | — | Predicate is the relation the tuple is of. |
lost[].subject | body | string | — | Subject is its first argument. |
steps | body | integer (int64) | — | Steps is the most rows one evaluation's joins examine. |
truncated | body | boolean | — | Truncated says a bound stopped the evaluation before its fixpoint. |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, GraphApi } from 'hanzoai';
const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphDerive({ as_known: "<as_known>", as_of: "<as_of>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import GraphApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = GraphApi(client).graph_derive(as_known="<as_known>", as_of="<as_of>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.GraphAPI.GraphDerive(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, graph_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = graph_api::graph_derive(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.GraphApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new GraphApi(client).graphDerive();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/graph/derive \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"as_known": "<as_known>",
"as_of": "<as_of>"
}'MCP declares no tool for graph — tools/list on https://api.hanzo.ai/v1/mcp names the products it does reach. Use HTTP or an SDK.
How is this guide?