第262章 JSON Cognitive Data|JSON 认知数据
262.1 提出背景
第261章建立了 ICAI API Architecture|ICAI API 架构,确定了 ICAI 与外部软件系统之间的通信边界:
External System
↓
ICAI API
↓
API Controller
↓
Service
↓
ICAI Runtime
↓
Model + Engine
API 解决了“系统如何连接”的问题。
但是,两个系统建立通信以后,还存在一个更加基础的问题:
ICAI 内部的认知对象究竟以什么结构传递给外部系统?
例如,ICAI 内部存在:
Object
Attribute
Relation
State
Scene
Cognition
Behavior
Action
Device
Feedback
这些都是 ICAI 的内部认知对象。
如果外部系统只接收到一个普通字符串,就无法准确理解这些结构之间的关系。
因此必须建立一种结构化的认知数据表示方式。
本章提出:
JSON Cognitive Data|JSON 认知数据。
其核心思想是:
ICAI Cognitive Object
↓
Structured Cognitive Data
↓
JSON
↓
API
↓
External System
JSON 不负责产生认知。
JSON 负责表示认知、保存认知结构和传输认知数据。
262.2 JSON Cognitive Data 的定义
JSON Cognitive Data|JSON 认知数据,是按照 ICAI 认知对象结构组织,并采用 JSON 数据格式表示的结构化机器认知数据。
其基本定义为:
Jt=Encode(CDt)J_t=Encode(CD_t)
其中:
- JtJ_t:时刻 tt 的 JSON Cognitive Data;
- CDtCD_t:时刻 tt 的 Cognitive Data;
- EncodeEncode:结构化数据编码过程。
反向:
CDt=Decode(Jt)CD_t=Decode(J_t)
其中:
- DecodeDecode:JSON 数据解析过程。
因此:
Cognitive Data
↔
JSON Cognitive Data
JSON 是认知数据的表示形式,而不是认知本身。
因此必须明确:
JSON
≠
Cognition
而是:
Cognition
↓
Cognitive Data
↓
JSON
262.3 JSON 在 ICAI 中的位置
JSON 位于 ICAI Runtime 与外部系统之间。
完整结构为:
World
↓
Real-Time Data
↓
ICAI Runtime
↓
Cognitive Model
↓
Cognitive Data
↓
JSON
↓
API
↓
External System
返回方向为:
External System
↓
API
↓
JSON
↓
Cognitive Data
↓
ICAI Runtime
因此形成:
External System
↕
API
↕
JSON
↕
Cognitive Data
↕
ICAI Runtime
JSON 成为 ICAI 与外部软件之间的重要数据载体。
262.4 JSON Cognitive Data 的总体结构
ICAI 的核心认知结构可以统一表示为:
Cognitive Data
│
├── Goal
├── Elements
├── Objects
├── Attributes
├── Relations
├── States
├── Scene
├── Cognition
├── Methods
├── Behaviors
├── Actions
├── Devices
└── Feedback
可以进一步表示为:
{
"goal": {},
"elements": [],
"objects": [],
"attributes": [],
"relations": [],
"states": [],
"scene": {},
"cognition": {},
"methods": [],
"behaviors": [],
"actions": [],
"devices": [],
"feedback": {}
}
这构成 ICAI JSON Cognitive Data 的基本骨架。
262.5 Goal Data|目标数据
目标是认知运行的重要起点。
可以定义:
G=(ID,Type,Target,Condition)G=(ID,Type,Target,Condition)
因此 JSON 可以表示为:
{
"goal": {
"id": "goal_001",
"type": "grasp",
"target": "object_001",
"condition": {
"stable": true
}
}
}
目标数据至少可以包括:
Goal ID
Goal Type
Target
Condition
Priority
Status
例如:
{
"id": "goal_001",
"type": "move",
"target": "object_001",
"priority": 1,
"status": "active"
}
目标数据进入 ICAI 后,可以成为 Cognition 与 Behavior 的重要输入。
262.6 Element Data|元素数据
Element 是 ICAI 对现实信息进行结构化处理的基础单位。
可以表示:
{
"element": {
"id": "element_001",
"type": "position",
"value": [10, 20, 30],
"unit": "mm",
"timestamp": 1756980000,
"source": "sensor_001"
}
}
Element Data 可以包括:
ID
Type
Value
Unit
Timestamp
Source
因此:
Real-Time Data
↓
Element
↓
JSON Element Data
JSON 使元素能够从 ICAI 内部向外部系统传递。
262.7 Object Data|对象数据
Object 是 ICAI 认知结构中的核心数据对象。
对象可以定义为:
O=(I,C,A,R,S,P,T)O=(I,C,A,R,S,P,T)
其中:
- II:Identity;
- CC:Class;
- AA:Attributes;
- RR:Relations;
- SS:State;
- PP:Position;
- TT:Timestamp。
JSON 可以表示:
{
"object": {
"id": "object_001",
"class": "container",
"attributes": {},
"relations": [],
"state": {},
"position": [10, 20, 30],
"timestamp": 1756980000
}
}
这样,一个 Object Instance 就可以通过 JSON 进行跨系统传递。
262.8 Attribute Data|属性数据
动态属性是 ICAI Runtime 中的重要数据。
属性可以表示:
A=(Name,Value,Unit,Timestamp,Source)A=(Name,Value,Unit,Timestamp,Source)
例如:
{
"name": "force",
"value": 2.5,
"unit": "N",
"timestamp": 1756980000,
"source": "sensor_002"
}
多个属性可以形成属性集合:
{
"attributes": {
"position": [10, 20, 30],
"velocity": [0.5, 0.0, 0.0],
"force": 2.5,
"pressure": 1.2,
"stability": 0.92
}
}
如果需要保持完整属性元数据,则可以使用数组结构:
{
"attributes": [
{
"name": "force",
"value": 2.5,
"unit": "N",
"timestamp": 1756980000,
"source": "sensor_002"
}
]
}
因此 JSON 可以同时表达静态属性和动态属性。
262.9 Relation Data|关系数据
对象之间不是孤立存在的。
ICAI 需要描述:
Object A
↓
Relation
↓
Object B
关系可以表示:
R=(Source,Type,Target,Value,State)R=(Source,Type,Target,Value,State)
例如:
{
"relation": {
"source": "object_001",
"type": "near",
"target": "object_002",
"value": 20,
"unit": "mm",
"state": "active"
}
}
多个关系:
{
"relations": [
{
"source": "object_001",
"type": "near",
"target": "object_002"
},
{
"source": "object_001",
"type": "supported_by",
"target": "object_003"
}
]
}
因此,JSON 不仅能够表示对象,也能够保持对象之间的结构关系。
262.10 State Data|状态数据
State 是对当前对象、关系或场景条件的结构化表达。
可以定义:
St=F(At,Rt,Ct)S_t=F(A_t,R_t,C_t)
其中:
- StS_t:当前状态;
- AtA_t:当前属性;
- RtR_t:当前关系;
- CtC_t:状态判断条件。
例如:
{
"state": {
"name": "stable",
"value": true,
"timestamp": 1756980000
}
}
也可以表示复杂状态:
{
"state": {
"name": "graspable",
"value": true,
"conditions": {
"reachable": true,
"stable": true,
"device_ready": true
}
}
}
因此 State Data 可以表达当前认知计算所需要的状态条件。
262.11 Scene Data|场景数据
Scene 不是对象简单相加。
其结构为:
Scene=F(Object,Relation,State,Environment,Space,Time)Scene=F(Object,Relation,State,Environment,Space,Time)
因此 Scene JSON 必须保留这些结构。
例如:
{
"scene": {
"id": "scene_001",
"type": "workspace",
"objects": [
"object_001",
"object_002"
],
"relations": [
"relation_001"
],
"state": {
"name": "reachable"
},
"environment": {},
"space": {},
"timestamp": 1756980000
}
}
Scene Data 是多个对象、关系和状态的组合结构。
因此:
Object Data
+
Relation Data
+
State Data
+
Environment Data
↓
Scene Data
262.12 Cognition Data|认知数据
Cognition Data 是 JSON Cognitive Data 的核心部分。
它描述 ICAI 当前形成的机器认知结果。
可以表示:
Ct=F(Ot,At,Rt,St,Sct,Gt)C_t=F(O_t,A_t,R_t,S_t,Sc_t,G_t)
JSON 可以表示:
{
"cognition": {
"state": "understood",
"target": "object_001",
"scene": "scene_001",
"result": {
"reachable": true,
"graspable": true
}
}
}
认知数据可以进一步包括:
Cognition ID
Cognition Type
Target
Scene
State
Result
Confidence
Reason
Timestamp
其中 Confidence 可以作为离散概率计算结果保存,但它只是认知数据中的一个属性,并不意味着需要使用其他类型的模型。
262.13 Method Data|方法数据
Method 描述系统采用的计算或处理方法。
例如:
{
"method": {
"id": "method_001",
"type": "grasp_calculation",
"parameters": {
"force": 2.5,
"pressure": 1.2,
"stability": 0.92
}
}
}
Method Data 的意义是让外部系统能够知道:
当前使用了什么方法
↓
输入了什么参数
↓
得到什么计算结果
因此:
Cognition
↓
Method
↓
Result
可以被结构化保存。
262.14 Behavior Data|行为数据
Behavior 是一个动态过程,因此 JSON 不应该只保存一个 Action。
例如:
{
"behavior": {
"id": "behavior_001",
"goal": "goal_001",
"state": "running",
"method": "method_001",
"parameters": {},
"actions": [
"action_001",
"action_002"
]
}
}
这样可以表达:
Goal
↓
Behavior
↓
Method
↓
Actions
Behavior Data 可以随着运行状态发生变化:
pending
↓
running
↓
completed
或者:
running
↓
paused
↓
resumed
↓
completed
因此 Behavior JSON 是动态数据。
262.15 Action Data|动作数据
Action 是实际执行单位。
可以表示:
At=(Type,Target,Parameters,Device,State)A_t=(Type,Target,Parameters,Device,State)
例如:
{
"action": {
"id": "action_001",
"type": "move",
"target": "object_001",
"parameters": {
"position": [20, 30, 40],
"velocity": 0.5
},
"device": "device_001",
"state": "ready"
}
}
Action Data 是 Behavior 与 Device 之间的重要数据结构。
Behavior
↓
Action Data
↓
Device
262.16 Device Data|设备数据
Device Data 描述设备当前的系统状态。
例如:
{
"device": {
"id": "device_001",
"class": "robotic_arm",
"state": "ready",
"capabilities": [
"move",
"grasp"
],
"parameters": {
"velocity": 0.5,
"force": 2.5
}
}
}
因此外部系统可以通过 API 获得:
Device Identity
Device Class
Device State
Device Capability
Device Parameters
Device Data 可以与 Action Data 进行能力匹配。
262.17 Feedback Data|反馈数据
设备执行以后产生反馈。
反馈可以表示:
Ft=(Source,Type,Value,State,Timestamp)F_t=(Source,Type,Value,State,Timestamp)
例如:
{
"feedback": {
"source": "device_001",
"type": "grasp_result",
"value": true,
"state": "completed",
"timestamp": 1756980010
}
}
反馈进入 Runtime 后:
Feedback
↓
State Update
↓
Object Update
↓
Scene Update
↓
Cognition Update
↓
Behavior Update
因此 Feedback Data 是 JSON Cognitive Data 中非常重要的一部分。
262.18 Unified Cognitive Data|统一认知数据
前面各类数据可以统一形成:
{
"goal": {},
"elements": [],
"objects": [],
"attributes": [],
"relations": [],
"states": [],
"scene": {},
"cognition": {},
"methods": [],
"behaviors": [],
"actions": [],
"devices": [],
"feedback": {}
}
可以将其定义为:
CD={G,E,O,A,R,S,Sc,C,M,B,Ac,D,F}CD= \{G,E,O,A,R,S,Sc,C,M,B,Ac,D,F\}
其中:
- GG:Goal;
- EE:Element;
- OO:Object;
- AA:Attribute;
- RR:Relation;
- SS:State;
- ScSc:Scene;
- CC:Cognition;
- MM:Method;
- BB:Behavior;
- AcAc:Action;
- DD:Device;
- FF:Feedback。
这构成 ICAI 的统一认知数据集合。
262.19 JSON Cognitive Data 的动态性
JSON 并不是只能保存静态数据。
ICAI 的认知数据随着时间发生变化:
CDt→CDt+1CD_t\rightarrow CD_{t+1}
例如:
t0
Object State = stable
↓
Action
↓
t1
Object State = moving
↓
Feedback
↓
t2
Object State = grasped
对应 JSON 数据:
JSON(t0)
↓
JSON(t1)
↓
JSON(t2)
因此 JSON 可以作为 Runtime State 的外部表示。
262.20 JSON 与 Attribute Vector
第210章已经建立 Attribute Vector。
例如:
Xt=[Position,Velocity,Distance,Force,Pressure,Stability]TX_t= [ Position, Velocity, Distance, Force, Pressure, Stability ]^T
JSON 可以表示这个向量:
{
"attribute_vector": {
"position": [10, 20, 30],
"velocity": [0.5, 0.0, 0.0],
"distance": 25,
"force": 2.5,
"pressure": 1.2,
"stability": 0.92
}
}
因此:
Attribute Vector
↓
Structured Data
↓
JSON
线性代数负责表达数据之间的数学结构,而 JSON 负责表达和传输这些数据。
二者属于不同层次:
Mathematical Model
↓
Cognitive Data
↓
JSON Representation
262.21 JSON 与 Runtime State
Runtime State 可以表示:
Rt=[Gt,Ot,Sct,Ct,Bt,At,Dt,Ft]R_t= [G_t,O_t,Sc_t,C_t,B_t,A_t,D_t,F_t]
对应 JSON:
{
"runtime": {
"goal": {},
"objects": [],
"scene": {},
"cognition": {},
"behavior": {},
"action": {},
"devices": [],
"feedback": {}
}
}
因此可以形成:
Rt↔JSON(Rt)R_t \leftrightarrow JSON(R_t)
这使得 Runtime 的当前状态能够:
保存
↓
传输
↓
读取
↓
恢复
↓
继续运行
262.22 JSON Request 与 JSON Response
在 API 中,JSON Cognitive Data 可以分为两个方向。
Request
External System
↓
JSON Request
↓
ICAI API
↓
ICAI Runtime
Response
ICAI Runtime
↓
JSON Response
↓
ICAI API
↓
External System
因此:
JSON Request
=
进入 ICAI 的认知数据
JSON Response
=
离开 ICAI 的认知数据
二者可以使用统一的数据模型。
262.23 JSON 数据与内部 PHP Object
ICAI 内部使用 PHP OOP。
因此需要建立:
PHP Object
↔
Array
↔
JSON
例如:
$object = array(
'id' => 'object_001',
'class' => 'container',
'state' => 'stable'
);
$json = json_encode($object);
反向:
$data = json_decode($json, true);
这样可以形成:
ICAI Object
↓
PHP Object / Array
↓
JSON
↓
API
返回:
API
↓
JSON
↓
PHP Array
↓
ICAI Object
因此 JSON 成为 PHP ICAI Runtime 与外部系统之间的结构化数据桥梁。
262.24 JSON Cognitive Data 的完整生命周期
一个认知数据的生命周期可以表示为:
Real World
↓
Real-Time Data
↓
Element
↓
Object
↓
Attribute
↓
Relation
↓
State
↓
Scene
↓
Cognition
↓
Behavior
↓
Action
↓
Device
↓
Feedback
↓
Cognitive Data
↓
JSON
↓
API
↓
External System
反向输入:
External System
↓
API
↓
JSON
↓
Cognitive Data
↓
ICAI Object
↓
Scene
↓
Cognition
↓
Behavior
↓
Action
由此形成完整的数据循环。
262.25 JSON Cognitive Data 的工程边界
必须明确三个不同层次:
第一层:认知理论
↓
Object / Scene / Cognition / Behavior
第二层:软件对象
↓
PHP Class / Object / Model / Engine
第三层:通信数据
↓
JSON
三者不能混淆。
因此:
JSON
≠
PHP Class
PHP Class
≠
Cognitive Theory
Cognitive Theory
≠
JSON
正确关系为:
Cognitive Theory
↓
Software Object Model
↓
Runtime Object
↓
Cognitive Data
↓
JSON
这样可以保持理论、软件实现和通信协议之间的层次独立。
262.26 本章总结
第262章建立了 JSON Cognitive Data|JSON 认知数据。
本章将 ICAI 已经建立的认知对象转换为统一的结构化数据体系:
Goal
↓
Element
↓
Object
↓
Attribute
↓
Relation
↓
State
↓
Scene
↓
Cognition
↓
Method
↓
Behavior
↓
Action
↓
Device
↓
Feedback
并通过:
Cognitive Data
↓
JSON
↓
API
↓
External System
实现认知数据的跨系统表示与传输。
其核心关系可以总结为:
ICAI Object→Cognitive Data→JSON→API→External SystemICAI\ Object \rightarrow Cognitive\ Data \rightarrow JSON \rightarrow API \rightarrow External\ System
同时支持反向:
External JSON→Cognitive Data→ICAI Object→ICAI RuntimeExternal\ JSON \rightarrow Cognitive\ Data \rightarrow ICAI\ Object \rightarrow ICAI\ Runtime
因此,第261章解决了:
“ICAI 如何与外部系统通信?”
第262章进一步解决:
“ICAI 的认知结构如何成为可以通信的数据?”
至此,ICAI 已经建立:
ICAI MVC Runtime
↓
ICAI API Architecture
↓
JSON Cognitive Data
下一阶段可以继续建立:
JSON Cognitive Data
↓
API Request
↓
API Response
↓
Endpoint
↓
独立系统调用
使 JSON 认知数据真正进入 ICAI API 的实际通信运行体系。