in dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/bg_import/business_glossary_export_v2.py [0:0]
def build_entry_links(entry: Dict[str, Any], relationships_data: Dict[str, List[Dict[str, Any]]]) -> List[Dict[str, Any]]:
"""
Build the entry links JSON data for synonyms and related terms.
"""
entry_links = []
entry_name = entry.get("name", "")
relationships = relationships_data.get(entry_name, [])
for relationship in relationships:
entry_link_id = get_entry_link_id(relationship.get("name", ""))
link_type = relationship.get("relationshipType", "")
if link_type in ["is_synonymous_to", "is_related_to"]:
destination_entry = relationship.get("destinationEntry", {}).get("name", "")
source_entry = relationship.get("sourceEntry", {}).get("name", "")
source_entry_type = relationship.get("sourceEntry", {}).get("entryType", "")
if destination_entry:
source_entry_name = get_entry_name(source_entry, source_entry_type)
destination_entry_name = get_entry_name(destination_entry, source_entry_type)
entry_links.append(build_entry_link(source_entry_name, destination_entry_name, link_type, entry_link_id))
return entry_links