本体查询 · 本体查询 API (0.2.0)

Download OpenAPI specification:

Schema and data-query endpoints resolve trusted dependencies from the published main knowledge-network model and require the real caller's view_detail or query_data on every canonical {resource_type}:{kn_id}/{child_id} dependency before reading metadata or data. The service then resolves the knowledge network's active managed proxy; Vega performs the final corresponding resource permission check for that proxy through its restricted internal endpoint.

Proxy identity and target bindings are always server-derived from the current published main model. See ../knowledge-network-authorization.md and trusted-proxy-context.md. Instance and subgraph reads use ignore_local_index (default false) to bypass a resource's local index where supported. Applicability and operator support depend on the resource's query capabilities in Vega. This replaces the ineffective ignoring_store_cache parameter; no compatibility alias is provided. Object responses expose Vega's actual query_source (local_index or source) instead of search_from_index. Clients must migrate these names together with the server. The internal cursor digest encoding remains unchanged. Resource consumers retain the unified sorting, paging and total-request rules. Unsupported Resource capabilities return errors through the existing query boundary. Conditions and final JSON results preserve exact numeric values. Unknown totals stay absent; a known zero is preserved. Changing ignore_local_index requires a new query rather than continuing an existing cursor.

Knowledge-network versions

The Community edition always reads the running knowledge-network model. From 0.2.2 knowledge-network drafts and versions belong to the Professional edition. A legacy kn_version of running, draft or 1 still reads the running model; any other version number is 400 BknBackend.KNVersion.NotVersioned, draft_revision is 403 BknBackend.KNVersion.EditionRestricted, and a malformed kn_version or draft_revision is 400 OntologyQuery.KNVersion.InvalidParameter.

获取 Ontology Query 健康状态和平台版本

返回 Ontology Query 运行时信息。当前所有服务统一发布版本时,ServerVersion 表示平台版本。

Responses

Response samples

Content type
application/json
{
  • "ServerName": "string",
  • "ServerVersion": "string",
  • "Language": "string",
  • "GoVersion": "string",
  • "GoArch": "string"
}

Get the bound Vega schema in an object-type context

Requires the caller's object_type.view_detail. The target resource is resolved from the current published main model; Vega performs the final resource.view_detail check for the knowledge network's managed proxy. Proxy identities and resource IDs supplied by the client are ignored.

Authorizations:
OAuth2
path Parameters
kn_id
required
string
ot_id
required
string
query Parameters
branch
string
Default: "main"
Value: "main"

Responses

Response samples

Content type
application/json
{
  • "schema_definition": [
    ]
}

Get object-type sample data through the managed proxy

Requires the caller's object_type.query_data. The target resource is resolved from the current published main model and Vega performs the final managed-proxy resource.query_data check before reading rows. Reads a single page using limit and offset.

Authorizations:
OAuth2
path Parameters
kn_id
required
string
ot_id
required
string
query Parameters
branch
string
Default: "main"
Value: "main"
limit
integer [ 1 .. 100 ]
Default: 20
offset
integer >= 0
Default: 0
need_total
boolean
Default: true

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "columns": [
    ],
  • "entries": [
    ],
  • "total_count": 0,
  • "paging": {
    },
  • "effective_permissions": {
    }
}

检索指定对象类的对象的详细数据

Authorizations:
OAuth2
path Parameters
kn_id
required
string

业务知识网络ID

ot_id
required
string

对象类ID

query Parameters
branch
string
Default: "main"

分支,默认 main

include_type_info
boolean

是否包含对象类信息, 默认false,不包含

include_logic_params
boolean

包含逻辑属性的计算参数,默认false,返回结果不包含逻辑属性的字段和值

exclude_system_properties
Array of strings
Items Enum: "_instance_id" "_instance_identity" "_display"

需要排除的系统字段列表。可选值:_instance_id(实例ID)、_instance_identity(实例唯一标识)、_display(显示值);其他值返回 400。如果指定了某个字段,则在返回的对象数据中不包含该字段。可以传递多个值,例如:?exclude_system_properties=_instance_id&exclude_system_properties=_display

ignore_local_index
boolean

是否跳过资源的本地索引并查询数据源,默认 false;参数是否适用及 match/knn 等算子是否受支持,由 Vega 根据资源的查询能力决定。

