你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

graph-to-table 运算符

适用于:✅Azure 数据资源管理器Azure Monitor✅ Sentinel

运算符将 graph-to-table 节点或边缘从图形导出到表。

语法

节点

G|graph-to-tablenodes [ with_node_id=ColumnName ]

边缘

G|graph-to-tableedges [ with_source_id=ColumnName ] [ with_target_id=ColumnName ] [ asTableName ]

节点和边

G|graph-to-tablenodesasNodesTableName [ with_node_id=ColumnName ],edgesasEdgesTableName [ with_source_id=ColumnName ] [with_target_id=ColumnName ]

参数

名称 类型 必选 DESCRIPTION
G string ✔️ 输入图源。
NodesTableName string 导出的节点表的名称。
EdgesTableName string 导出的边缘表的名称。
ColumnName string 导出具有给定列名称的节点哈希 ID、源节点哈希 ID 或目标节点哈希 ID。

退货

节点

运算符 graph-to-table 返回表格结果,其中每一行对应于源图中的节点。 返回的列是节点的属性。 提供时 with_node_id ,节点哈希列的类型 long

边缘

运算符 graph-to-table 返回表格结果,其中每一行对应于源图中的边缘。 返回的列是节点的属性。 提供或with_source_id提供时with_target_id,节点哈希列的类型long

节点和边

运算符 graph-to-table 返回两个表格结果,与前面的说明匹配。

例子

以下示例对运算符如何将边缘从图形导出到表的方式 graph-to-table 进行反规范。 参数with_source_idwith_target_id导出每个边缘的源节点和目标节点的节点哈希。

let nodes = datatable(name:string, type:string, age:long) 
[ 
	"Alice", "Person", 23,  
	"Bob", "Person", 31,  
	"Eve", "Person", 17,  
	"Mallory", "Person", 29,  
	"Trent", "System", 99 
]; 
let edges = datatable(source:string, destination:string, edge_type:string) 
[ 
	"Alice", "Bob", "communicatesWith",  
	"Alice", "Trent", "trusts",  
	"Bob", "Trent", "hasPermission",  
	"Eve", "Alice", "attacks",  
	"Mallory", "Alice", "attacks",  
	"Mallory", "Bob", "attacks"  
]; 
edges 
| make-graph source --> destination with nodes on name
| graph-to-table edges with_source_id=SourceId with_target_id=TargetId

输出

SourceId TargetId 来源 目的地 edge_type
-3122868243544336885 -7133945255344544237 爱丽丝 鲍勃 communicatesWith
-3122868243544336885 2533909231875758225 爱丽丝 特 伦 特 信托
-7133945255344544237 2533909231875758225 鲍勃 特 伦 特 hasPermission
4363395278938690453 -3122868243544336885 前夕 爱丽丝 攻击
3855580634910899594 -3122868243544336885 马洛里 爱丽丝 攻击
3855580634910899594 -7133945255344544237 马洛里 鲍勃 攻击

获取节点

下面的示例演示如何 graph-to-table 运算符将节点从图形导出到表。 参数 with_node_id 导出节点哈希。

let nodes = datatable(name:string, type:string, age:long) 
[ 
	"Alice", "Person", 23,  
	"Bob", "Person", 31,  
	"Eve", "Person", 17,
	"Trent", "System", 99
]; 
let edges = datatable(source:string, destination:string, edge_type:string) 
[ 
	"Alice", "Bob", "communicatesWith",  
	"Alice", "Trent", "trusts",  
	"Bob", "Trent", "hasPermission",  
	"Eve", "Alice", "attacks",  
	"Mallory", "Alice", "attacks",  
	"Mallory", "Bob", "attacks"
]; 
edges 
| make-graph source --> destination with nodes on name
| graph-to-table nodes with_node_id=NodeId

输出

NodeId 姓名 类型 年龄
-3122868243544336885 爱丽丝 人员 23
-7133945255344544237 鲍勃 人员 31
4363395278938690453 前夕 人员 十七
2533909231875758225 特 伦 特 系统 99
3855580634910899594 马洛里

以下示例使用 graph-to-table 运算符将节点和边缘从图形导出到表。

let nodes = datatable(name:string, type:string, age:long) 
[ 
	"Alice", "Person", 23,  
	"Bob", "Person", 31,  
	"Eve", "Person", 17,
	"Trent", "System", 99
]; 
let edges = datatable(source:string, destination:string, edge_type:string) 
[ 
	"Alice", "Bob", "communicatesWith",  
	"Alice", "Trent", "trusts",  
	"Bob", "Trent", "hasPermission",  
	"Eve", "Alice", "attacks",  
	"Mallory", "Alice", "attacks",  
	"Mallory", "Bob", "attacks"
]; 
edges 
| make-graph source --> destination with nodes on name
| graph-to-table nodes as N with_node_id=NodeId, edges as E with_source_id=SourceId;
N; 
E

输出表 1

NodeId 姓名 类型 年龄
-3122868243544336885 爱丽丝 人员 23
-7133945255344544237 鲍勃 人员 31
4363395278938690453 前夕 人员 十七
2533909231875758225 特 伦 特 系统 99
3855580634910899594 马洛里

输出表 2

SourceId 来源 目的地 edge_type
-3122868243544336885 爱丽丝 鲍勃 communicatesWith
-3122868243544336885 爱丽丝 特 伦 特 信托
-7133945255344544237 鲍勃 特 伦 特 hasPermission
4363395278938690453 前夕 爱丽丝 攻击
3855580634910899594 马洛里 爱丽丝 攻击
3855580634910899594 马洛里 鲍勃 攻击