管理业务术语库

本文档介绍了如何在 Knowledge Catalog(以前称为 Dataplex Universal Catalog)中创建和管理业务术语库。创建这些资源时,请确保其 ID 符合 Knowledge Catalog 资源命名准则。使用业务术语库为数据资产建立标准化的词汇,从而减少歧义,并提高整个组织的数据发现和治理能力。

Knowledge Catalog 业务术语库应用场景

通过使用 Knowledge Catalog 业务术语库为数据创建通用语言,您可以实现以下目标:

  • 定义清晰的业务类别和术语层次结构。
  • 使用同义词关联概念,并显示术语之间的关系。
  • 根据业务概念(而非仅根据技术名称)搜索数据资源。

Knowledge Catalog 业务术语库有助于简化数据发现流程并减少歧义,从而实现更好的治理、更准确的分析并更快地获取分析洞见。

业务术语库的要素

本部分介绍了可用于构建业务术语库的关键要素。

术语库

术语库具有以下属性:

  • 概览。描述业务术语库的用途和内容。 您可以添加图片、链接和表格。虽然不支持 HTML 格式,但您可以添加格式为代码的 HTML 代码,也可以添加指向 HTML 页面的链接。您还可以使用富文本格式设置选项,例如粗体、斜体、下划线、项目符号列表、段落、标题和代码块。 支持的大小上限为 120 KB。

  • 说明。描述术语库。此字段中的文本会编入索引以进行搜索。支持的大小上限为 1 KB。

  • Region 绑定将多选选项设置为所有记录中 Region 的所有值。指定术语库所在区域

类别

类别可用于整理和编排各种类别和术语。类别是在业务术语库中定义的。您最多可以嵌套三个级层的类别。

类别具有术语库的属性以及以下属性:

  • 联系人。指定负责维护类别的人员。此属性是描述性属性,不会影响类别的权限。
  • 父级。指定用于建立当前类别的父级的关系。您最多可以嵌套三个类别。

类别的区域与包含该类别的术语库的区域相同。

术语

术语 (term)(“glossary term”的简称)是指公司内特定业务分支中使用的概念。例如,某公司的营销部门可能会创建一个描述每次点击费用的术语。 术语是在业务术语库中定义的,要么直接在术语库中定义,要么在术语库中的任何类别中定义。

术语具有类别的属性以及以下属性:

  • 同义词。指定具有相同含义的字词之间的关联。请参阅同义词
  • 相关字词。指定在概念上彼此相关但含义不同的字词之间的链接。请参阅相关字词
  • 相关条目。指定术语与数据资产之间或术语与数据资产中的列之间的关联。
  • 数据质量规则。指定术语的数据质量要求。 如需了解详情,请参阅重用数据质量规则
  • 联系人。指定负责维护术语的人员。术语不会沿用类别中定义的联系人。

术语的区域与包含该术语的术语库的区域相同。

同义词

同义词是一种关系,用于指示两个不同术语之间的等效性。当两个含义相同的术语由不同团队在不同的术语库中定义时,请使用同义词。例如,您可以创建一个同义词来链接“利润”和“盈利”这两个术语。

相关字词是一种关系,用于指示两个字词彼此关联,但含义不同。例如,您可以创建一个相关字词,将“收入”和“利润”这两个字词关联起来。

限制

所需的角色

如需获得创建和管理术语库所需的权限,请让您的管理员为您授予项目的以下 IAM 角色:

  • 对于数据管理员,获取对术语库、类别、术语、同义词和相关字词的完整访问权限,并设置 IAM 政策:Dataplex Catalog Admin (roles/dataplex.catalogAdmin)
  • 对于数据管理员或数据所有者,获取创建、修改或删除术语库、类别、术语、术语之间的关联、术语与数据资产之间的关联以及搜索的权限:Dataplex Catalog Editor (roles/dataplex.catalogEditor)
  • 对于数据分析师或数据使用者,获取对术语库、类别、术语、术语之间的关联、术语与数据资产之间的关联以及搜索的只读权限:Dataplex Catalog Viewer (roles/dataplex.catalogViewer)

如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

这些预定义角色可提供创建和管理术语库所需的权限。如需查看所需的确切权限,请展开所需权限部分:

所需权限

创建和管理术语库需要以下权限:

  • 在项目中创建、读取、更新和删除业务术语库、类别和术语:
    • dataplex.glossaries.list
    • dataplex.glossaries.create
    • dataplex.glossaries.get
    • dataplex.glossaries.update
    • dataplex.glossaries.delete
    • dataplex.glossaryCategories.create
    • dataplex.glossaryCategories.list
    • dataplex.glossaryCategories.get
    • dataplex.glossaryCategories.update
    • dataplex.glossaryCategories.delete
    • dataplex.glossaryTerms.create
    • dataplex.glossaryTerms.list
    • dataplex.glossaryTerms.get
    • dataplex.glossaryTerms.update
    • dataplex.glossaryTerms.delete
  • 在项目中创建、查找和删除同义词与同义词关联:
    • 针对任一术语库术语所在项目中的 Knowledge Catalog 条目组的 dataplex.entryLinks.create 。关联是在授予权限的条目组中创建的。
    • 针对任一术语库术语所在项目中的 Knowledge Catalog 条目组的 dataplex.entryGroups.useSynonymEntryLink。关联是在授予权限的条目组中创建的。
    • 针对不需要关联其术语的术语库的 dataplex.glossaryTerms.use 权限。
    • 针对您要查找其同义词链接的术语调用 dataplex.glossaryTerms.get。如果您没有相应术语的 dataplex.glossaryTerms.get 权限,Knowledge Catalog 会在响应中隐去同义词。
    • 针对关联所在项目中的 Knowledge Catalog 条目组的 dataplex.entryLinks.delete。
  • 在项目中创建、查找和删除相关词与相关词关联:
    • 针对任一术语库术语所在项目中的 Knowledge Catalog 条目组的 dataplex.entryLinks.create 。关联是在授予权限的条目组中创建的。
    • 针对任一术语库术语所在项目中的 Knowledge Catalog 条目组的 dataplex.entryGroups.useRelatedEntryLink 。关联是在授予权限的条目组中创建的。
    • 针对对应于术语库术语的条目所在项目中的 Knowledge Catalog 条目组的 dataplex.entries.link。
    • dataplex.glossaryTerms.get 针对您要查找相关链接的术语。如果您没有相关术语的 dataplex.glossaryTerms.get 权限,Knowledge Catalog 会在回答中编辑掉相关术语。
    • 针对关联所在项目中的 Knowledge Catalog 条目组的 dataplex.entryLinks.delete。
  • 在项目中的术语与数据资产或列之间创建、查找和删除关联:
    • 针对与项目中的数据资产或列对应的系统条目组的 dataplex.entryLinks.create关联是在授予权限的项目中创建的。
    • 针对与项目中的数据资产或列对应的系统条目组的 dataplex.entryGroups.useDefinitionEntryLink关联是在授予权限的项目中创建的。
    • 针对与项目中的数据资产或列对应的系统条目组的 dataplex.entries.link关联是在授予权限的项目中创建的。
    • 针对不需要关联其术语的术语库的 dataplex.glossaryTerms.use 。
    • 您要查找链接的条目的源系统读取权限(例如 bigquery.tables.getdataplex.glossaryTerms.get)。如果您没有相应数据资产的源系统读取权限,Knowledge Catalog 会在响应中编辑这些数据资产。
    • 针对关联所在的系统条目组的 dataplex.entryLinks.delete。

