Skip to main content

Creating hierarchy

Categories in a glossary can be organized within another category, to create a hierarchy of categories.

To do this, you need to create the upper levels of the hierarchy before the lower levels. Each level you create should refer to its parent, and therefore its parent must first exist.

Create root-level category

To create a root- or top-level category (no parent):

Create a top-level category
GlossaryCategory top = GlossaryCategory.creator(
"Top", // (1)
glossary) // (2)
.build(); // (3)
AssetMutationResponse response = top.save(client); // (4)
  1. A name for the new category.
  2. The glossary in which to create the category. Note that we don't specify any parent category anywhere, since this will be a top-level category.
  3. You need to build the object you've just defined.
  4. You then only need to save()1 the object to create it in Atlan. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Create child category

Parent must exist before creating the child

Remember: the parent category must exist before you create the child category.

To create a child category, the steps are very similar but you add in the reference to the parent category:

Create a child category
GlossaryCategory child = GlossaryCategory.creator(
"Middle", // (1)
glossary) // (2)
.parentCategory(top.trimToReference()) // (3)
.build(); // (4)
AssetMutationResponse response = child.save(client); // (5)
  1. A name for the new category.

  2. The glossary in which to create the category.

  3. Now you add in the reference to the parent category. There are multiple ways you can reference the category:

    • If you have the parent category already, you can use trimToReference() to obtain the minimal reference to it.
    • If you only know the GUID, you can use GlossaryCategory.refByGuid() to create a minimal reference to it.
    • If you only know the qualifiedName, you can use GlossaryCategory.refByQualifiedName() to create a minimal reference to it.
  4. You need to build the object you've just defined.

  5. You then only need to save()1 the object to create it in Atlan. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Footnotes

  1. Why no distinction between create and update? This has to do with how Atlan detects changes—see the Importance of identifiers concept for a more detailed explanation. 2 3 4 5 6

Was this page helpful?