Area: Product
Sub-Area: Governance
Applies to: OSS + Cloud
Issue
Business glossary terms are not organizing into the hierarchy you expect, or GraphQL calls to build a glossary hierarchy fail validation.
You Might Be Asking
- How do I create a glossary hierarchy with the API?
- Can a term sit under more than one parent?
- How do I move a term or node to a different parent?
- Does adding related terms build a hierarchy?
Cause
The glossary hierarchy comes from one parent link per entity.
- A term has one optional parent, and that parent must be a glossary node (Term Group). A term cannot sit in several nodes and cannot sit under another term.
-
createGlossaryNodeandcreateGlossaryTermtake the same input,CreateGlossaryEntityInput. It has onlyid(optional, a random UUID if you omit it),name(required),descriptionandparentNode. Fields such asglossaryTermsorrelatedTermsare not part of the input, so the call is rejected. - Both mutations return a
String. You cannot select sub-fields such as{ urn }on aString. - You move terms and nodes with
updateParentNode. - Related terms are links between terms. They are not a parent-child hierarchy. The only relationship types are
isAandhasA.RELATED_TOis not a valid value.
Solution
1. Create a top-level glossary node
Leave out parentNode and the node has no parent. Do not add a selection set.
mutation createBusinessMetrics {
createGlossaryNode(
input: {
id: "business_metrics"
name: "Business Metrics"
description: "All business metrics"
}
)
}
2. Create a child node
Use a new id and set parentNode to the parent's urn.
mutation createFinanceMetrics {
createGlossaryNode(
input: {
id: "finance_metrics"
name: "Finance Metrics"
description: "Finance-specific metrics"
parentNode: "urn:li:glossaryNode:business_metrics"
}
)
}
3. Create a term inside a node
Set parentNode to the node's urn.
mutation createTermInNode {
createGlossaryTerm(
input: {
id: "annual_recurring_revenue"
name: "Annual Recurring Revenue"
description: "Total recurring revenue normalized to one year"
parentNode: "urn:li:glossaryNode:finance_metrics"
}
)
}
Creating a term with an id that already exists fails with This Glossary Term already exists!. A term whose name already exists at the same level fails with Glossary Term with this name already exists at this level of the Business Glossary.
4. Move a term or node
Use updateParentNode. The updateGlossaryTerm mutation does not exist. Set resourceUrn to the urn of the term or node that you move. Set parentNode to the urn of the new parent node. The mutation returns a Boolean.
mutation moveTerm {
updateParentNode(
input: {
resourceUrn: "urn:li:glossaryTerm:annual_recurring_revenue"
parentNode: "urn:li:glossaryNode:new_parent_node"
}
)
}
To remove the parent, pass parentNode: null. This works for glossary nodes and terms only.
You can also move a term or a Term Group in the DataHub UI:
- Open the term or the Term Group.
- Click the three-dot menu at the top right of the page.
- Select Move and choose the new parent Term Group.
5. Read a node
Read a node's name and description under properties { name description }. The GlossaryNode type also exposes parentNodes, which gives the ancestor lineage, and relationships(input: RelationshipsInput!).
6. Link related terms
Call addRelatedTerms (or removeRelatedTerms) with RelatedTermsInput: urn (the term), termUrns (the terms to link) and relationshipType (isA or hasA). Use Term Groups, not related terms, to build a hierarchy.
Permissions
- Manage Glossaries is a platform privilege to create, edit and remove glossary entities.
- Manage Direct Glossary Children lets a user create and delete the direct children of an entity. You can grant it on a Term Group.