

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Data Catalog 中的商業內容入門
<a name="catalog-business-context-getting-started"></a>

**注意**  
商業內容和語意搜尋為 預覽版 AWS Glue ，可能會有所變更。

本教學課程會逐步引導您建立詞彙表、標記資產，以及使用語意搜尋來依意義探索資料。

## 先決條件
<a name="business-context-getting-started-prereqs"></a>
+ 在支援區域中設定 AWS Glue Data Catalog AWS 的帳戶。
+  AWS CLI 已安裝和設定的 。
+ 至少有一個在 Data Catalog 中註冊的資料表。
+ 具有 AWS Glue Data Catalog 動作許可的 IAM 角色或使用者。

連接下列 IAM 政策以授予必要的許可：

```
{
    "Version": "2012-10-17",
    "Statement": [{
        "Effect": "Allow",
        "Action": [
            "glue:SearchAssets", "glue:PutAsset", "glue:GetAsset", "glue:DeleteAsset",
            "glue:PutAssetType", "glue:GetAssetType", "glue:DeleteAssetType", "glue:ListAssetTypes",
            "glue:CreateGlossary", "glue:UpdateGlossary", "glue:GetGlossary", "glue:ListGlossaries", "glue:DeleteGlossary",
            "glue:CreateGlossaryTerm", "glue:UpdateGlossaryTerm", "glue:GetGlossaryTerm", "glue:ListGlossaryTerms", "glue:DeleteGlossaryTerm",
            "glue:AssociateGlossaryTerms", "glue:DisassociateGlossaryTerms",
            "glue:PutFormType", "glue:GetFormType", "glue:DeleteFormType", "glue:ListFormTypes",
            "glue:PutAttachment", "glue:DeleteAttachment",
            "glue:ListIterableForms", "glue:BatchGetIterableForms"
        ],
        "Resource": "*"
    }]
}
```

## 步驟 1：建立詞彙表並標記資產
<a name="business-context-step1-create-glossary"></a>

**建立詞彙表**  
執行以下命令：

```
aws glue create-glossary \
  --name "Enterprise Data Glossary" \
  --description "Standardized business definitions for enterprise data assets."
```

輸出範例：

```
{
    "Id": "d7xm3np5rk2w9j",
    "Name": "Enterprise Data Glossary"
}
```

**建立詞彙表字詞**  
將詞彙表識別符取代為上述輸出`Id`中的 。

```
aws glue create-glossary-term \
  --glossary-identifier "d7xm3np5rk2w9j" \
  --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."
```

輸出範例：

```
{
    "Id": "c2fymbu18rtsx5",
    "GlossaryId": "d7xm3np5rk2w9j",
    "Name": "Active User"
}
```

**將術語與資產建立關聯**  
執行以下命令：

```
aws glue associate-glossary-terms \
  --identifier "arn:aws:glue:us-east-1:123456789012:table/mydb/sales_transactions" \
  --glossary-term-identifiers "c2fymbu18rtsx5"
```

## 步驟 2：使用業務內容搜尋資料
<a name="business-context-step2-search"></a>

使用 `SearchAssets` API 依業務意義尋找資產。

```
aws glue search-assets \
  --search-text "active users"
```

輸出範例：

```
{
    "Items": [
        {"Id": "c9vq7sh2fk4t2h", "AssetName": "Customer Sales Transactions", "AssetTypeId": "Table"}
    ]
}
```

若要依資產類型篩選結果：

```
aws glue search-assets \
  --search-text "active users" \
  --filter-clause '{"AttributeFilter":{"Attribute":"type","Operator":"equals","Value":{"StringValue":"Table"}}}' \
  --max-results 10
```

僅篩選至 AWS Glue 資料表 （不包括來自其他來源系統的資料表）：

```
aws glue search-assets \
  --search-text "active users" \
  --filter-clause '{"AndAllFilters":[{"AttributeFilter":{"Attribute":"type","Operator":"equals","Value":{"StringValue":"Table"}}},{"AttributeFilter":{"Attribute":"namespace","Operator":"equals","Value":{"StringValue":"amazon.glue"}}}]}' \
  --max-results 10
```

## 搭配 目錄使用 AI 代理器
<a name="business-context-getting-started-agent-toolkit"></a>

與 MCP 相容的 AI 代理器可以探索目錄資產、擷取業務內容，以及使用 AWS Agent Toolkit 中的技能載入技能內容。您可以透過下列方式取得目錄技能：
+ **與外掛程式綁定** – 安裝`aws-data-analytics`外掛程式，其中包含一組經過策劃的目錄技能，可在安裝後立即提供給代理程式。如需說明，請參閱《 AWS Agent Toolkit 使用者指南》中的[安裝外掛程式](https://docs.aws.amazon.com/agent-toolkit/latest/userguide/plugins.html#installing-plugins)。
+ **在本機安裝** – 從 GitHub 上的 Agent Toolkit for AWS 儲存庫下載個別技能，並將其新增至客服人員的技能目錄。下列技能支援目錄工作流程：
  + [exploring-data-catalog](https://github.com/aws/agent-toolkit-for-aws/tree/main/skills/specialized-skills/analytics-skills/exploring-data-catalog)
  + [finding-data-lake-assets](https://github.com/aws/agent-toolkit-for-aws/tree/main/skills/specialized-skills/analytics-skills/finding-data-lake-assets)

## 後續步驟
<a name="business-context-getting-started-next-steps"></a>
+ 連接表單以標準化中繼資料欄位，例如資料駐留或保留政策。
+ 建立技能資產，為 AI 代理器提供資料的網域內容。