header Parameters
X-HTTP-Method-Override
required
string
Value: "GET"

重载 post,实际上是 get 方法

Request Body schema: application/json
required
One of
paging_mode
string
Default: "single"
Enum: "single" "cursor"

single 使用 offset 和 limit 查询一页。cursor 直接从 Vega 开启游标。

cursor
string or null <= 0 characters

首屏省略或留空。

condition_and (object) or condition_or (object) or condition_eq (object) or condition_not_eq (object) or condition_gt (object) or condition_gte (object) or condition_lt (object) or condition_lte (object) or condition_in (object) or condition_not_in (object) or condition_like (object) or condition_not_like (object) or condition_range (object) or condition_out_range (object) or condition_exist (object) or condition_not_exist (object) or condition_regex (object) or condition_match (object) or condition_match_phrase (object) or condition_knn (object) or condition_multi_match (object) (Condition)
Array of objects (Sort)

排序字段,默认使用 _score 倒序,主键字段正序

limit
required
integer [ 1 .. 10000 ]

返回的数量,必填,范围 1-10000,缺省或超出范围返回 400

offset
integer >= 0

首屏偏移量,默认为 0。

need_total
boolean

为 true 时尝试获取总数。默认 false。

properties
Array of strings

指定需要输出的属性集。默认为全部数据属性

Responses

Request samples

Content type
application/json
Example
{
  • "paging_mode": "cursor",
  • "condition": {
    },
  • "need_total": true,
  • "limit": 10
}

Response samples

Content type
application/json
Example
{
  • "is_sorted": false,
  • "object_type": {
    },
  • "datas": [
    ],
  • "total_count": 1,
  • "cursor": "opaque-authenticated-cursor"
}

子图查询

支持按起点、方向和路径长度探索子图,也支持按关系路径查询子图。两种方式的请求和返回体各自定义。 两种方式都使用 single,每次独立读取一页起点。翻页时调整 offset 和 limit。 按起点查询使用请求顶层的 offset 和 limit。按关系路径查询时,在各路径的 object_types[0] 指定 offset 和 limit。 排序状态 is_sorted 和告警 warnings 描述起点对象批次,分别出现在按起点响应的顶层和各路径的 entries 项内。

Authorizations:
OAuth2
path Parameters
kn_id
required
string

业务知识网络ID

query Parameters
branch
string

分支名称,默认 main(与实现 DefaultQuery branch 一致)

include_logic_params
boolean

包含逻辑属性的计算参数,默认false,返回结果不包含逻辑属性的字段和值

exclude_system_properties
Array of strings
Items Enum: "_instance_id" "_instance_identity" "_display"

需要排除的系统字段列表。可选值:_instance_id(实例ID)、_instance_identity(实例唯一标识)、_display(显示值)。如果指定了某个字段,则在返回的对象数据中不包含该字段。可以传递多个值,例如:?exclude_system_properties=_instance_id&exclude_system_properties=_display

query_type
string
Enum: "" "relation_path"

查询类型,默认是子图探索,即基于起点、方向和路径长度获取对象子图;若是relation_path,则表示基于路径获取对象子图

ignore_local_index
boolean

是否跳过资源的本地索引并查询数据源,默认 false;参数是否适用及 match/knn 等算子是否受支持,由 Vega 根据资源的查询能力决定。

header Parameters
x-http-method-override
required
string
Value: "GET"

重载 POST,须为 GET(与对象实例查询等接口一致,实现中强制校验)

Request Body schema: application/json
required

子图查询请求体

One of
concept_groups
Array of strings

概念分组id数组

source_object_type_id
required
string

起点对象类id

condition_and (object) or condition_or (object) or condition_eq (object) or condition_not_eq (object) or condition_gt (object) or condition_gte (object) or condition_lt (object) or condition_lte (object) or condition_in (object) or condition_not_in (object) or condition_like (object) or condition_not_like (object) or condition_range (object) or condition_out_range (object) or condition_exist (object) or condition_not_exist (object) or condition_regex (object) or condition_match (object) or condition_match_phrase (object) or condition_knn (object) or condition_multi_match (object) (Condition)
direction
required
string
Enum: "forward" "backward" "bidirectional"

