跳转到内容
EN

读取邻域

GET /ontology/v1/nodes/{node_id}/neighborhood

Load the subgraph around one node instead of the whole graph — the read to use when a screen or an agent needs the context of one entity. Returns the start node, every node within depth hops of it, the relations whose both ends are in that set, and truncated true when the node limit cut the walk short. direction chooses which way relations are followed; as_of and include_invalid read the graph as those parameters do elsewhere. Visibility is exactly nodes.retrieve’s — a node you may reach but not read comes back restricted with its name only, and relations touching it are withheld, so this read never reaches further than a node read does. The node id comes from nodes.list, nodes.create or a changeset; an unknown one answers ONTOLOGY_NODE_NOT_FOUND, the same answer nodes.retrieve gives.

支持状态: supported

参数

名称位置类型必填说明
node_idpathstringtrueNode id returned by nodes.list, nodes.create or a changeset, in the form ond_ followed by 32 lowercase letters or digits; a name or an external record id is not accepted.
depthqueryintegerfalseHow many hops from the given node to walk, 1 to 3; defaults to 1. A value outside that range is refused 400 rather than clamped, so the answer is never a smaller graph than the one asked for.
limitqueryintegerfalseMaximum nodes to return, 1 to 500; defaults to 200. When the walk reaches this many nodes it stops and reports truncated true, so treat a truncated answer as a sample of the neighborhood rather than all of it. This bound is not the list routes’ page size, and there is no cursor to resume from.
directionquerystringfalseWhich way to follow relations from each node walked; out follows relations the node is the source of, in follows those it is the target of, both follows either. Defaults to both. Relations between two returned nodes are included whichever direction brought the second node in.
as_ofquerystringfalseISO 8601 timestamp; walk the graph as it was then — a node recorded later is absent and a relation invalidated since still counts. Omit to read current state.
include_invalidquerybooleanfalseSet true to walk relations whose invalid_at has passed, which is how a fact that stopped being true stays reachable. Omit or false to walk currently valid relations only.

响应

HTTP 200

The neighborhood in BFS order — the start node first, then each hop ordered by node id — with truncated true when the limit cut it short.

application/json

名称 类型 说明
nodes array<object> The nodes in BFS order — the start node first, then each hop ordered by node id, so the same request against the same graph returns the same sequence. A node you may reach but not read appears as a restricted entry.
nodes[].id string Node id, used by relations, merges and later reads; treat it as opaque and do not parse it. / Node id, usable to relate this entity to others; treat it as opaque.
nodes[].type string Registered node type this entity was recorded as; it never changes after creation. / Registered node type of the hidden entity, which is not itself restricted content.
nodes[].ref string Id of the mirrored record in the service that owns it, matching the type's ref_prefix; null for a concept with no external record.
nodes[].name string Display name of the entity, at most 200 characters. / Display name of the hidden entity, shown so a caller can tell whether the reached node is the one it meant.
nodes[].aliases array<string> Other names this entity is known by; they are matched by search alongside the name.
nodes[].description string Profile of the entity, at most 500 characters; null when none was recorded.
nodes[].owner string Member id whose content this is; null means it is readable organization-wide. Another member's node comes back restricted.
nodes[].merged_into string When this node was merged into another, that survivor's id; reads of a merged node resolve to the survivor.
nodes[].created_at string System time when the node was first recorded, in ISO 8601 UTC.
nodes[].updated_at string System time of the last change to this node's content, in ISO 8601 UTC.
nodes[].deleted_at string System time the mirrored record was deleted, when that is known; kept so history stays answerable.
nodes[].restricted boolean Always true; its presence is how a caller tells a withheld node from a readable one.
relations array<object> The relations whose both ends are in nodes, ordered by relation id. A relation touching a node you may not read is withheld, so this list never reveals content nodes.retrieve would withhold.
relations[].id string Relation id, used by invalidation and later reads; treat it as opaque and do not parse it.
relations[].type string Registered relation type this fact was recorded as; it must admit both endpoints.
relations[].source string Node id the fact starts from.
relations[].target string Node id the fact points at.
relations[].fact string The relationship in one sentence, at most 280 characters, as it should be read back.
relations[].episodes array<object> Where this fact was learned, oldest first; each entry names the scope it came from and an optional time range.
relations[].origin string Where the fact came from; the relation type must list this origin among the ones it accepts.
relations[].confidence number How strongly the fact is held, from 0 to 1; 1 is fully held and lower values fade faster.
relations[].owner string Member id whose content this fact is; null means it is readable organization-wide. Another member's relation reads as not found.
relations[].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.
relations[].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.
relations[].created_at string System time the fact was recorded, in ISO 8601 UTC.
relations[].expired_at string System time the fact was judged no longer true, which trails invalid_at; null while it still holds.
relations[].superseded_by string Relation id that replaced this one, when the invalidation named a successor; null when nothing replaced it.
relations[].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.
truncated boolean True when the node limit stopped the walk before it reached its depth, so nodes is a sample rather than the whole neighborhood; raise limit or lower depth for a complete answer within the bounds.