diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/glossary/GlossaryTermType.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/glossary/GlossaryTermType.java index 4d9836a276..2be67ab399 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/glossary/GlossaryTermType.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/glossary/GlossaryTermType.java @@ -46,6 +46,7 @@ public class GlossaryTermType implements SearchableEntityType, Bro GLOSSARY_TERM_KEY_ASPECT_NAME, GLOSSARY_TERM_INFO_ASPECT_NAME, GLOSSARY_RELATED_TERM_ASPECT_NAME, + INSTITUTIONAL_MEMORY_ASPECT_NAME, OWNERSHIP_ASPECT_NAME, STATUS_ASPECT_NAME, BROWSE_PATHS_ASPECT_NAME, @@ -76,7 +77,7 @@ public class GlossaryTermType implements SearchableEntityType, Bro try { final Map glossaryTermMap = _entityClient.batchGetV2(GLOSSARY_TERM_ENTITY_NAME, - new HashSet<>(glossaryTermUrns), null, context.getAuthentication()); + new HashSet<>(glossaryTermUrns), ASPECTS_TO_RESOLVE, context.getAuthentication()); final List gmsResults = new ArrayList<>(); for (Urn urn : glossaryTermUrns) { diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/glossary/mappers/GlossaryTermMapper.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/glossary/mappers/GlossaryTermMapper.java index 67063bf522..e7406673c0 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/glossary/mappers/GlossaryTermMapper.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/glossary/mappers/GlossaryTermMapper.java @@ -1,12 +1,14 @@ package com.linkedin.datahub.graphql.types.glossary.mappers; import com.linkedin.common.Deprecation; +import com.linkedin.common.InstitutionalMemory; import com.linkedin.common.Ownership; import com.linkedin.data.DataMap; import com.linkedin.data.template.RecordTemplate; import com.linkedin.datahub.graphql.generated.EntityType; import com.linkedin.datahub.graphql.generated.GlossaryTerm; import com.linkedin.datahub.graphql.types.common.mappers.DeprecationMapper; +import com.linkedin.datahub.graphql.types.common.mappers.InstitutionalMemoryMapper; import com.linkedin.datahub.graphql.types.common.mappers.OwnershipMapper; import com.linkedin.datahub.graphql.types.common.mappers.util.MappingHelper; import com.linkedin.datahub.graphql.types.glossary.GlossaryTermUtils; @@ -30,31 +32,43 @@ public class GlossaryTermMapper implements ModelMapper mappingHelper = new MappingHelper<>(aspectMap, result); - mappingHelper.mapToResult(GLOSSARY_TERM_KEY_ASPECT_NAME, this::mapGlossaryTermKey); - mappingHelper.mapToResult(GLOSSARY_TERM_INFO_ASPECT_NAME, (glossaryTerm, dataMap) -> - glossaryTerm.setGlossaryTermInfo(GlossaryTermInfoMapper.map(new GlossaryTermInfo(dataMap)))); - mappingHelper.mapToResult(OWNERSHIP_ASPECT_NAME, (glossaryTerm, dataMap) -> - glossaryTerm.setOwnership(OwnershipMapper.map(new Ownership(dataMap)))); + EnvelopedAspectMap aspectMap = entityResponse.getAspects(); + MappingHelper mappingHelper = new MappingHelper<>(aspectMap, result); + mappingHelper.mapToResult(GLOSSARY_TERM_KEY_ASPECT_NAME, this::mapGlossaryTermKey); + mappingHelper.mapToResult(GLOSSARY_TERM_INFO_ASPECT_NAME, (glossaryTerm, dataMap) -> + glossaryTerm.setGlossaryTermInfo(GlossaryTermInfoMapper.map(new GlossaryTermInfo(dataMap)))); + mappingHelper.mapToResult(GLOSSARY_TERM_INFO_ASPECT_NAME, (glossaryTerm, dataMap) -> + glossaryTerm.setProperties(GlossaryTermPropertiesMapper.map(new GlossaryTermInfo(dataMap)))); + mappingHelper.mapToResult(OWNERSHIP_ASPECT_NAME, (glossaryTerm, dataMap) -> + glossaryTerm.setOwnership(OwnershipMapper.map(new Ownership(dataMap)))); mappingHelper.mapToResult(DEPRECATION_ASPECT_NAME, (glossaryTerm, dataMap) -> - glossaryTerm.setDeprecation(DeprecationMapper.map(new Deprecation(dataMap)))); + glossaryTerm.setDeprecation(DeprecationMapper.map(new Deprecation(dataMap)))); + mappingHelper.mapToResult(INSTITUTIONAL_MEMORY_ASPECT_NAME, (dataset, dataMap) -> + dataset.setInstitutionalMemory(InstitutionalMemoryMapper.map(new InstitutionalMemory(dataMap)))); - return mappingHelper.getResult(); + // If there's no name property, resort to the legacy name computation. + if (result.getGlossaryTermInfo() != null && result.getGlossaryTermInfo().getName() == null) { + result.getGlossaryTermInfo().setName(legacyName); + } + if (result.getProperties() != null && result.getProperties().getName() == null) { + result.getProperties().setName(legacyName); + } + return mappingHelper.getResult(); } private void mapGlossaryTermKey(@Nonnull GlossaryTerm glossaryTerm, @Nonnull DataMap dataMap) { - GlossaryTermKey glossaryTermKey = new GlossaryTermKey(dataMap); - glossaryTerm.setName(GlossaryTermUtils.getGlossaryTermName(glossaryTermKey.getName())); - glossaryTerm.setHierarchicalName(glossaryTermKey.getName()); + GlossaryTermKey glossaryTermKey = new GlossaryTermKey(dataMap); + glossaryTerm.setName(GlossaryTermUtils.getGlossaryTermName(glossaryTermKey.getName())); + glossaryTerm.setHierarchicalName(glossaryTermKey.getName()); } } diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/tag/mappers/TagMapper.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/tag/mappers/TagMapper.java index 2e65fe1185..214a63b7df 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/tag/mappers/TagMapper.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/tag/mappers/TagMapper.java @@ -36,14 +36,21 @@ public class TagMapper implements ModelMapper { final Tag result = new Tag(); result.setUrn(entityResponse.getUrn().toString()); result.setType(EntityType.TAG); + + final String legacyName = entityResponse.getUrn().getId(); + result.setName(legacyName); + EnvelopedAspectMap aspectMap = entityResponse.getAspects(); MappingHelper mappingHelper = new MappingHelper<>(aspectMap, result); mappingHelper.mapToResult(TAG_KEY_ASPECT_NAME, this::mapTagKey); - mappingHelper.mapToResult(TAG_PROPERTIES_ASPECT_NAME, (tag, dataMap) -> - tag.setDescription(new TagProperties(dataMap).getDescription())); + mappingHelper.mapToResult(TAG_PROPERTIES_ASPECT_NAME, this::mapTagProperties); mappingHelper.mapToResult(OWNERSHIP_ASPECT_NAME, (tag, dataMap) -> tag.setOwnership(OwnershipMapper.map(new Ownership(dataMap)))); + if (result.getProperties() != null && result.getProperties().getName() == null) { + result.getProperties().setName(legacyName); + } + return mappingHelper.getResult(); } diff --git a/datahub-graphql-core/src/main/resources/entity.graphql b/datahub-graphql-core/src/main/resources/entity.graphql index 0bf3ce077e..9be2ac696c 100644 --- a/datahub-graphql-core/src/main/resources/entity.graphql +++ b/datahub-graphql-core/src/main/resources/entity.graphql @@ -802,6 +802,11 @@ type GlossaryTerm implements Entity { """ ownership: Ownership + """ + References to internal resources related to the Glossary Term + """ + institutionalMemory: InstitutionalMemory + """ A standard Entity Type """ @@ -818,7 +823,7 @@ type GlossaryTerm implements Entity { hierarchicalName: String! """ - Additional read only properties associated with the Glossary Term + Additional properties associated with the Glossary Term """ properties: GlossaryTermProperties @@ -858,7 +863,7 @@ type GlossaryTermInfo { """ Description of the glossary term """ - description: String! + description: String """ Definition of the glossary term. Deprecated - Use 'description' instead. @@ -898,12 +903,12 @@ type GlossaryTermProperties { """ The name of the Glossary Term """ - name: String + name: String! """ Description of the glossary term """ - description: String! + description: String """ Definition of the glossary term. Deprecated - Use 'description' instead. @@ -2579,7 +2584,7 @@ type TagProperties { """ A display name for the Tag """ - name: String + name: String! """ A description of the Tag diff --git a/datahub-web-react/src/Mocks.tsx b/datahub-web-react/src/Mocks.tsx index f5f4840226..0c1a276c2c 100644 --- a/datahub-web-react/src/Mocks.tsx +++ b/datahub-web-react/src/Mocks.tsx @@ -839,12 +839,16 @@ const glossaryTerm3 = { hasRelatedTerms: [ { urn: 'urn:li:glossaryTerm:example.glossaryterm3', - name: 'glossaryterm3', + properties: { + name: 'glossaryterm3', + }, __typename: 'GlossaryTerm', }, { urn: 'urn:li:glossaryTerm:example.glossaryterm4', - name: 'glossaryterm4', + properties: { + name: 'glossaryterm4', + }, __typename: 'GlossaryTerm', }, ], diff --git a/datahub-web-react/src/app/entity/dataset/profile/stories/sampleSchema.ts b/datahub-web-react/src/app/entity/dataset/profile/stories/sampleSchema.ts index 8ee30647e5..71c27ab7bd 100644 --- a/datahub-web-react/src/app/entity/dataset/profile/stories/sampleSchema.ts +++ b/datahub-web-react/src/app/entity/dataset/profile/stories/sampleSchema.ts @@ -121,8 +121,8 @@ export const sampleSchemaWithTags: Schema = { { term: { type: EntityType.GlossaryTerm, - urn: 'urn:li:glossaryTerm:sample-glossary-term', name: 'sample-glossary-term', + urn: 'urn:li:glossaryTerm:sample-glossary-term', hierarchicalName: 'example.sample-glossary-term', properties: { name: 'sample-glossary-term', diff --git a/datahub-web-react/src/app/entity/glossaryTerm/GlossaryTermEntity.tsx b/datahub-web-react/src/app/entity/glossaryTerm/GlossaryTermEntity.tsx index fd3e0a7aaf..59b4b04538 100644 --- a/datahub-web-react/src/app/entity/glossaryTerm/GlossaryTermEntity.tsx +++ b/datahub-web-react/src/app/entity/glossaryTerm/GlossaryTermEntity.tsx @@ -11,8 +11,9 @@ import { SchemaTab } from '../shared/tabs/Dataset/Schema/SchemaTab'; import GlossaryRelatedEntity from './profile/GlossaryRelatedEntity'; import GlossayRelatedTerms from './profile/GlossaryRelatedTerms'; import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Ownership/SidebarOwnerSection'; -import GlossarySidebarAboutSection from './profile/GlossarySidebarAboutSection'; import { PropertiesTab } from '../shared/tabs/Properties/PropertiesTab'; +import { DocumentationTab } from '../shared/tabs/Documentation/DocumentationTab'; +import { SidebarAboutSection } from '../shared/containers/profile/sidebar/SidebarAboutSection'; /** * Definition of the DataHub Dataset entity. @@ -64,6 +65,10 @@ export class GlossaryTermEntity implements Entity { name: 'Related Entities', component: GlossaryRelatedEntity, }, + { + name: 'Documentation', + component: DocumentationTab, + }, { name: 'Schema', component: SchemaTab, @@ -88,7 +93,7 @@ export class GlossaryTermEntity implements Entity { ]} sidebarSections={[ { - component: GlossarySidebarAboutSection, + component: SidebarAboutSection, }, { component: SidebarOwnerSection, @@ -102,7 +107,7 @@ export class GlossaryTermEntity implements Entity { getOverridePropertiesFromEntity = (glossaryTerm?: GlossaryTerm | null): GenericEntityProperties => { // if dataset has subTypes filled out, pick the most specific subtype and return it return { - customProperties: glossaryTerm?.glossaryTermInfo?.customProperties, + customProperties: glossaryTerm?.properties?.customProperties, }; }; @@ -114,15 +119,15 @@ export class GlossaryTermEntity implements Entity { return ( ); }; displayName = (data: GlossaryTerm) => { - return data.name; + return data.properties?.name || data.name || data.urn; }; platformLogoUrl = (_: GlossaryTerm) => { diff --git a/datahub-web-react/src/app/entity/glossaryTerm/preview/Preview.tsx b/datahub-web-react/src/app/entity/glossaryTerm/preview/Preview.tsx index aad3da9388..6c11193817 100644 --- a/datahub-web-react/src/app/entity/glossaryTerm/preview/Preview.tsx +++ b/datahub-web-react/src/app/entity/glossaryTerm/preview/Preview.tsx @@ -7,12 +7,12 @@ import { useEntityRegistry } from '../../../useEntityRegistry'; export const Preview = ({ urn, name, - definition, + description, owners, }: { urn: string; name: string; - definition?: string | null; + description?: string | null; owners?: Array | null; }): JSX.Element => { const entityRegistry = useEntityRegistry(); @@ -20,7 +20,7 @@ export const Preview = ({ } type="Glossary Term" diff --git a/datahub-web-react/src/app/entity/glossaryTerm/preview/__tests__/Preview.test.tsx b/datahub-web-react/src/app/entity/glossaryTerm/preview/__tests__/Preview.test.tsx index f794f52a1b..35b8675c71 100644 --- a/datahub-web-react/src/app/entity/glossaryTerm/preview/__tests__/Preview.test.tsx +++ b/datahub-web-react/src/app/entity/glossaryTerm/preview/__tests__/Preview.test.tsx @@ -13,7 +13,7 @@ describe('Preview', () => { diff --git a/datahub-web-react/src/app/entity/tag/Tag.tsx b/datahub-web-react/src/app/entity/tag/Tag.tsx index 0b79940727..57082d324e 100644 --- a/datahub-web-react/src/app/entity/tag/Tag.tsx +++ b/datahub-web-react/src/app/entity/tag/Tag.tsx @@ -68,7 +68,7 @@ export class TagEntity implements Entity { }; displayName = (data: Tag) => { - return data.name; + return data.properties?.name || data.name || data.urn; }; getGenericEntityProperties = (tag: Tag) => { diff --git a/datahub-web-react/src/app/shared/tags/TagTermGroup.tsx b/datahub-web-react/src/app/shared/tags/TagTermGroup.tsx index 8d62f599aa..d7418eede6 100644 --- a/datahub-web-react/src/app/shared/tags/TagTermGroup.tsx +++ b/datahub-web-react/src/app/shared/tags/TagTermGroup.tsx @@ -160,7 +160,7 @@ export default function TagTermGroup({ - {term.term.name} + {entityRegistry.getDisplayName(EntityType.GlossaryTerm, term.term)} ))} @@ -174,7 +174,7 @@ export default function TagTermGroup({ }} > - {term.term.name} + {entityRegistry.getDisplayName(EntityType.GlossaryTerm, term.term)} ))} @@ -185,7 +185,7 @@ export default function TagTermGroup({ return ( - {tag.tag.name} + {entityRegistry.getDisplayName(EntityType.Tag, tag.tag)} ); diff --git a/datahub-web-react/src/graphql/browse.graphql b/datahub-web-react/src/graphql/browse.graphql index 55d04f07c2..08d194b356 100644 --- a/datahub-web-react/src/graphql/browse.graphql +++ b/datahub-web-react/src/graphql/browse.graphql @@ -71,11 +71,12 @@ query getBrowseResults($input: BrowseInput!) { } } ... on GlossaryTerm { - name ownership { ...ownershipFields } - glossaryTermInfo { + properties { + name + description definition termSource sourceRef diff --git a/datahub-web-react/src/graphql/container.graphql b/datahub-web-react/src/graphql/container.graphql index 4ca8182c05..417a46b217 100644 --- a/datahub-web-react/src/graphql/container.graphql +++ b/datahub-web-react/src/graphql/container.graphql @@ -32,5 +32,8 @@ query getContainer($urn: String!) { container { ...entityContainer } + domain { + ...entityDomain + } } } diff --git a/datahub-web-react/src/graphql/fragments.graphql b/datahub-web-react/src/graphql/fragments.graphql index a9f8fbde62..4a0da5d786 100644 --- a/datahub-web-react/src/graphql/fragments.graphql +++ b/datahub-web-react/src/graphql/fragments.graphql @@ -13,6 +13,9 @@ fragment glossaryTerms on GlossaryTerms { term { urn name + properties { + name + } } } } diff --git a/datahub-web-react/src/graphql/glossaryTerm.graphql b/datahub-web-react/src/graphql/glossaryTerm.graphql index 5356d2218d..0fc1c4de62 100644 --- a/datahub-web-react/src/graphql/glossaryTerm.graphql +++ b/datahub-web-react/src/graphql/glossaryTerm.graphql @@ -31,8 +31,12 @@ query getGlossaryTerm($urn: String!, $start: Int, $count: Int) { ownership { ...ownershipFields } - glossaryTermInfo { - definition + institutionalMemory { + ...institutionalMemoryFields + } + properties { + name + description termSource sourceRef sourceUrl @@ -42,10 +46,8 @@ query getGlossaryTerm($urn: String!, $start: Int, $count: Int) { value } } - schemaMetadata(version: 0) { + schemaMetadata(version: 0) { ...schemaMetadataFields } } } - - diff --git a/datahub-web-react/src/graphql/preview.graphql b/datahub-web-react/src/graphql/preview.graphql index c6c0db3c18..74e05e1a66 100644 --- a/datahub-web-react/src/graphql/preview.graphql +++ b/datahub-web-react/src/graphql/preview.graphql @@ -186,11 +186,13 @@ fragment entityPreview on Entity { ... on GlossaryTerm { name hierarchicalName - glossaryTermInfo { - definition + properties { + name + description termSource sourceRef sourceUrl + rawSchema customProperties { key value diff --git a/datahub-web-react/src/graphql/search.graphql b/datahub-web-react/src/graphql/search.graphql index fd641b4cfa..0a5ef5f9ec 100644 --- a/datahub-web-react/src/graphql/search.graphql +++ b/datahub-web-react/src/graphql/search.graphql @@ -219,11 +219,13 @@ fragment searchResults on SearchResults { ... on GlossaryTerm { name hierarchicalName - glossaryTermInfo { - definition + properties { + name + description termSource sourceRef sourceUrl + rawSchema customProperties { key value @@ -345,7 +347,9 @@ fragment searchResults on SearchResults { description } ... on GlossaryTerm { - name + properties { + name + } } ... on DataPlatform { ...platformFields diff --git a/metadata-models/src/main/resources/entity-registry.yml b/metadata-models/src/main/resources/entity-registry.yml index 07b5796e0f..a555325867 100644 --- a/metadata-models/src/main/resources/entity-registry.yml +++ b/metadata-models/src/main/resources/entity-registry.yml @@ -76,6 +76,7 @@ entities: keyAspect: glossaryTermKey aspects: - glossaryTermInfo + - institutionalMemory - schemaMetadata - ownership - deprecation diff --git a/metadata-utils/build.gradle b/metadata-utils/build.gradle index fb21f8b09b..32c13a8998 100644 --- a/metadata-utils/build.gradle +++ b/metadata-utils/build.gradle @@ -32,5 +32,5 @@ dependencies { because("previous versions are vulnerable to CVE-2021-45105") } } - + } \ No newline at end of file diff --git a/metadata-utils/src/main/java/com/linkedin/metadata/Constants.java b/metadata-utils/src/main/java/com/linkedin/metadata/Constants.java index 3d6ae86eb1..9edbf4fe69 100644 --- a/metadata-utils/src/main/java/com/linkedin/metadata/Constants.java +++ b/metadata-utils/src/main/java/com/linkedin/metadata/Constants.java @@ -134,7 +134,7 @@ public class Constants { // Policy public static final String DATAHUB_POLICY_INFO_ASPECT_NAME = "dataHubPolicyInfo"; - //Tag + // Tag public static final String TAG_KEY_ASPECT_NAME = "tagKey"; public static final String TAG_PROPERTIES_ASPECT_NAME = "tagProperties";