From 24dc67f484864cc5cf9d3d5e6b2c4e46abca7367 Mon Sep 17 00:00:00 2001 From: Lal Rishav <80503855+saxo-lalrishav@users.noreply.github.com> Date: Wed, 18 Aug 2021 07:39:24 +0530 Subject: [PATCH] feat(business-glossary): glossary term relationship graphql changes (#3103) --- .../datahub/graphql/GmsGraphQLEngine.java | 9 +++++++ .../src/main/resources/gms.graphql | 8 +++++- .../src/graphql/glossaryTerm.graphql | 26 ++++++++++++++++++- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java index 819952992738db..811dabcbd0058a 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java @@ -236,6 +236,7 @@ public static void configureRuntimeWiring(final RuntimeWiring.Builder builder) { configureTagAssociationResolver(builder); configureDataJobResolvers(builder); configureMLFeatureTableResolvers(builder); + configureGlossaryRelationshipResolvers(builder); } public static GraphQLEngine.Builder builder() { @@ -749,6 +750,14 @@ private static void configureMLFeatureTableResolvers(final RuntimeWiring.Builder ); } + private static void configureGlossaryRelationshipResolvers(final RuntimeWiring.Builder builder) { + builder.type("GlossaryTerm", typeWiring -> typeWiring + .dataFetcher("relationships", new AuthenticatedResolver<>( + new EntityRelationshipsResultResolver(GmsClientFactory.getRelationshipsClient()) + )) + ); + } + private static DataLoader> createDataLoader(final LoadableType graphType, final QueryContext queryContext) { BatchLoaderContextProvider contextProvider = () -> queryContext; diff --git a/datahub-graphql-core/src/main/resources/gms.graphql b/datahub-graphql-core/src/main/resources/gms.graphql index 4a5f71067024ba..778c1a0308caef 100644 --- a/datahub-graphql-core/src/main/resources/gms.graphql +++ b/datahub-graphql-core/src/main/resources/gms.graphql @@ -500,8 +500,14 @@ type GlossaryTermInfo { Properties of the glossary term """ customProperties: [StringMapEntry!] + + """ + Schema definition of glossary term + """ + rawSchema: String } + type DataPlatform implements Entity { """ Urn of the data platform @@ -939,7 +945,7 @@ type DownstreamEntityRelationships { type DataFlowDataJobsRelationships { entities: [EntityRelationshipLegacy] } - + type UpstreamLineage { """ List of upstream datasets diff --git a/datahub-web-react/src/graphql/glossaryTerm.graphql b/datahub-web-react/src/graphql/glossaryTerm.graphql index 713a6013c0c3b4..a58ebdb2578980 100644 --- a/datahub-web-react/src/graphql/glossaryTerm.graphql +++ b/datahub-web-react/src/graphql/glossaryTerm.graphql @@ -1,9 +1,33 @@ -query getGlossaryTerm($urn: String!) { +query getGlossaryTerm($urn: String!, $start: Int, $count: Int) { glossaryTerm(urn: $urn) { urn type name hierarchicalName + isRealtedTerms: relationships(types: ["IsA"], direction: OUTGOING, start: $start, count: $count) { + start + count + total + relationships { + entity { + ... on GlossaryTerm { + urn + } + } + } + } + hasRealtedTerms: relationships(types: ["HasA"], direction: OUTGOING, start: $start, count: $count) { + start + count + total + relationships { + entity { + ... on GlossaryTerm { + urn + } + } + } + } ownership { ...ownershipFields }