您也可以使用自定义角色或其他预定义角色来获取这些权限。

如需了解详情,请参阅 Knowledge Catalog IAM 角色

创建和管理业务术语库

以下部分介绍了如何创建、查看、修改和删除业务术语库。

创建业务术语库

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 点击创建业务术语库

  3. 创建业务术语库页面上,指定业务术语库的名称和位置。创建术语库后,您无法更改其位置。

  4. 点击创建。系统在当前项目下创建了术语库。

  5. 可选:在说明中添加简短说明(最多 1,024 个字符),或在概览中添加详细说明(最多 120 KB)。

C#

C#

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 C# 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog C# API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dataplex.V1;
using Google.LongRunning;

public sealed partial class GeneratedBusinessGlossaryServiceClientSnippets
{
    /// <summary>Snippet for CreateGlossary</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void CreateGlossaryRequestObject()
    {
        // Create client
        BusinessGlossaryServiceClient businessGlossaryServiceClient = BusinessGlossaryServiceClient.Create();
        // Initialize request argument(s)
        CreateGlossaryRequest request = new CreateGlossaryRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            GlossaryId = "",
            Glossary = new Glossary(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<Glossary, OperationMetadata> response = businessGlossaryServiceClient.CreateGlossary(request);

        // Poll until the returned long-running operation is complete
        Operation<Glossary, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        Glossary result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<Glossary, OperationMetadata> retrievedResponse = businessGlossaryServiceClient.PollOnceCreateGlossary(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            Glossary retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Go 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Go API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewBusinessGlossaryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.CreateGlossaryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateGlossaryRequest.
	}
	op, err := c.CreateGlossary(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Java 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Java API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

import com.google.cloud.dataplex.v1.BusinessGlossaryServiceClient;
import com.google.cloud.dataplex.v1.CreateGlossaryRequest;
import com.google.cloud.dataplex.v1.Glossary;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncCreateGlossary {

  public static void main(String[] args) throws Exception {
    syncCreateGlossary();
  }

  public static void syncCreateGlossary() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (BusinessGlossaryServiceClient businessGlossaryServiceClient =
        BusinessGlossaryServiceClient.create()) {
      CreateGlossaryRequest request =
          CreateGlossaryRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setGlossaryId("glossaryId1849967577")
              .setGlossary(Glossary.newBuilder().build())
              .setValidateOnly(true)
              .build();
      Glossary response = businessGlossaryServiceClient.createGlossaryAsync(request).get();
    }
  }
}

Node.js

Node.js

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Node.js API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The parent resource where this Glossary will be created.
 *  Format: projects/{project_id_or_number}/locations/{location_id}
 *  where `location_id` refers to a Google Cloud region.
 */
// const parent = 'abc123'
/**
 *  Required. Glossary ID: Glossary identifier.
 */
// const glossaryId = 'abc123'
/**
 *  Required. The Glossary to create.
 */
// const glossary = {}
/**
 *  Optional. Validates the request without actually creating the Glossary.
 *  Default: false.
 */
// const validateOnly = true

// Imports the Dataplex library
const {BusinessGlossaryServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new BusinessGlossaryServiceClient();

async function callCreateGlossary() {
  // Construct request
  const request = {
    parent,
    glossaryId,
    glossary,
  };

  // Run request
  const [operation] = await dataplexClient.createGlossary(request);
  const [response] = await operation.promise();
  console.log(response);
}

callCreateGlossary();

Python

Python

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Python 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Python API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_create_glossary():
    # Create a client
    client = dataplex_v1.BusinessGlossaryServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.CreateGlossaryRequest(
        parent="parent_value",
        glossary_id="glossary_id_value",
    )

    # Make the request
    operation = client.create_glossary(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Ruby API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

require "google/cloud/dataplex/v1"

##
# Snippet for the create_glossary call in the BusinessGlossaryService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::BusinessGlossaryService::Client#create_glossary.
#
def create_glossary
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::BusinessGlossaryService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::CreateGlossaryRequest.new

  # Call the create_glossary method.
  result = client.create_glossary request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

创建术语表时,Knowledge Catalog 会创建一个条目来表示该术语表。

  1. 创建术语库。

    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
    gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries?glossary_id=GLOSSARY_ID --data @- << EOF
    {
    "displayName": "DISPLAY_NAME",
    "description": "DESCRIPTION"
    }
    EOF

    替换以下内容:

    • PROJECT_ID:您要在其中创建术语库的项目的 ID
    • LOCATION_ID:您要在其中创建术语库的位置的 ID
    • GLOSSARY_ID:术语库的 ID
    • DISPLAY_NAME:术语库的显示名称
    • DESCRIPTION:术语库的说明,最多 1024 个字符
  2. 可选:为术语库添加概览。

    1. 查找术语库的条目:

      gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID
      :lookupEntry\
      ?entry=projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID
      \
      \&view=ALL

      PROJECT_NUMBER 替换为在其中创建术语库的项目的编号。

    2. 为术语库添加概览:

      gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID\
      ?update_mask=aspects\
      \&deleteMissingAspects=false\
      \&aspect_keys=projects/dataplex-types/locations/global/aspectTypes/overview \
      --data @- << EOF
      {
      "aspects": {
         "dataplex-types.global.overview": {
            "aspect_type": "projects/dataplex-types/locations/global/aspectTypes/overview",
            "data": {
            "content": "OVERVIEW",
            "links": []
            },
         }
      }
      }
      EOF

      OVERVIEW 替换为用于描述术语库类别或术语的纯文本或 HTML。

查看可用的术语库

控制台

  • 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

    我的术语库窗格会显示您有权查看的所有组织术语库,以及它们的说明和上次修改时间戳。

C#

C#

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 C# 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog C# API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

using Google.Api.Gax;
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dataplex.V1;
using System;

public sealed partial class GeneratedBusinessGlossaryServiceClientSnippets
{
    /// <summary>Snippet for ListGlossaries</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void ListGlossariesRequestObject()
    {
        // Create client
        BusinessGlossaryServiceClient businessGlossaryServiceClient = BusinessGlossaryServiceClient.Create();
        // Initialize request argument(s)
        ListGlossariesRequest request = new ListGlossariesRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            Filter = "",
            OrderBy = "",
        };
        // Make the request
        PagedEnumerable<ListGlossariesResponse, Glossary> response = businessGlossaryServiceClient.ListGlossaries(request);

        // Iterate over all response items, lazily performing RPCs as required
        foreach (Glossary item in response)
        {
            // Do something with each item
            Console.WriteLine(item);
        }

        // Or iterate over pages (of server-defined size), performing one RPC per page
        foreach (ListGlossariesResponse page in response.AsRawResponses())
        {
            // Do something with each page of items
            Console.WriteLine("A page of results:");
            foreach (Glossary item in page)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
        }

        // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
        int pageSize = 10;
        Page<Glossary> singlePage = response.ReadPage(pageSize);
        // Do something with the page of items
        Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
        foreach (Glossary item in singlePage)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
        // Store the pageToken, for when the next page is required.
        string nextPageToken = singlePage.NextPageToken;
    }
}

Go

Go

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Go 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Go API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewBusinessGlossaryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.ListGlossariesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#ListGlossariesRequest.
	}
	it := c.ListGlossaries(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*dataplexpb.ListGlossariesResponse)
	}
}

Java

Java

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Java 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Java API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

import com.google.cloud.dataplex.v1.BusinessGlossaryServiceClient;
import com.google.cloud.dataplex.v1.Glossary;
import com.google.cloud.dataplex.v1.ListGlossariesRequest;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncListGlossaries {

  public static void main(String[] args) throws Exception {
    syncListGlossaries();
  }

  public static void syncListGlossaries() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (BusinessGlossaryServiceClient businessGlossaryServiceClient =
        BusinessGlossaryServiceClient.create()) {
      ListGlossariesRequest request =
          ListGlossariesRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setFilter("filter-1274492040")
              .setOrderBy("orderBy-1207110587")
              .build();
      for (Glossary element : businessGlossaryServiceClient.listGlossaries(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}

Node.js

Node.js

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Node.js API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The parent, which has this collection of Glossaries.
 *  Format: projects/{project_id_or_number}/locations/{location_id}
 *  where `location_id` refers to a Google Cloud region.
 */
// const parent = 'abc123'
/**
 *  Optional. The maximum number of Glossaries to return. The service may
 *  return fewer than this value. If unspecified, at most 50 Glossaries will be
 *  returned. The maximum value is 1000; values above 1000 will be coerced to
 *  1000.
 */
// const pageSize = 1234
/**
 *  Optional. A page token, received from a previous `ListGlossaries` call.
 *  Provide this to retrieve the subsequent page.
 *  When paginating, all other parameters provided to `ListGlossaries` must
 *  match the call that provided the page token.
 */
// const pageToken = 'abc123'
/**
 *  Optional. Filter expression that filters Glossaries listed in the response.
 *  Filters on proto fields of Glossary are supported.
 *  Examples of using a filter are:
 *    - `display_name="my-glossary"`
 *    - `categoryCount=1`
 *    - `termCount=0`
 */
// const filter = 'abc123'
/**
 *  Optional. Order by expression that orders Glossaries listed in the
 *  response. Order by fields are: `name` or `create_time` for the result. If
 *  not specified, the ordering is undefined.
 */
// const orderBy = 'abc123'

// Imports the Dataplex library
const {BusinessGlossaryServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new BusinessGlossaryServiceClient();

async function callListGlossaries() {
  // Construct request
  const request = {
    parent,
  };

  // Run request
  const iterable = dataplexClient.listGlossariesAsync(request);
  for await (const response of iterable) {
      console.log(response);
  }
}

callListGlossaries();

Python

Python

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Python 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Python API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_list_glossaries():
    # Create a client
    client = dataplex_v1.BusinessGlossaryServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.ListGlossariesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_glossaries(request=request)

    # Handle the response
    for response in page_result:
        print(response)

Ruby

Ruby

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Ruby API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

require "google/cloud/dataplex/v1"

##
# Snippet for the list_glossaries call in the BusinessGlossaryService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::BusinessGlossaryService::Client#list_glossaries.
#
def list_glossaries
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::BusinessGlossaryService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::ListGlossariesRequest.new

  # Call the list_glossaries method.
  result = client.list_glossaries request

  # The returned object is of type Gapic::PagedEnumerable. You can iterate
  # over elements, and API calls will be issued to fetch pages as needed.
  result.each do |item|
    # Each element is of type ::Google::Cloud::Dataplex::V1::Glossary.
    p item
  end
end

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries

修改术语库

您可以修改术语库的名称和说明。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 点击要修改的术语库。

  3. 点击名称、说明或概览旁边的修改,然后进行更改。

  4. 点击保存

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID?update_mask=displayName,description --data @- << EOF
{
"displayName": "DISPLAY_NAME",
"description": "DESCRIPTION"
}
EOF

删除术语表

您需要先删除术语库中的所有类别术语,然后才能删除术语库。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 点击您要删除的术语库。

  3. 点击删除,然后在系统提示时进行确认。

C#

C#

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 C# 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog C# API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

using Google.Cloud.Dataplex.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;

public sealed partial class GeneratedBusinessGlossaryServiceClientSnippets
{
    /// <summary>Snippet for DeleteGlossary</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void DeleteGlossaryRequestObject()
    {
        // Create client
        BusinessGlossaryServiceClient businessGlossaryServiceClient = BusinessGlossaryServiceClient.Create();
        // Initialize request argument(s)
        DeleteGlossaryRequest request = new DeleteGlossaryRequest
        {
            GlossaryName = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]"),
            Etag = "",
        };
        // Make the request
        Operation<Empty, OperationMetadata> response = businessGlossaryServiceClient.DeleteGlossary(request);

        // Poll until the returned long-running operation is complete
        Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        Empty result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<Empty, OperationMetadata> retrievedResponse = businessGlossaryServiceClient.PollOnceDeleteGlossary(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            Empty retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Go 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Go API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewBusinessGlossaryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.DeleteGlossaryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#DeleteGlossaryRequest.
	}
	op, err := c.DeleteGlossary(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	err = op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
}

Java

Java

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Java 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Java API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

import com.google.cloud.dataplex.v1.BusinessGlossaryServiceClient;
import com.google.cloud.dataplex.v1.DeleteGlossaryRequest;
import com.google.cloud.dataplex.v1.GlossaryName;
import com.google.protobuf.Empty;

public class SyncDeleteGlossary {

  public static void main(String[] args) throws Exception {
    syncDeleteGlossary();
  }

  public static void syncDeleteGlossary() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (BusinessGlossaryServiceClient businessGlossaryServiceClient =
        BusinessGlossaryServiceClient.create()) {
      DeleteGlossaryRequest request =
          DeleteGlossaryRequest.newBuilder()
              .setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
              .setEtag("etag3123477")
              .build();
      businessGlossaryServiceClient.deleteGlossaryAsync(request).get();
    }
  }
}

Node.js

Node.js

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Node.js API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The name of the Glossary to delete.
 *  Format:
 *  projects/{project_id_or_number}/locations/{location_id}/glossaries/{glossary_id}
 */
// const name = 'abc123'
/**
 *  Optional. The etag of the Glossary.
 *  If this is provided, it must match the server's etag.
 *  If the etag is provided and does not match the server-computed etag,
 *  the request must fail with a ABORTED error code.
 */
// const etag = 'abc123'

// Imports the Dataplex library
const {BusinessGlossaryServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new BusinessGlossaryServiceClient();

async function callDeleteGlossary() {
  // Construct request
  const request = {
    name,
  };

  // Run request
  const [operation] = await dataplexClient.deleteGlossary(request);
  const [response] = await operation.promise();
  console.log(response);
}

callDeleteGlossary();

Python

Python

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Python 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Python API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_delete_glossary():
    # Create a client
    client = dataplex_v1.BusinessGlossaryServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.DeleteGlossaryRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_glossary(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

试用此示例之前,请按照《Knowledge Catalog 快速入门:使用客户端库》中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Knowledge Catalog Ruby API 参考文档

如需向 Knowledge Catalog 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证

require "google/cloud/dataplex/v1"

##
# Snippet for the delete_glossary call in the BusinessGlossaryService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::BusinessGlossaryService::Client#delete_glossary.
#
def delete_glossary
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::BusinessGlossaryService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::DeleteGlossaryRequest.new

  # Call the delete_glossary method.
  result = client.delete_glossary request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X DELETE https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID

创建和管理类别

以下部分介绍了如何创建、查看、更新和删除类别。

在术语库下创建类别

一个业务术语库最多可以包含 200 个类别。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 选择要在其中创建类别的术语库,然后点击创建类别

  3. 输入类别的名称。

  4. 点击创建

  5. 可选:在说明中添加简短说明(最多 1,024 个字符),或在概览中添加详细说明(最多 120 KB)。

REST

创建类别时,Knowledge Catalog 会创建一个条目来表示该类别。

  1. 创建类别。

    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
    gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories?category_id=CATEGORY_ID --data @- << EOF
    {
    "displayName": "CATEGORY_DISPLAY_NAME",
    "description": "CATEGORY_DESCRIPTION",
    "parent": "projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID"
    }
    EOF

    替换以下内容:

    • CATEGORY_ID:类别 ID
    • CATEGORY_DISPLAY_NAME:类别显示名称
    • CATEGORY_DESCRIPTION:类别说明
  2. 可选:为类别添加概览。

    1. 查找类别的条目:

      gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID
      :lookupEntry\
      ?entry=projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID
      \
      \&view=ALL
    2. 为类别添加概览:

      gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID\
      ?update_mask=aspects\
      \&deleteMissingAspects=false\
      \&aspect_keys=projects/dataplex-types/locations/global/aspectTypes/overview
      \
      --data @- << EOF
      {
      "aspects": {
      "dataplex-types.global.overview": {
         "aspect_type":"projects/dataplex-types/locations/global/aspectTypes/overview
      ",
         "data": {
         "content": "OVERVIEW",
         "links": []
         },
      }
      }
      }
      EOF

      OVERVIEW 替换为用于描述术语库类别或术语的纯文本或 HTML。

  3. 可选:添加联系人

    1. 查找类别的条目:

      gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID
      :lookupEntry\
      ?entry=projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID
      \
      \&view=ALL
    2. 更新包含联系人的类别的条目:

      gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID\
      ?update_mask=aspects\
      \&deleteMissingAspects=false\
      \&aspect_keys=projects/dataplex-types/locations/global/aspectTypes/contacts \
      --data @- << EOF
      {
      "aspects": {
      "dataplex-types.global.contacts": {
         "aspect_type": "projects/dataplex-types/locations/global/aspectTypes/contacts",
         "data": {
         "identities": [
            {
               "role": "steward",
               "name": "CONTACT_NAME",
               "id": "CONTACT_EMAIL"
            }
         ]
         },
      }
      }
      }
      EOF

创建嵌套类别

一个业务术语库最多可以包含三个嵌套的类别级别(不包括根术语库级别)。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开要在其中创建类别的术语库。

  3. 选择您要在其中创建其他类别的父级类别,然后点击创建类别

  4. 输入类别的名称。

  5. 点击创建

  6. 可选:在说明中添加简短说明(最多 1,024 个字符),或在概览中添加详细说明(最多 120 KB)。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories?category_id=CATEGORY_ID --data @- << EOF
{
  "displayName": "CATEGORY_DISPLAY_NAME",
  "description": "CATEGORY_DESCRIPTION",
  "parent": "projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/PARENT_CATEGORY_ID"
}
EOF

PARENT_CATEGORY_ID 替换为父级类别的 ID。

查看属于术语库的类别

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 如需查看术语库中的类别,请展开该术语库。

  3. 如需查看某个类别中的嵌套类别,请展开该类别。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories

修改类别

您可以修改类别的名称、说明和联系信息。对于嵌套类别,您还可以修改父级类别。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开相应术语库,然后点击要修改的类别。

  3. 点击名称、说明或概览旁边的 修改,然后进行更改。

  4. 点击保存

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID?update_mask=displayName,description --data @- << EOF
{
"displayName": "CATEGORY_DISPLAY_NAME",
"description": "DESCRIPTION"
}
EOF

删除类别

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开相应术语库,然后点击要删除的类别。

  3. 点击删除,然后在系统提示时进行确认。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X DELETE https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID

创建和管理术语

以下部分介绍了如何创建、查看、访问、修改和删除术语。

在业务术语库下创建术语

一个业务术语库最多可以包含 5,000 个术语。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 如需在术语库级层创建术语,请选择要在其中创建术语的术语库,然后点击创建术语

  3. 输入学期的名称。

  4. 点击创建

  5. 可选:在说明中添加简短说明(最多 1,024 个字符),或在概览中添加详细说明(最多 120 KB)。

  6. 可选:如需添加联系人,请点击修改,然后提供数据管理员、数据所有者或数据域名所有者的邮箱列表。然后点击保存

REST

创建术语时,Knowledge Catalog 会创建一个条目来表示该术语。

  1. 创建术语。

    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
    gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms?term_id=TERM_ID --data @- << EOF
    {
    "displayName": "TERM_DISPLAY_NAME",
    "description": "TERM_DESCRIPTION",
    "parent": "projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID"
    }
    EOF

    替换以下内容:

    • TERM_ID:您要创建的术语的 ID
    • TERM_DISPLAY_NAME:您要创建的术语的显示名称
    • TERM_DESCRIPTION:您要创建的术语的说明
  2. 可选:为术语添加概览。

    1. 查找术语的条目:

      gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID
      :lookupEntry\
      ?entry=projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID
      \
      \&view=ALL
    2. 为术语添加概览:

      gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID
      \
      ?update_mask=aspects\
      \&deleteMissingAspects=false\
      \&aspect_keys=projects/dataplex-types/locations/global/aspectTypes/overview
      \
      --data @- << EOF
      {
      "aspects": {
      "dataplex-types.global.overview": {
         "aspect_type":"projects/dataplex-types/locations/global/aspectTypes/overview
      ",
         "data": {
         "content": "OVERVIEW",
         "links": []
         },
      }
      }
      }
      EOF

      OVERVIEW 替换为用于描述术语库类别或术语的纯文本或 HTML。

  3. 可选:添加联系人。

    1. 查找术语的条目:

      gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID
      :lookupEntry\
      ?entry=projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID
      \
      \&view=ALL
    2. 更新包含联系人的术语的条目:

      gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID
      ?update_mask=aspects\
      \&deleteMissingAspects=false\
      \&aspect_keys=projects/dataplex-types/locations/global/aspectTypes/contacts \
      --data @- << EOF
      {
      "aspects": {
      "dataplex-types.global.contacts": {
         "aspect_type": "projects/dataplex-types/locations/global/aspectTypes/contacts",
         "data": {
         "identities": [
            {
               "role": "steward",
               "name": "CONTACT_NAME",
               "id": "CONTACT_EMAIL"
            }
         ]
         },
      }
      }
      }
      EOF

在类别下创建术语

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 如需在类别中创建术语,请选择要在其中创建术语的类别,然后点击添加术语

  3. 输入学期的名称。

  4. 点击创建

  5. 可选:在说明中添加简短说明(最多 1,024 个字符),或在概览中添加详细说明(最多 120 KB)。

  6. 可选:如需添加联系人,请点击修改,然后提供数据管理员、数据所有者或数据域名所有者的邮箱列表。然后点击保存

REST

创建术语时,Knowledge Catalog 会创建一个条目来表示该术语。

  1. 创建术语。

    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
    gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms?term_id=TERM_ID --data @- << EOF
    {
    "displayName": "TERM_DISPLAY_NAME",
    "description": "TERM_DESCRIPTION",
    "parent": "projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/PARENT_CATEGORY_ID"
    }
    EOF

    替换以下内容:

    • TERM_ID:您要创建的术语的 ID
    • TERM_DISPLAY_NAME:您要创建的术语的显示名称
    • TERM_DESCRIPTION:您要创建的术语的说明
  2. 可选:为术语添加概览。

    1. 查找术语的条目:

      gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID
      :lookupEntry\
      ?entry=projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID
      \
      \&view=ALL
    2. 为术语添加概览:

      gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID
      \
      ?update_mask=aspects\
      \&deleteMissingAspects=false\
      \&aspect_keys=projects/dataplex-types/locations/global/aspectTypes/overview
      \
      --data @- << EOF
      {
      "aspects": {
      "dataplex-types.global.overview": {
         "aspect_type":"projects/dataplex-types/locations/global/aspectTypes/overview
      ",
         "data": {
         "content": "OVERVIEW",
         "links": []
         },
      }
      }
      }
      EOF

      OVERVIEW 替换为用于描述术语库类别或术语的纯文本或 HTML。

  3. 可选:添加联系人。

    1. 查找术语的条目:

      gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID
      :lookupEntry\
      ?entry=projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID
      \
      \&view=ALL
    2. 更新包含联系人的术语的条目:

      gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID
      ?update_mask=aspects\
      \&deleteMissingAspects=false\
      \&aspect_keys=projects/dataplex-types/locations/global/aspectTypes/contacts \
      --data @- << EOF
      {
      "aspects": {
      "dataplex-types.global.contacts": {
         "aspect_type": "projects/dataplex-types/locations/global/aspectTypes/contacts",
         "data": {
         "identities": [
            {
               "role": "steward",
               "name": "CONTACT_NAME",
               "id": "CONTACT_EMAIL"
            }
         ]
         },
      }
      }
      }
      EOF

向术语添加切面

您可以向术语添加方面,以提供额外的背景信息或元数据。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开相应术语库,然后点击要添加方面的术语。

  3. 切面部分,点击添加

  4. 搜索相应方面,提供该方面的详细信息,然后点击保存

REST

术语表术语是条目。如需附加切面,请修补条目资源。 术语表的条目组为 @dataplex

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID?update_mask=aspects\&aspect_keys=ASPECT_PROJECT_ID.ASPECT_LOCATION_ID.ASPECT_TYPE_ID --data @- << EOF
{
 "aspects": {
   "ASPECT_PROJECT_ID.ASPECT_LOCATION_ID.ASPECT_TYPE_ID": {
     "aspect_type": "projects/ASPECT_PROJECT_ID/locations/ASPECT_LOCATION_ID/aspectTypes/ASPECT_TYPE_ID",
     "data": {
       "sensitivity": "HIGH",
       "data_owner": "achalg@google.com"
     }
   }
 }
}
EOF

替换以下内容:

  • PROJECT_NUMBER:包含术语库术语的项目的编号。
  • LOCATION_ID:术语表条目的位置。
  • GLOSSARY_ID:包含相应术语的术语库的 ID。
  • TERM_ID:要附加切面的术语的 ID。
  • ASPECT_PROJECT_ID:包含方面类型的项目的 ID。
  • ASPECT_LOCATION_ID:切面类型的位置。
  • ASPECT_TYPE_ID:方面类型的 ID。

查看术语库或类别中的术语

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 如需查看术语库中的术语,请展开该术语库。如需查看该术语库中某个类别下的术语,请展开该类别。如需查看嵌套类别下的术语,请展开该嵌套类别。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms

查看术语的详细信息

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 如需查看术语库中的术语列表,请展开该术语库。

  3. 点击某个术语。 术语详情页面会显示术语名称、说明、相关字词、同义词和相关条目。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID

修改条款

您可以修改术语的名称、说明、概览、联系人和父级。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开相应术语库,然后点击要修改的术语。

  3. 点击修改

  4. 修改任意字段,然后点击保存

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X PATCH https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID?update_mask=displayName,description --data @- << EOF
{
  "displayName": "TERM_DISPLAY_NAME",
  "description": "TERM_DESCRIPTION"
}
EOF

删除术语

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开相应术语库,然后点击要删除的术语。

  3. 点击删除,然后在系统提示时进行确认。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X DELETE https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM_ID

您可以通过关联术语作为同义词或相关字词,在术语之间添加关系。

术语关系是双向的。例如,当您将 profit 关联为 earnings 的同义词时,earnings 也会成为 profit 的同义词。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开相应术语库,然后点击要与之创建关联的术语。

  3. 点击同义词旁边的 修改

  4. 搜索并选择要关联的术语。

    选择该术语后,系统会立即将其关联。

  5. 点击关闭

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/TERM1_PROJECT_ID/locations/TERM1_LOCATION_ID/entryGroups/@dataplex/entryLinks?entry_link_id=ENTRY_LINK_ID -d "$(cat<<EOF
{
  "entry_link_type": "projects/dataplex-types/locations/global/entryLinkTypes/synonym",
"entry_references": [{
     "name": "projects/TERM1_PROJECT_NUMBER/locations/TERM1_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM1_PROJECT_NUMBER/locations/TERM1_LOCATION_ID/glossaries/TERM1_GLOSSARY_ID/terms/TERM1_ID",
     "type": "UNSPECIFIED"
  }, {
     "name": "projects/TERM2_PROJECT_NUMBER/locations/TERM2_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM2_PROJECT_NUMBER/locations/TERM2_LOCATION_ID/glossaries/TERM2_GLOSSARY_ID/terms/TERM2_ID",
     "type": "UNSPECIFIED"
  }
  ]

}
EOF
)"

替换以下内容:

  • TERM1_PROJECT_NUMBER:要关联的第一个术语的项目编号。
  • TERM1_LOCATION_ID:包含第一个术语的术语库的位置 ID。
  • TERM1_GLOSSARY_ID:包含第一个术语的术语库的 ID。
  • TERM1_ID:第一个术语的 ID。
  • TERM2_PROJECT_NUMBER:您要关联作为同义词的第二个术语的项目编号。如果两个术语位于同一项目中,则此值与第一个术语的项目编号相同。
  • TERM2_LOCATION_ID:包含第二个术语的术语库的位置 ID。如果两个术语位于同一位置,则此值与第一个术语的位置 ID 相同。
  • TERM2_GLOSSARY_ID:包含第二个术语的术语库的 ID。如果两个术语位于同一术语库中,则此值与第一个术语的术语库 ID 相同。
  • TERM2_ID:第二个术语的 ID。
  • ENTRY_LINK_ID:两个术语之间关联的 ID。每个术语都表示为一个 Knowledge Catalog 条目。 条目关联是同义词之间的关系。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开相应术语库,然后点击要与之创建关联的术语。

  3. 点击相关字词旁边的 修改

  4. 搜索并选择要关联的术语。

    选择该术语后,系统会立即将其关联。

  5. 点击关闭

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/TERM1_PROJECT_ID/locations/TERM1_LOCATION_ID/entryGroups/@dataplex/entryLinks?entry_link_id=ENTRY_LINK_ID -d "$(cat<<EOF
{
  "entry_link_type": "projects/dataplex-types/locations/global/entryLinkTypes/related",
"entry_references": [{
     "name": "projects/TERM1_PROJECT_NUMBER/locations/TERM1_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM1_PROJECT_NUMBER/locations/TERM1_LOCATION_ID/glossaries/TERM1_GLOSSARY_ID/terms/TERM1_ID",
     "type": "UNSPECIFIED"
  }, {
     "name": "projects/TERM2_PROJECT_NUMBER/locations/TERM2_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM2_PROJECT_NUMBER/locations/TERM2_LOCATION_ID/glossaries/TERM2_GLOSSARY_ID/terms/TERM2_ID",
     "type": "UNSPECIFIED"
  }
  ]

}
EOF
)"

替换以下内容:

  • TERM1_PROJECT_NUMBER:要关联的第一个术语的项目编号。
  • TERM1_LOCATION_ID:包含第一个术语的术语库的位置 ID。
  • TERM1_GLOSSARY_ID:包含第一个术语的术语库的 ID。
  • TERM1_ID:第一个术语的 ID。
  • TERM2_PROJECT_NUMBER:您要关联作为相关字词的第二个术语的项目编号。如果两个术语位于同一项目中,则此值与第一个术语的项目编号相同。
  • TERM2_LOCATION_ID:包含第二个术语的术语库的位置 ID。如果两个术语位于同一位置,则此值与第一个术语的位置 ID 相同。
  • TERM2_GLOSSARY_ID:包含第二个术语的术语库的 ID。如果两个术语位于同一术语库中,则此值与第一个术语的术语库 ID 相同。
  • TERM2_ID:第二个术语的 ID。
  • ENTRY_LINK_ID:两个术语之间关联的 ID。每个术语都表示为一个 Knowledge Catalog 条目。 条目关联是相关字词之间的关系。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/TERM_PROJECT_ID/locations/SYNONYM_LINKS_LOCATION_ID:lookupEntryLinks?entry=projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/glossaries/TERM_GLOSSARY_ID/terms/TERM_ID&entry_link_types=projects/dataplex-types/locations/global/entryLinkTypes/synonym&page_size=10

替换以下内容:

  • TERM_PROJECT_ID:您要查找其同义词链接的术语的项目 ID。
  • TERM_PROJECT_NUMBER:您要查找的术语的同义词链接的项目编号。
  • SYNONYM_LINKS_LOCATION_ID:您要查找同义词链接的位置 ID。
  • TERM_LOCATION_ID:相应字词的位置 ID。
  • TERM_GLOSSARY_ID:包含相应术语的术语库的 ID。
  • TERM_ID:相应学期的 ID。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/TERM_PROJECT_ID/locations/RELATED_LINKS_LOCATION_ID:lookupEntryLinks?entry=projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/glossaries/TERM_GLOSSARY_ID/terms/TERM_ID&entry_link_types=projects/dataplex-types/locations/global/entryLinkTypes/related&page_size=10

替换以下内容:

  • TERM_PROJECT_ID:您要查找相关链接的术语的项目 ID。
  • TERM_PROJECT_NUMBER:您要查找其相关链接的术语的项目编号。
  • RELATED_LINKS_LOCATION_ID:您要查找相关链接的位置 ID。
  • TERM_LOCATION_ID:相应字词的位置 ID。
  • TERM_GLOSSARY_ID:包含相应术语的术语库的 ID。
  • TERM_ID:相应学期的 ID。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 展开相应术语库,然后点击要移除其同义词或相关字词的术语。

  3. 如需删除相关字词之间的关联,请点击相关字词旁边的 修改。删除相关字词,然后点击关闭

  4. 如需删除同义词之间的关联,请点击同义词旁边的 修改。删除同义词,然后点击关闭

REST

  1. 查找条目链接,找到要删除的链接的条目链接 ID。如需了解详情,请参阅查找某个术语的同义词链接查找某个术语的相关链接

  2. 通过发送以下 DELETE 请求来删除关联:

    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
    gcurl -X DELETE https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/entryGroups/ENTRY_GROUP_ID/entryLinks/ENTRY_LINK_ID

您可以将术语附加到数据资产或数据资产列。例如,您可以将术语附加到 BigQuery 数据集和 Iceberg REST 目录表。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 搜索页面。

    转到搜索

  2. 搜索要将术语关联到的数据资产(例如数据集、文件或表),然后点击该数据资产。

  3. 在数据资产页面上,执行以下操作之一:

    • 如需将术语关联到资产,请在详细信息标签页的术语库术语部分中,点击添加。搜索并选择相应术语,然后点击关闭
    • 如果资产具有架构,您可以将术语关联到列。在架构标签页上,选择要将术语关联到的列,然后点击添加业务术语。搜索并选择相应术语,然后点击关闭

Python

from google.cloud import dataplex_v1

def attach_term_to_asset(
    project_id: str,
    location: str,
    entry_group_id: str,
    entry_link_id: str,
    source_entry_name: str,
    target_term_name: str,
) -> dataplex_v1.EntryLink:
    """Creates an entry link attaching a glossary term to a data asset."""
    client = dataplex_v1.CatalogServiceClient()
    parent_group = (
        f"projects/{project_id}/locations/{location}/"
        f"entryGroups/{entry_group_id}"
    )

    entry_link = dataplex_v1.EntryLink(
        entry_link_type=(
            "projects/dataplex-types/locations/global/"
            "entryLinkTypes/definition"
        ),
        entry_references=[
            dataplex_v1.EntryLink.EntryReference(
                name=source_entry_name, type_="SOURCE"
            ),
            dataplex_v1.EntryLink.EntryReference(
                name=target_term_name, type_="TARGET"
            ),
        ],
    )

    return client.create_entry_link(
        parent=parent_group,
        entry_link_id=entry_link_id,
        entry_link=entry_link,
    )

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/ENTRY_LOCATION_ID/entryGroups/ENTRY_GROUP_ID/entryLinks?entry_link_id=ENTRY_LINK_ID -d "$(cat<<EOF
{
  "entry_link_type": "projects/dataplex-types/locations/global/entryLinkTypes/definition",
  "entry_references": [{
     "name": "projects/PROJECT_NUMBER/locations/ENTRY_LOCATION_ID/entryGroups/ENTRY_GROUP_ID/entries/ENTRY_ID",
     "type": "SOURCE"
  }, {
     "name": "projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/glossaries/TERM_GLOSSARY_ID/terms/TERM_ID",
     "type": "TARGET"
  }
  ]
}
EOF
)"

替换以下内容:

  • PROJECT_NUMBER:要关联到的数据资产的项目编号
  • ENTRY_LOCATION_ID:要关联到的数据资产的位置 ID
  • ENTRY_GROUP_ID:要关联到的数据资产的条目组
  • ENTRY_LINK_ID:术语与表示数据资产的 Knowledge Catalog 条目之间的关联的 ID。
  • TERM_PROJECT_NUMBER:要关联的术语的项目编号。

将术语附加到条目架构中的列

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 搜索页面。

    转到搜索

  2. 搜索具有的架构包含您要将术语关联到的列的数据资产(例如数据集、文件或表)。点击该数据资产。

  3. 在数据资产页面上,执行以下操作之一:

    • 如需将术语关联到数据资产中的列,请在架构标签页上选择要将术语附加到的列。
    • 点击添加业务术语。搜索要附加的术语,然后点击要附加的术语。

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_NUMBER/locations/ENTRY_LOCATION_ID/entryGroups/ENTRY_GROUP_ID/entryLinks?entry_link_id=ENTRY_LINK_ID -d "$(cat<<EOF
{
 "entry_link_type": "projects/dataplex-types/locations/global/entryLinkTypes/definition",
 "entry_references": [
   {
     "name": "projects/PROJECT_NUMBER/locations/ENTRY_LOCATION_ID/entryGroups/ENTRY_GROUP_ID/entries/ENTRY_ID",
     "path": "Schema.COLUMN_NAME",
     "type": "SOURCE"
   },
   {
     "name": "projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/glossaries/TERM_GLOSSARY_ID/terms/TERM_ID",
     "type": "TARGET"
   }
 ]
}
EOF
)"

替换以下内容:

  • PROJECT_NUMBER:要关联到的数据资产的项目编号
  • ENTRY_LOCATION_ID:要关联到的数据资产的位置 ID
  • ENTRY_GROUP_ID:要关联到的数据资产的条目组
  • ENTRY_LINK_ID:术语与表示数据资产的 Knowledge Catalog 条目之间的关联的 ID
  • TERM_PROJECT_NUMBER:要关联的术语的项目编号
  • COLUMN_NAME:要将术语附加到的列

将术语附加到多个数据资产或列

您可以同时将单个术语表术语附加到多个数据资产或列。您可以在一次操作中最多选择 20 个资源或列。

控制台

如需将某个术语附加到多个资源,请按以下步骤操作:

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 术语库列表中,展开包含要关联的术语的术语库。

  3. 点击相应术语。

  4. 相关条目部分,点击 添加

  5. 附加相关条目对话框中,完成以下步骤:

    1. 找到要关联的资源或列。如需缩小搜索结果范围,请使用过滤条件按资源名称、资源类型或列名称进行搜索。

      例如,如需在 ID 为 sample-project 的项目内查找名为 sample-table 的 BigQuery 表中名为 sample-column 的列,请使用以下查询:

      project id:sample-project
      Resource Name:sample-table
      Column Name:sample-column
      

      您可以输入部分字符串来查找匹配的素材资源。

    2. 选择要附加的数据资产和列。

    3. 如需在添加之前查看所选资源,请点击显示所选资源切换开关。

    4. 点击 Add(添加)。

  6. 如需验证新附加的资源和列,请前往相应术语的详情页面的相关条目部分。

查找与术语相关联的数据资产

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/TERM_PROJECT_ID/locations/DEFINITION_LINKS_LOCATION_ID:lookupEntryLinks?entry=projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/entryGroups/@dataplex/entries/projects/TERM_PROJECT_NUMBER/locations/TERM_LOCATION_ID/glossaries/TERM_GLOSSARY_ID/terms/TERM_ID&entry_link_types=projects/dataplex-types/locations/global/entryLinkTypes/definition&entry_mode=TARGET&page_size=10

替换以下内容:

  • TERM_PROJECT_ID:您要查找其定义链接的术语的项目 ID。
  • TERM_PROJECT_NUMBER:您要查找其定义链接的术语的项目编号。
  • DEFINITION_LINKS_LOCATION_ID:您要查找定义链接的位置 ID。
  • TERM_LOCATION_ID:相应字词的位置 ID。
  • TERM_GLOSSARY_ID:包含相应术语的术语库的 ID。
  • TERM_ID:相应学期的 ID。

查找与数据资产相关联的术语

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/DEFINITION_LINKS_LOCATION_ID:lookupEntryLinks?entry=projects/PROJECT_NUMBER/locations/ENTRY_LOCATION_ID/entryGroups/ENTRY_GROUP_ID/entries/ENTRY_ID&entry_link_types=projects/dataplex-types/locations/global/entryLinkTypes/definition&entry_mode=SOURCE&page_size=10

替换以下内容:

  • PROJECT_ID:您要查找其定义链接的数据资产的项目 ID。
  • PROJECT_NUMBER:您要查找其定义链接的数据资产的项目编号。
  • DEFINITION_LINKS_LOCATION_ID:您要查找定义链接的位置 ID。
  • ENTRY_LOCATION_ID:数据资产的位置 ID。
  • ENTRY_GROUP_ID:数据资产的条目组的 ID。
  • ENTRY_ID:数据资产的 ID。

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 搜索页面。

    转到搜索

  2. 搜索要从中移除术语的数据资产(例如数据集、文件或表),然后点击该数据资产。

  3. 在数据资产页面上,执行以下操作之一:

    • 如需从资产中移除术语,请在详细信息标签页的术语库术语部分中,点击该术语。然后点击
    • 如需从列中移除术语,请在架构标签页中,点击该术语旁边的

REST

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

gcurl -X DELETE https://dataplex.googleapis.com/v1/projects/ENTRY_PROJECT_ID/locations/ENTRY_LOCATION_ID/entryGroups/ENTRY_GROUP_ID/entryLinks/ENTRY_LINK_ID

查找术语库、术语和关联的数据资产

控制台

如需浏览业务术语库内容,请使用术语库页面上的术语库和术语树。

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 术语库页面上,使用过滤条件栏查找类别。您可以使用以下过滤条件:

    • 名称:返回其名称包含您提供的文本的术语库、类别和术语。
    • 父级:返回其父级术语库名称或说明与您提供的文本匹配的术语。例如,parent:Finance 会返回与名称或说明包含字词 Finance 的父级术语库相关联的术语。
    • 同义词:返回具有其名称或 ID 包含您提供的文本的同义词的术语列表。例如,synonym:Profit 会返回具有其名称或 ID 包含字词 profit 的同义词的术语。。
    • 联系人:返回其中的数据管理员被列为联系人的术语。例如,contact:alex@example.com 会返回与数据管理员匹配 alex@example.com 的术语相关联的条目。

REST

如需使用 REST API 查找术语库、术语和关联的数据资产,您需要注册预览版

搜索与术语相关联的数据资产

控制台

  1. 在 Google Cloud 控制台中,前往 Knowledge Catalog 术语库页面。

    前往“术语库”

  2. 术语库页面上,使用过滤条件栏输入自由格式的文本搜索查询。这会返回术语库、类别和术语名称中相应匹配项的列表。

  3. 点击匹配的术语。

  4. 术语详情页面上,查看与该术语相关联的术语(同义词和相关字词)和条目(数据资产)。

  5. 如果您想查看 Knowledge Catalog 中条目的详细信息,请点击相应条目。

REST

如需使用 REST API 查找术语库、术语和关联的数据资产,您需要注册预览版

导入术语库以及术语与术语或数据资产之间的关联

如需从其他编目工具导入术语库和关联,或更新 Knowledge Catalog 中的术语库,您可以使用 REST API 批量导入术语库、类别、术语、术语之间的关联、术语与数据资产或列之间的关联。

  1. 创建目标术语库。

    REST

    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
    gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries?glossary_id=GLOSSARY_ID -d "$(cat<<EOF
    
    {
     "displayName": "DISPLAY_NAME",
     "description": "DESCRIPTION"
    }
    EOF
    )"

    替换以下内容:

    • PROJECT_ID:您要在其中创建术语库的项目的 ID
    • LOCATION_ID:要在其中创建术语库的位置
    • GLOSSARY_ID:术语库 ID
    • DISPLAY_NAME:术语库的显示名称
    • DESCRIPTION:术语库的说明
  2. 如需导入创建的目标术语表中的类别、术语以及术语与数据资产之间的关联,请分别针对每个导入项将文件上传到 Cloud Storage 存储桶。这些文件的格式如下:

    • 术语库中的术语和类别的示例格式

       {"entry":{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID","entryType":"projects/dataplex-types/locations/global/entryTypes/glossary-category","aspects":{"dataplex-types.global.glossary-category-aspect":{"data":{}},"dataplex-types.global.overview":{"data":{"content":"CONTENT"}},"dataplex-types.global.contacts":{"data":{"identities":[{role: "steward", name: "CONTACT_DISPLAY_NAME", id: "CONTACT_EMAIL"}]}}},"parentEntry":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","entrySource":{"resource":"projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID","displayName":"CATEGORY_NAME","description":"CATEGORY_DESCRIPTION","ancestors":[{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary"}]}}}
       {"entry":{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM1_ID","entryType":"projects/dataplex-types/locations/global/entryTypes/glossary-term","aspects":{"dataplex-types.global.glossary-term-aspect":{"data":{}},"dataplex-types.global.overview":{"data":{"content":"TERM1_CONTENT"}},"dataplex-types.global.contacts":{"data":{"identities":[{role: "steward", name: "CONTACT_DISPLAY_NAME", id: "CONTACT_EMAIL"}]}}},"parentEntry":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","entrySource":{"resource":"projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM1_ID","displayName":"TERM1_DISPLAY_NAME","description":"TERM1_DESCRIPTION","ancestors":[{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary"},{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary-category"}]}}}
       {"entry":{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM2_ID","entryType":"projects/dataplex-types/locations/global/entryTypes/glossary-term","aspects":{"dataplex-types.global.glossary-term-aspect":{"data":{}},"dataplex-types.global.overview":{"data":{"content":"TERM1_CONTENT"}},"dataplex-types.global.contacts":{"data":{"identities":[{role: "steward", name: "CONTACT_DISPLAY_NAME", id: "CONTACT_EMAIL"}]}}},"parentEntry":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","entrySource":{"resource":"projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM2_ID","displayName":"TERM2_DISPLAY_NAME","description":"TERM2_DESCRIPTION","ancestors":[{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary"},{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary-category"}]}}}
       
    • 术语之间的关联的示例格式

       {"entryLink":{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entryLinks/el-import-0606e3f2-8206-4f3a-aba9-32c6196f6048","entryLinkType":"projects/dataplex-types/locations/global/entryLinkTypes/synonym","entryReferences":[{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-1"},{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-2"}]}}
       {"entryLink":{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entryLinks/el-import-2f7408e3-af3d-405d-81bb-861cf9ec5146","entryLinkType":"projects/dataplex-types/locations/global/entryLinkTypes/related","entryReferences":[{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-1"},{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-2"}]}}
       
    • 术语与数据资产之间的关联的示例格式

       projects/PROJECT_NUMBER/locations/us-central1/entryGroups/entry-group-1/entries/entry-1 and term projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-1
       {"entryLink":{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entryLinks/el-import-0606e3f2-8206-4f3a-aba9-32c6196f6048","entryLinkType":"projects/dataplex-types/locations/global/entryLinkTypes/definition","entryReferences":[{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-1"},{"name":"projects/PROJECT_NUMBER/locations/us-central1/entryGroups/entry-group-1/entries/entry-1"}]}}
       
    # Set GCURL alias
    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
    gcurl https://DATAPLEX_API/metadataJobs?metadata_job_id=JOB_ID -d "$(cat<<EOF
    {
      "type":"IMPORT",
      "import_spec":{
         "log_level":"DEBUG",
         "source_storage_uri":"gs://STORAGE_BUCKET/",
         "entry_sync_mode":"FULL",
         "aspect_sync_mode":"INCREMENTAL",
         "scope":{
            "glossaries": "GLOSSARY_NAME"
         }
      }
    }
    EOF
    )"

    DATAPLEX_API 替换为格式为 dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID 的 Dataplex API 端点。

  3. 可选:获取操作的状态。

    gcurl https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/operations/operation-OPERATION_ID

    OPERATION_ID 替换为操作的 ID。

  4. 可选:获取元数据作业的状态。

    gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/metadataJobs/JOB_ID
  5. 将术语之间的关联作为同义词或相关字词导入。

    gcurl https://DATAPLEX_API/metadataJobs?metadata_job_id=JOB_ID -d "$(cat<<EOF
    {
      "type":"IMPORT",
      "import_spec":{
         "log_level":"DEBUG",
         "source_storage_uri":"gs://STORAGE_BUCKET/",
         "entry_sync_mode":"FULL",
         "aspect_sync_mode":"INCREMENTAL",
         "scope":{
            "entry_groups":[  "projects/PROJECT_ID/locations/LOCATION_ID/entryGroups/@dataplex"
            ],
            "entry_link_types":[
               "projects/dataplex-types/locations/global/entryLinkTypes/synonym",
               "projects/dataplex-types/locations/global/entryLinkTypes/related"
            ],
            "referenced_entry_scopes":[
               "PROJECT_IDS"
            ]
         }
      }
    }
    EOF
    )"

    DATAPLEX_API 替换为 dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID

  6. 导入术语与数据资产或列之间的关联。

    如需在术语表术语与数据资产之间创建关联,请针对数据资产条目所属的每个条目组运行导入作业。所有定义条目关联均在此条目组中创建。

    gcurl https://DATAPLEX_API/metadataJobs?metadata_job_id=JOB_ID -d "$(cat<<EOF
    {
    "type":"IMPORT",
    "import_spec":{
      "log_level":"DEBUG",
      "source_storage_uri":"gs://STORAGE_BUCKET/",
      "entry_sync_mode":"FULL",
      "aspect_sync_mode":"INCREMENTAL",
      "scope":{
         "entry_groups":[  "projects/PROJECT_ID/locations/ENTRY_GROUP_LOCATION_ID/entryGroups/@dataplex"
         ],
         "entry_link_types":[
            "projects/dataplex-types/locations/global/entryLinkTypes/definition"
         ],
         "referenced_entry_scopes":[
            "PROJECT_IDS"
         ]
      }
    }
    }
    EOF
    )"

    DATAPLEX_API 替换为 dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID

价格

自 2025 年 7 月起,Knowledge Catalog 业务术语库的费用将与元数据存储价格相同。请参阅Knowledge Catalog 元数据存储价格

后续步骤