

# Amazon Glue Data Catalog 的业务术语表
<a name="catalog-business-glossaries"></a>

**注意**  
业务上下文和语义搜索目前为预览 Amazon Glue 状态，可能会发生更改。

业务术语表是受控词汇术语的容器，这些术语用于定义组织内部的业务概念。将术语表条目与 Data Catalog 资产进行关联，以赋予其业务语义，并借助语义搜索增强资产的可发现性。

## 创建术语表
<a name="catalog-business-glossaries-create"></a>

使用 `CreateGlossary` 创建业务术语表

```
aws glue create-glossary \
    --name "Finance Data Definitions" \
    --description "Standardized financial terms used across reporting and analytics"
```

输出示例：

```
{
    "Id": "gl-c9vq7sh2fk4t2h",
    "Name": "Finance Data Definitions"
}
```

## 创建术语表条目
<a name="catalog-business-glossaries-create-term"></a>

使用 `CreateGlossaryTerm` 向术语表中添加条目。

```
aws glue create-glossary-term \
    --glossary-identifier {{glossary-id}} \
    --name "Active User" \
    --short-description "A user with at least one login in the last 30 days" \
    --long-description "An account that has logged in at least once within the trailing 30-day window. Used as the standard engagement metric across all product teams."
```

输出示例：

```
{
    "Id": "gt-d7xm3np5rk2w9j",
    "GlossaryId": "gl-c9vq7sh2fk4t2h",
    "Name": "Active User"
}
```

## 将术语表条目与资产相关联
<a name="catalog-business-glossaries-associate"></a>

使用 `AssociateGlossaryTerms` 将条目与 Data Catalog 资产相关联。

**注意**  
在预览期间，每个资产最多可以关联 10 个术语表条目。

```
aws glue associate-glossary-terms \
    --identifier {{asset-id}} \
    --glossary-term-identifiers '["{{term-id-1}}", "{{term-id-2}}"]'
```

输出示例：

```
{
    "Identifier": "c2fymbu18rtsx5",
    "GlossaryTerms": [
        {"Id": "gt-d7xm3np5rk2w9j", "Name": "Active User"},
        {"Id": "gt-h4kp9wt6mq3v2n", "Name": "PII"}
    ]
}
```

## 删除术语表条目关联
<a name="catalog-business-glossaries-disassociate"></a>

使用 `DisassociateGlossaryTerms` 从资产中删除条目关联。

```
aws glue disassociate-glossary-terms \
    --identifier {{asset-id}} \
    --glossary-term-identifiers '["{{term-id}}"]'
```

## 更新术语表和条目
<a name="catalog-business-glossaries-update"></a>

更新立即生效并反映在搜索结果中。

**更新术语表**  
使用 `UpdateGlossary`：

```
aws glue update-glossary \
    --identifier {{glossary-id}} \
    --name "Enterprise Finance Glossary" \
    --description "Updated standardized financial terms for enterprise reporting"
```

**更新术语表条目**  
使用 `UpdateGlossaryTerm`：

```
aws glue update-glossary-term \
    --identifier {{term-id}} \
    --name "Monthly Active User" \
    --short-description "A user with at least one login in the last 30 days"
```

## 删除术语表和条目
<a name="catalog-business-glossaries-delete"></a>

您必须先删除术语表中的所有现有条目，然后才能删除术语表。

**删除术语表条目**  
使用 `DeleteGlossaryTerm`：

```
aws glue delete-glossary-term \
    --identifier {{term-id}}
```

**删除术语表**  
删除所有术语后使用 `DeleteGlossary`：

```
aws glue delete-glossary \
    --identifier {{glossary-id}}
```

## 列出术语表和条目
<a name="catalog-business-glossaries-list"></a>

`ListGlossaries` 和 `ListGlossaryTerms` 两者都支持使用 `MaxResults` 和 `NextToken` 进行分页。

**列出所有术语表**  
运行以下命令：

```
aws glue list-glossaries \
    --max-results 10
```

输出示例：

```
{
    "Items": [
        {"Id": "gl-c9vq7sh2fk4t2h", "Name": "Finance Data Definitions"},
        {"Id": "gl-f8yn2bx7jl5r4k", "Name": "Marketing Glossary"}
    ]
}
```

**列出术语表条目**  
运行以下命令：

```
aws glue list-glossary-terms \
    --glossary-identifier {{glossary-id}} \
    --max-results 10
```

输出示例：

```
{
    "GlossaryId": "gl-c9vq7sh2fk4t2h",
    "Items": [
        {"Id": "gt-d7xm3np5rk2w9j", "Name": "Active User"},
        {"Id": "gt-j6rm4xv9np8w3t", "Name": "EBITDA"}
    ]
}
```

## 检索术语表和条目详情
<a name="catalog-business-glossaries-get"></a>

**检索术语表**  
运行以下命令：

```
aws glue get-glossary \
    --identifier {{glossary-id}}
```

**检索术语表条目**  
运行以下命令：

```
aws glue get-glossary-term \
    --identifier {{term-id}}
```