探索子图的路径方向

path_length
required
integer <= 3

探索子图的路径的最大长度,最大为 3,超过返回 400

include_incomplete_path
boolean
Default: false

是否包含不完整的路径。默认是false,不包含,只返回完整的路径

Array of objects (Sort)

对起点类的排序字段

limit
integer [ 1 .. 10000 ]
Default: 1000

对起点类的对象数量的限制。默认 1000,范围 1-10000

need_total
boolean

为 true 时尝试获取起点对象总数。默认 false。

offset
integer >= 0
Default: 0

跳过的起点对象数。

Responses

Request samples

Content type
application/json
Example
{
  • "source_object_type_id": "comment",
  • "direction": "forward",
  • "path_length": 2,
  • "need_total": true,
  • "offset": 2,
  • "limit": 2
}

Response samples

Content type
application/json
Example
{
  • "objects": {
    },
  • "relation_paths": [
    ],
  • "total_count": 151043,
  • "current_path_number": 44,
  • "overall_ms": 4204
}

基于一组对象实例组织关系子图

给定一组对象实例,按概念定义的关系,组织这些对象实例的关系子图。

Authorizations:
OAuth2
path Parameters
kn_id
required
string

业务知识网络ID

query Parameters
branch
string

分支名称

include_type_info
boolean

是否包含对象类信息,默认false,不包含

include_logic_params
boolean

包含逻辑属性的计算参数,默认false,返回结果不包含逻辑属性的字段和值

ignore_local_index
boolean

是否跳过资源的本地索引并查询数据源,默认 false;参数是否适用及 match/knn 等算子是否受支持,由 Vega 根据资源的查询能力决定。

exclude_system_properties
Array of strings
Items Enum: "_instance_id" "_instance_identity" "_display"

需要排除的系统字段列表。可选值:_instance_id(实例ID)、_instance_identity(实例唯一标识)、_display(显示值)。如果指定了某个字段,则在返回的对象数据中不包含该字段。可以传递多个值,例如:?exclude_system_properties=_instance_id&exclude_system_properties=_display

Request Body schema: application/json
required

基于一组对象实例探索关系子图的请求体

required
Array of objects (InputObjectInstance)

对象实例数组

Responses

Request samples

Content type
application/json
{
  • "entries": [
    ]
}

Response samples

Content type
application/json
{
  • "objects": {
    },
  • "isolated_objects": {
    },
  • "relation_paths": [
    ],
  • "overall_ms": 150
}

对象属性值查询

Authorizations:
OAuth2
path Parameters
kn_id
required
string

业务知识网络ID

ot_id
required
string

对象类ID

query Parameters
branch
string

分支名称,默认 main

include_type_info
boolean

是否包含对象类信息,默认 false

exclude_system_properties
Array of strings
Items Enum: "_instance_id" "_instance_identity" "_display"

需要排除的系统字段列表。可选值:_instance_id(实例ID)、_instance_identity(实例唯一标识)、_display(显示值)。如果指定了某个字段,则在返回的对象数据中不包含该字段。可以传递多个值,例如:?exclude_system_properties=_instance_id&exclude_system_properties=_display

header Parameters
x-http-method-override
required
string
Value: "GET"

重载 post,实际上是 get 方法

Request Body schema: application/json
required

属性查询请求体

required
Array of objects (InstanceIdentity)

对象主键的数组,代表多个对象。每项为 map,key 为主键属性名,value 为对应的属性值

properties
required
Array of strings

属性列表

object

各逻辑属性所需的动态参数:外层 key 为逻辑属性名,内层为参数名到取值的 map,取值可为任意 JSON。 参数名含 . 时按嵌套对象读取,例如参数 a.b 需传 {"a": {"b": <值>}},扁平 key "a.b" 不会被识别。 未传或某属性无动态需求时可省略该 key;属性定义了 value_from=input 的参数却未传对应 key 时返回 400。

Responses

Request samples

Content type
application/json
{
  • "_instance_identities": [
    ],
  • "properties": [
    ]
}

Response samples

Content type
application/json
{
  • "is_sorted": false,
  • "datas": [
    ],
  • "overall_ms": 2588
}