跳转到内容
EN

列出关系

GET /ontology/v1/relations

Read the facts in the graph and obtain relation ids for retrieval, invalidation or spreading. Filter by endpoint node, by type and by direction; as_of reads the relations as they were then. Invalidated relations are omitted unless include_invalid is true. limit is 1–100 and defaults to 50; follow next_cursor until it is null.

支持状态: supported

参数

名称位置类型必填说明
nodequerystringfalseA node id from nodes.list or nodes.create; returns the relations this node takes part in, narrowed by direction. Omit to list relations between every node.
typequeryarray<string>falseRepeat to filter to any of several registered relation type names, for example type=references&type=serves; omit to list every type.
directionquerystringfalseWhich side of node to follow; out returns relations the node is the source of, in returns those it is the target of. Only meaningful together with node.
as_ofquerystringfalseISO 8601 timestamp; read relations as they were then, so one recorded or invalidated later is judged by that time. Omit to read current state.
include_invalidquerybooleanfalseSet true to include relations whose invalid_at has passed, which is how a relation that stopped being true stays readable. Omit or false for currently valid relations only.
limitqueryintegerfalseMaximum items to return per page, from 1 to 100; defaults to 50 when omitted. Values above 100 are clamped to 100.
cursorquerystringfalseOpaque next_cursor from the preceding list response; omit for the first page and stop when next_cursor is null.

响应

HTTP 200

One page of relations, ordered by relation id, with next_cursor null on the last page.

application/json

名称 类型 说明
data array<object> The relations on this page, ordered by relation id.
data[].id string Relation id, used by invalidation and later reads; treat it as opaque and do not parse it.
data[].type string Registered relation type this fact was recorded as; it must admit both endpoints.
data[].source string Node id the fact starts from.
data[].target string Node id the fact points at.
data[].fact string The relationship in one sentence, at most 280 characters, as it should be read back.
data[].episodes array<object> Where this fact was learned, oldest first; each entry names the scope it came from and an optional time range.
data[].origin string Where the fact came from; the relation type must list this origin among the ones it accepts.
data[].confidence number How strongly the fact is held, from 0 to 1; 1 is fully held and lower values fade faster.
data[].owner string Member id whose content this fact is; null means it is readable organization-wide. Another member's relation reads as not found.
data[].valid_at string World time the fact became true; null when it was never dated, in which case treat it as true since it was recorded.
data[].invalid_at string World time the fact stopped being true; null while it still holds. The relation is kept and reads at an earlier as_of.
data[].created_at string System time the fact was recorded, in ISO 8601 UTC.
data[].expired_at string System time the fact was judged no longer true, which trails invalid_at; null while it still holds.
data[].superseded_by string Relation id that replaced this one, when the invalidation named a successor; null when nothing replaced it.
data[].archived_at string System time the fact was archived out of spreading; null while it still spreads, and reads by time still reach it either way.
next_cursor string Opaque cursor for the next page, or null when this is the last page; copy it into the next request's cursor unchanged.