本文详细介绍了图形模型项的定义结构。
定义部件
下表列出了图形模型定义部件。
| 定义部件路径 | 类型 | 必选 | Description |
|---|---|---|---|
dataSources |
数据源 | 是 | 数据源数组 |
graphDefinition |
GraphDefinition | 是 | 数据映射图形定义 |
graphType |
GraphType | 是 | 图形结构 |
stylingConfiguration |
StylingConfiguration | 是 | 图形样式配置 |
数据源
描述数据源的结构。
| Name | 类型 | Description |
|---|---|---|
| 姓名 | String | 数据源的名称 |
| 类型 | “DeltaTable” | 数据源类型 |
| 属性 | DataSourceProperties | 数据源属性 |
DataSourceProperties
数据源类型所需的属性。 对于 DeltaTable 源,这包括表路径。
| Name | 类型 | Description |
|---|---|---|
| 路径 | String | 数据源的路径 |
GraphDefinition
描述数据映射图形定义。
| Name | 类型 | Description |
|---|---|---|
| nodeTables | NodeTable[] | 节点数据映射定义的数组 |
| edgeTables | EdgeTable[] | 边缘数据映射定义的数组 |
NodeTable
描述节点数据映射定义的结构。
| Name | 类型 | Description |
|---|---|---|
| id | String | 节点数据映射定义的 ID |
| nodeTypeAlias | String | 图中定义的节点的别名 |
| dataSourceName | String | 数据源的名称 |
| propertyMappings | PropertyMapping[] | 属性数据映射定义的数组 |
EdgeTable
描述边缘数据映射定义的结构。
| Name | 类型 | Description |
|---|---|---|
| id | String | 边缘数据映射定义的 ID |
| edgeTypeAlias | String | 图形中定义的边缘的别名 |
| dataSourceName | String | 数据源的名称 |
| sourceNodeKeyColumns | 字符串数组[] | 映射到源节点的列数组 |
| targetNodeKeyColumns | 字符串数组[] | 映射到目标节点的列数组 |
| propertyMappings | PropertyMapping[] | 属性数据映射定义的数组 |
PropertyMapping
描述属性数据映射定义的结构。
| Name | 类型 | Description |
|---|---|---|
| propertyName | String | 属性的名称 |
| sourceColumn | String | 源列的名称 |
| 筛选器 | SingleFilter / GroupFilter | 筛选器定义 |
SingleFilter
描述单个筛选器的结构。
| Name | 类型 | Description |
|---|---|---|
| 操作员 | String | 筛选器的运算符名称 |
| columnName | String | 此筛选器的列名称 |
| value | 物体 | 比较值。 支持这些值的字符串、数字、dateTime 和数组。 |
GroupFilter
描述组筛选器的结构。
| Name | 类型 | Description |
|---|---|---|
| 操作员 | String | 筛选器的运算符名称 |
| filters | SingleFilter[] / GroupFilter[] | 此组筛选器的筛选器 |
| 和 | SingleFilter[] / GroupFilter[] | 逻辑 AND 的筛选器 |
| 或 | SingleFilter[] / GroupFilter[] | 逻辑 OR 的筛选器 |
GraphType
描述图形的结构。
| Name | 类型 | Description |
|---|---|---|
| nodeTypes | NodeType[] | 节点结构的数组 |
| edgeTypes | EdgeType[] | 边缘结构的数组 |
NodeType
描述节点的结构。
| Name | 类型 | Description |
|---|---|---|
| 别名 | String | 别名 |
| labels | 字符串数组[] | 标签数组 |
| primaryKeyProperties | 字符串数组[] | 主键属性的数组 |
| 属性 | Property[] | 属性数组 |
EdgeType
描述边缘的结构。
| Name | 类型 | Description |
|---|---|---|
| 别名 | String | 别名 |
| labels | 字符串数组[] | 标签数组 |
| sourceNodeType | NodeTypeReference | 源节点结构 |
| destinationNodeType | NodeTypeReference | 目标节点结构 |
| 属性 | Property[] | 属性数组 |
资产
描述属性的结构。
| Name | 类型 | Description |
|---|---|---|
| 姓名 | String | 属性的名称 |
| 类型 | String | 属性的类型 |
NodeTypeReference
描述 NodeTypeReference 的结构。
| Name | 类型 | Description |
|---|---|---|
| 别名 | String | 所引用节点的别名 |
StylingConfiguration
描述样式配置的结构。
| Name | 类型 | Description |
|---|---|---|
| modelLayout | ModelLayout | 图形模型的样式和布局配置 |
ModelLayout
描述模型样式配置。
| Name | 类型 | Description |
|---|---|---|
| 位置 | 字典<字符串, Position> | 节点的位置 |
| 风格 | <字典字符串,ModelStyle> | 图形模型的样式 |
| 平移 | 位置 | 模型画布的平移 |
| zoomLevel | 整数 | 模型画布的缩放级别 |
Position
描述 2D 位置。
| Name | 类型 | Description |
|---|---|---|
| x | 整数 | x 坐标值 |
| y | 整数 | y 坐标值 |
ModelStyle
描述模型元素的样式。
| Name | 类型 | Description |
|---|---|---|
| size | 整数 | 模型元素的大小 |
数据源示例
{
"dataSources": [
{
"name": "Customer_Table",
"type": "DeltaTable",
"properties": {
"path": "abfss://9e4b0e5d-3952-44df-9ac8-2503775e0425@onelake.dfs.fabric.microsoft.com/f66b6219-28a5-4738-8b37-0c486c661b15/Tables/Customers"
}
},
{
"name": "Employee_Table",
"type": "DeltaTable",
"properties": {
"path": "abfss://9e4b0e5d-3952-44df-9ac8-2503775e0425@onelake.dfs.fabric.microsoft.com/f66b6219-28a5-4738-8b37-0c486c661b15/Tables/Employees"
}
},
{
"name": "Order_Table",
"type": "DeltaTable",
"properties": {
"path": "abfss://9e4b0e5d-3952-44df-9ac8-2503775e0425@onelake.dfs.fabric.microsoft.com/f66b6219-28a5-4738-8b37-0c486c661b15/Tables/PurchaseOrders"
}
},
{
"name": "Product_Table",
"type": "DeltaTable",
"properties": {
"path": "abfss://9e4b0e5d-3952-44df-9ac8-2503775e0425@onelake.dfs.fabric.microsoft.com/f66b6219-28a5-4738-8b37-0c486c661b15/Tables/Products"
}
}
]
}
图形定义示例
{
"schemaVersion": "1.0.0",
"nodeTables": [
{
"id": "Customer_5b6cb156-c778-4fce-8606-f0f712c04818",
"nodeTypeAlias": "Customer_nodeType",
"dataSourceName": "Customer_Table",
"propertyMappings": [
{
"propertyName": "CustomerId",
"sourceColumn": "Customer_Id"
},
{
"propertyName": "FirstName",
"sourceColumn": "First_name"
},
{
"propertyName": "LastName",
"sourceColumn": "Last_name"
},
{
"propertyName": "Email",
"sourceColumn": "Email"
}
],
"filter": {
"and": [
{
"operator": "Contains",
"columnName": "First_name",
"value": "USA"
},
{
"operator": "Contains",
"columnName": "Last_name",
"value": "A"
}
]
}
},
{
"id": "Employee_f0f712c04818",
"nodeTypeAlias": "Employee_nodeType",
"dataSourceName": "Employee_Table",
"propertyMappings": [
{
"propertyName": "EmployeeId",
"sourceColumn": "Employee_Id"
},
{
"propertyName": "FirstName",
"sourceColumn": "First_Name"
},
{
"propertyName": "LastName",
"sourceColumn": "Last_Name"
},
{
"propertyName": "Role",
"sourceColumn": "Role"
}
],
"filter": {
"operator": "AND",
"filters": [
{
"operator": "Contains",
"columnName": "First_name",
"value": "USA"
},
{
"operator": "Contains",
"columnName": "Last_name",
"value": "A"
}
]
}
},
{
"id": "EmployeeCustomer_5b6cb156",
"nodeTypeAlias": "EmployeeCustomer_nodeType",
"dataSourceName": "Employee_Table",
"propertyMappings": [
{
"propertyName": "EmployeeId",
"sourceColumn": "Employee_Id"
},
{
"propertyName": "FirstName",
"sourceColumn": "First_Name"
},
{
"propertyName": "LastName",
"sourceColumn": "Last_Name"
},
{
"propertyName": "Role",
"sourceColumn": "Role"
},
{
"propertyName": "Email",
"sourceColumn": "Email"
}
],
"filter": {
"operator": "Equal",
"columnName": "Role",
"value": "Manager"
}
},
{
"id": "Product_5b6cb156-c778-4fce-8606-f0f712c04818",
"nodeTypeAlias": "Product_nodeType",
"dataSourceName": "Product_Table",
"propertyMappings": [
{
"propertyName": "CategoryId",
"sourceColumn": "Category_Id"
},
{
"propertyName": "ProductId",
"sourceColumn": "Product_Id"
},
{
"propertyName": "Name",
"sourceColumn": "Name"
},
{
"propertyName": "Price",
"sourceColumn": "Price"
},
{
"propertyName": "Cost",
"sourceColumn": "Cost"
}
],
"filter": {
"operator": "AND",
"filters": [
{
"operator": "GreaterThan",
"columnName": "Price",
"value": 100
},
{
"operator": "In",
"columnName": "CategoryId",
"value": ["Electronics", "Clothing", "Books"]
}
]
}
}
],
"edgeTables": [
{
"id": "CustomerPurchase_976cceac",
"edgeTypeAlias": "CustomerPurchase_edgeType",
"dataSourceName": "Order_Table",
"sourceNodeKeyColumns": ["Customer_Id_FK"],
"destinationNodeKeyColumns": ["Category_Id_FK", "Product_Id_FK"],
"propertyMappings": [
{
"propertyName": "Quantity",
"sourceColumn": "unit_price"
},
{
"propertyName": "Date",
"sourceColumn": "Date"
}
],
"filter": {
"and": [
{
"operator": "Contains",
"columnName": "Customer_Id_FK",
"value": "USA"
},
{
"operator": "Contains",
"columnName": "Customer_Id_FK",
"value": "A"
}
]
}
},
{
"id": "EmployeePurchase_29be49f2",
"edgeTypeAlias": "EmployeePurchase_edgeType",
"dataSourceName": "Order_Table",
"sourceNodeKeyColumns": ["Employee_Id_FK"],
"destinationNodeKeyColumns": ["Category_Id_FK", "Product_Id_FK"],
"propertyMappings": [
{
"propertyName": "Quantity",
"sourceColumn": "unit_price"
},
{
"propertyName": "Date",
"sourceColumn": "Date"
}
]
},
{
"id": "EmployeeSold_2530ecef620c",
"edgeTypeAlias": "Sold_edgeType",
"dataSourceName": "Order_Table",
"sourceNodeKeyColumns": ["Employee_Id_FK"],
"destinationNodeKeyColumns": ["Category_Id_FK", "Product_Id_FK"],
"propertyMappings": [
{
"propertyName": "CustomerId",
"sourceColumn": "unit_price"
},
{
"propertyName": "Date",
"sourceColumn": "Date"
},
{
"propertyName": "hasDiscount",
"sourceColumn": "EmployeeDiscount"
}
]
}
]
}
图形类型示例
{
"schemaVersion": "1.0.0",
"nodeTypes": [
{
"alias": "Customer_nodeType",
"labels": ["Customer"],
"primaryKeyProperties": ["CustomerId"],
"properties": [
{
"name": "CustomerId",
"type": "STRING"
},
{
"name": "FirstName",
"type": "STRING"
},
{
"name": "LastName",
"type": "STRING"
},
{
"name": "Email",
"type": "STRING"
}
]
},
{
"alias": "Employee_nodeType",
"labels": ["Employee"],
"primaryKeyProperties": ["EmployeeId"],
"properties": [
{
"name": "EmployeeId",
"type": "STRING"
},
{
"name": "FirstName",
"type": "STRING"
},
{
"name": "LastName",
"type": "STRING"
},
{
"name": "Role",
"type": "STRING"
},
{
"name": "Email",
"type": "STRING"
}
]
},
{
"alias": "EmployeeCustomer_nodeType",
"labels": ["Customer", "Employee"],
"primaryKeyProperties": ["EmployeeId"],
"properties": [
{
"name": "EmployeeId",
"type": "STRING"
},
{
"name": "FirstName",
"type": "STRING"
},
{
"name": "LastName",
"type": "STRING"
},
{
"name": "Role",
"type": "STRING"
},
{
"name": "Email",
"type": "STRING"
}
]
},
{
"alias": "Product_nodeType",
"labels": ["Product"],
"primaryKeyProperties": ["CategoryId", "ProductId"],
"properties": [
{
"name": "CategoryId",
"type": "INT"
},
{
"name": "ProductId",
"type": "STRING"
},
{
"name": "Name",
"type": "STRING"
},
{
"name": "Price",
"type": "FLOAT"
},
{
"name": "Cost",
"type": "FLOAT"
}
]
}
],
"edgeTypes": [
{
"alias": "CustomerPurchase_edgeType",
"labels": ["PURCHASED"],
"sourceNodeType": {
"alias": "Customer_nodeType"
},
"destinationNodeType": {
"alias": "Product_nodeType"
},
"properties": [
{
"name": "Quantity",
"type": "INT"
},
{
"name": "Date",
"type": "DATETIME"
}
]
},
{
"alias": "EmployeePurchase_edgeType",
"labels": ["PURCHASED"],
"sourceNodeType": {
"alias": "EmployeeCustomer_nodeType"
},
"destinationNodeType": {
"alias": "Product_nodeType"
},
"properties": [
{
"name": "Quantity",
"type": "INT"
},
{
"name": "Date",
"type": "DATETIME"
}
]
},
{
"alias": "Sold_edgeType",
"labels": ["Sold"],
"sourceNodeType": {
"alias": "Employee_nodeType"
},
"destinationNodeType": {
"alias": "Product_nodeType"
},
"properties": [
{
"name": "CustomerId",
"type": "STRING"
},
{
"name": "Date",
"type": "DATETIME"
},
{
"name": "hasDiscount",
"type": "BOOLEAN"
}
]
}
]
}
设置配置示例
{
"schemaVersion": "1.0.0",
"modelLayout": {
"positions": {
"Customer_nodeType": {
"x": 1,
"y": 1
},
"Employee_nodeType": {
"x": 2,
"y": 3
},
"EmployeeCustomer_nodeType": {
"x": 3,
"y": 4
},
"Product_nodeType": {
"x": 6,
"y": 7
}
},
"styles": {
"Customer_nodeType": {
"size": 30
},
"Employee_nodeType": {
"size": 30
},
"EmployeeCustomer_nodeType": {
"size": 30
},
"Product_nodeType": {
"size": 30
},
"CustomerPurchase_edgeType": {
"size": 30
},
"EmployeePurchase_edgeType": {
"size": 30
},
"Sold_edgeType": {
"size": 30
}
},
"pan": {
"x": 0,
"y": 0
},
"zoomLevel": 1
}
}