Metadata management method and device, electronic equipment and storage medium
By processing target SQL statements through word segmentation and using a heterogeneous bipartite graph model to obtain contextual information of metadata, the problem of metadata type discrimination and complex relationship capture in the existing technology is solved, and efficient metadata management is achieved.
Patent Information
- Application Number
- CN202311749439.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-18
- Publication Date
- 2024-10-18
AI Technical Summary
Existing metadata management methods cannot perform type discrimination based on contextual information of target metadata, and cannot capture the intricate relationships between metadata.
By obtaining the target SQL statement, perform word segmentation processing to obtain metadata information, use the first cascade context-aware heterogeneous bipartite graph model to obtain latent factor classes based on local and global context information, and construct the second cascade context-aware heterogeneous bipartite graph model. Graph models to train and classify metadata.
It realizes the classification management of target metadata, improves the efficiency of metadata management, and can effectively capture the complex relationships between metadata.
Smart Images

Figure CN118796952A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of big data technology, and in particular to a metadata management method, device, electronic device and storage medium. Background Art
[0002] The metadata management method in the related art often uses similarity analysis method to classify and manage metadata. It is impossible to distinguish the type of target metadata based on the context information of the target metadata. At the same time, it is unable to capture the complex relationship between existing metadata. Summary of the invention
[0003] The present disclosure provides a metadata management method, device, electronic device and storage medium to solve the problems in the related art.
[0004] A first aspect of the present disclosure provides a metadata management method, the method comprising:
[0005] Obtaining a target structured query language (SQL) statement, where the target SQL statement is used to represent user requirements;
[0006] Perform word segmentation on the target SQL statement to obtain metadata information contained in the target SQL statement;
[0007] Based on the metadata information contained in the target SQL statement, local context information and global context information of the target metadata corresponding to the metadata information are obtained; the local context information is used to indicate the local latent factors in the target SQL statement, and the global context information is used to indicate the global latent factors in the database corresponding to the target SQL statement, and the local latent factors and the global latent factors are represented in the form of fields;
[0008] Based on local latent factors and global latent factors, the first-level context-aware heterogeneous bipartite graph model is used to obtain latent factor classes associated with the target metadata; latent factor classes refer to the categories divided by all latent factors corresponding to the database, and the categories are related to user needs.
[0009] In one embodiment, before obtaining latent factor classes associated with target metadata using a first cascade context-aware heterogeneous bipartite graph model based on local latent factors and global latent factors, the method provided by the present disclosure further includes:
[0010] Constructing a second-level context-aware heterogeneous bipartite graph model;
[0011] A training set is obtained, and a second-level cascade context-aware heterogeneous bipartite graph model is trained using the training set to obtain a first-level cascade context-aware heterogeneous bipartite graph model.
[0012] In one embodiment, constructing a second cascade context-aware heterogeneous bipartite graph model includes:
[0013] Based on at least one historical SQL statement corresponding to the historical demand of at least one user, obtaining historical target metadata, local context information of the historical target metadata, and global context information of the historical target metadata for each historical SQL statement;
[0014] Based on the historical target metadata of each historical SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed;
[0015] Compare the local context information of the historical target metadata corresponding to two adjacent historical requirements and the global context information of the historical target metadata;
[0016] In response to the presence of identical local context information and / or global context information in the local context information of the historical target metadata corresponding to two adjacent historical demands and the global context information of the historical target metadata, the historical target metadata corresponding to the two adjacent historical demands are associated to construct a second cascade context-aware heterogeneous bipartite graph model.
[0017] In one embodiment, a training set is obtained, and a second cascade context-aware heterogeneous bipartite graph model is trained using the training set to obtain a first cascade context-aware heterogeneous bipartite graph model, including:
[0018] Based on at least one historical SQL statement corresponding to the historical demand of at least one user, obtaining historical target metadata, local context information of the historical target metadata, and global context information of the historical target metadata for each historical SQL statement;
[0019] Classify the local latent factors contained in the local context information of all historical SQL statements and the preset categories of the global latent factors contained in the global context information;
[0020] Taking the historical target metadata, local context information of the historical target metadata and global context information of the historical target metadata of each historical SQL statement as input, and taking the classification as output to construct a training set;
[0021] The training set is used to train the second-stage context-aware heterogeneous bipartite graph model to obtain the first-stage context-aware heterogeneous bipartite graph model.
[0022] In one embodiment, based on the historical target metadata of each historical SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed, including:
[0023] Based on the local context information of the historical target metadata, the local context information of the historical target metadata is mapped to the same feature space to obtain a feature vector of the local context information of the historical target metadata after mapping;
[0024] Based on the global context information of the historical target metadata, the global context information of the historical target metadata is mapped to the same feature space to obtain a feature vector of the global context information of the historical target metadata after mapping;
[0025] Based on the feature vector of the local context information of the mapped historical target metadata and the feature vector of the global context information of the mapped historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed.
[0026] In one embodiment, based on the metadata information included in the target SQL statement, obtaining the local context information of the target metadata corresponding to the metadata information includes:
[0027] In response to a target SQL statement corresponding to a single table, or multiple corresponding tables being associated in a join manner, obtaining latent factors of fields following a select statement of the target SQL statement and conditional latent factors of fields following a where statement;
[0028] The latent factors of the fields following the select statement and the conditional latent factors of the fields following the where statement are combined to obtain the local context information of the target metadata corresponding to the metadata information.
[0029] In one embodiment, before obtaining local context information of target metadata corresponding to the metadata information based on the metadata information included in the target SQL statement, the method provided by the present disclosure further includes:
[0030] Parse the target SQL statement after word segmentation processing, and build a syntax tree corresponding to the target SQL statement after word segmentation processing.
[0031] A second aspect of the present disclosure provides a metadata management device, the device comprising:
[0032] A first acquisition unit acquires a target SQL statement, where the target SQL statement is used to represent the user's needs;
[0033] The word segmentation unit performs word segmentation processing on the target SQL statement to obtain metadata information contained in the target SQL statement;
[0034] The second acquisition unit acquires local context information and global context information of the target metadata corresponding to the metadata information based on the metadata information included in the target SQL statement; the local context information is used to indicate the local latent factor in the target SQL statement, and the global context information is used to indicate the global latent factor in the database corresponding to the target SQL statement, and the local latent factor and the global latent factor are represented in the form of fields;
[0035] The third acquisition unit, based on the local latent factors and the global latent factors, uses the first cascade context-aware heterogeneous bipartite graph model to acquire latent factor classes associated with the target metadata; the latent factor classes refer to the categories into which all latent factors corresponding to the database are divided, and the categories are related to the needs of the users.
[0036] A third aspect of the present disclosure provides an electronic device, including:
[0037] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the embodiment of the first aspect of the present disclosure.
[0038] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.
[0039] In summary, the present disclosure proposes a method, which includes: obtaining a target SQL statement, where the target SQL statement is used to characterize user needs; performing word segmentation processing on the target SQL statement to obtain metadata information contained in the target SQL statement; based on the metadata information contained in the target SQL statement, obtaining local context information and global context information of the target metadata corresponding to the metadata information; the local context information is used to indicate the local latent factors in the target SQL statement, and the global context information is used to indicate the global latent factors in the database corresponding to the target SQL statement, and the local latent factors and the global latent factors are represented in the form of fields; based on the local latent factors and the global latent factors, a first-level cascade context-aware heterogeneous bipartite graph model is used to obtain a latent factor class associated with the target metadata; the latent factor class refers to the category into which all latent factors corresponding to the database are divided, and the category is related to the user's needs.
[0040] Through the scheme provided by the present disclosure, after the processor obtains the target SQL statement, it performs word segmentation processing on the target SQL statement, thereby obtaining the metadata information contained in the target SQL statement; based on the metadata information contained in the target SQL statement, the processor obtains the local context information and global context information of the target metadata corresponding to the metadata information; based on the local context information and global context information of the target metadata, the processor uses the first cascade context-aware heterogeneous bipartite graph model to obtain the latent factor class associated with the target metadata. The scheme provided by the present disclosure performs word segmentation processing on the target SQL statement through the processor, thereby obtaining the metadata information contained in the target SQL statement. Based on the metadata information contained in the target SQL statement, the processor obtains the local context information and global context information of the target metadata corresponding to the metadata information, and uses the first cascade context-aware heterogeneous bipartite graph model to obtain the latent factor class associated with the target metadata. Thereby, the classified management of the target metadata is realized, and the efficiency of target metadata management is improved.
[0041] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0043] Figure 1 A flowchart of a metadata management method provided by an embodiment of the present disclosure;
[0044] Figure 2 A schematic diagram of the structure of a metadata heterogeneous bipartite graph fusion model provided in an embodiment of the present disclosure;
[0045] Figure 3 A schematic diagram of the metadata cascade model structure provided in an embodiment of the present disclosure;
[0046] Figure 4 A schematic diagram of a process of obtaining a training set provided in an embodiment of the present disclosure, using the training set to train a second cascade context-aware heterogeneous bipartite graph model, and obtaining a first cascade context-aware heterogeneous bipartite graph model;
[0047] Figure 5 A schematic diagram of a process for constructing a heterogeneous bipartite graph model corresponding to each historical demand based on historical target metadata of each historical SQL statement, local context information of the historical target metadata, and global context information of the historical target metadata provided in an embodiment of the present disclosure;
[0048] Figure 6A schematic diagram of the structure of a metadata management device provided in an embodiment of the present disclosure;
[0049] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0050] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0051] The metadata management method in the related art often uses similarity analysis method to classify and manage metadata. It is impossible to distinguish the type of target metadata based on the context information of the target metadata. At the same time, it is unable to capture the complex relationship between existing metadata.
[0052] In related technologies, several common metadata management solutions are as follows:
[0053] Solution A: Store files to obtain file metadata, extract semantic information of files, and use semantic information to construct semantic metadata; use the semantic connection between file metadata and semantic metadata to construct a metadata graph; use the metadata graph to organize and manage metadata and provide intelligent services. The present invention constructs a metadata graph, uses the rich file metadata and semantic information of the metadata graph to organize and manage metadata, and provides intelligent services.
[0054] Solution B: After obtaining metadata from multiple businesses, establish a relationship graph of metadata objects; determine whether there are common metadata objects and metadata object attributes in the same metamodel in the relationship graph of metadata objects. If so, obtain the structural similarity of the metadata graph based on the similarity of the vertices and vertex attributes of the structure and the edges in the relationship graph of metadata objects; determine the association relationship between multiple businesses based on the structural similarity of the metadata graph.
[0055] Solution C: Obtain the source information of the metadata in each node of the database; determine the association relationship and association degree between each node according to the source information of the metadata in each node; construct a relationship network according to each node and the association relationship between each node, the edge in the relationship network is the association relationship between each node, and the weight of the edge in the relationship network is the association degree between nodes with association relationship; use the particle swarm algorithm to divide the relationship network to obtain multiple sub-relationship networks, where each sub-relationship network is a group.
[0056] The above solution has the following defects:
[0057] First, by constructing a metadata graph, metadata is organized and managed based on semantic relationships, and the metadata graph is clustered through classic algorithms such as Gauss-Newton (GN) and K-Means, which facilitates organizational management and intelligent services. However, GN and K-Means are classic unsupervised methods and cannot capture the complex relationships between different categories of existing metadata, time series, and different metadata on the metadata link.
[0058] Second, metadata is simply divided into multiple categories at different granularities through the empirical knowledge of the metadata system logic layer, and metadata is assigned to different meta-models according to the defined categories.
[0059] Third, in the grouping management of metadata, a more intelligent approach has not been considered, especially as metadata categories are complex and each metadata may be in a different category due to contextual reasons.
[0060] In order to solve at least one defect in the related art, the present disclosure provides a metadata management method. After the processor obtains the target SQL statement, it performs word segmentation processing on the target SQL statement to obtain the metadata information contained in the target SQL statement; the processor obtains the local context information and global context information of the target metadata corresponding to the metadata information based on the metadata information contained in the target SQL statement; the processor uses the first cascade context-aware heterogeneous bipartite graph model to obtain the latent factor class associated with the target metadata based on the local context information and global context information of the target metadata. The solution provided by the present disclosure performs word segmentation processing on the target SQL statement by the processor to obtain the metadata information contained in the target SQL statement. Based on the metadata information contained in the target SQL statement, the processor obtains the local context information and global context information of the target metadata corresponding to the metadata information, and uses the first cascade context-aware heterogeneous bipartite graph model to obtain the latent factor class associated with the target metadata. Thereby, the classified management of the target metadata is realized, and the efficiency of the target metadata management is improved.
[0061] The present disclosure is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] like Figure 1 As shown, the metadata management method provided by the embodiment of the present disclosure includes the following steps:
[0063] Step 101, obtaining a target SQL statement, where the target SQL statement is used to represent the user's needs;
[0064] In one embodiment, the target SQL statement refers to the SQL statement used when the user sends a request for adding, deleting, modifying, or checking to the target database.
[0065] In one embodiment, user needs may be divided into different categories, such as query requests for data of different categories.
[0066] Step 102, performing word segmentation processing on the target SQL statement to obtain metadata information contained in the target SQL statement;
[0067] In one embodiment, a word segmentation tool may be used to perform word segmentation processing on the target SQL statement to obtain metadata information included in the target SQL statement.
[0068] In one embodiment, after performing word segmentation processing on the target SQL statement using an analysis tool, target metadata included in the target SQL statement is obtained.
[0069] In one embodiment, after the target SQL statement is segmented using an analysis tool, uncommon metadata in the target metadata may be deleted.
[0070] Step 103: Based on the metadata information included in the target SQL statement, local context information and global context information of the target metadata corresponding to the metadata information are acquired.
[0071] In one embodiment, the local context information is used to indicate the local latent factors in the target SQL statement.
[0072] In one embodiment, the global context information is used to indicate the global latent factors in the database corresponding to the target SQL statement.
[0073] In one embodiment, the local latent factors and the global latent factors are represented in the form of fields.
[0074] In one embodiment, based on the metadata information included in the target SQL statement, obtaining the global context information of the target metadata corresponding to the metadata information includes:
[0075] The metadata information contained in the target SQL statement is mapped with all metadata in the target database to obtain metadata in the target database to which the metadata information contained in the target SQL statement can be mapped, and the metadata in the target database is used as global context information of the target metadata corresponding to the metadata information.
[0076] In one embodiment, mapping information between metadata information included in the target SQL statement and all metadata in the target database may be reflected by a mapping relationship table.
[0077] In one embodiment, based on the metadata information included in the target SQL statement, obtaining the local context information of the target metadata corresponding to the metadata information includes:
[0078] In response to a target SQL statement corresponding to a single table, or multiple corresponding tables being associated in a join manner, obtaining latent factors of fields following a select statement of the target SQL statement and conditional latent factors of fields following a where statement;
[0079] The latent factors of the fields following the select statement and the conditional latent factors of the fields following the where statement are combined to obtain the local context information of the target metadata corresponding to the metadata information.
[0080] In one embodiment, before obtaining local context information of target metadata corresponding to the metadata information based on the metadata information included in the target SQL statement, the method provided by the present disclosure further includes:
[0081] Parse the target SQL statement after word segmentation processing, and build a syntax tree corresponding to the target SQL statement after word segmentation processing.
[0082] Accordingly, in one embodiment, based on the metadata information included in the target SQL statement, obtaining the local context information of the target metadata corresponding to the metadata information includes:
[0083] Based on the syntax tree corresponding to the target SQL statement after word segmentation, determine whether the target SQL statement corresponds to a single table, or whether multiple corresponding tables are associated in a join manner;
[0084] In response to the judgment result being yes, obtaining the latent factors of the fields following the select statement of the target SQL statement and the conditional latent factors of the fields following the where statement;
[0085] The latent factors of the fields following the select statement and the conditional latent factors of the fields following the where statement are combined to obtain the local context information of the target metadata corresponding to the metadata information.
[0086] Step 104, based on the local latent factors and the global latent factors, the first cascade context-aware heterogeneous bipartite graph model is used to obtain the latent factor class associated with the target metadata; the latent factor class refers to the category divided by all latent factors corresponding to the database, and the category is related to the user's needs.
[0087] In summary, the metadata management method provided by the present disclosure includes: obtaining a target SQL statement, where the target SQL statement is used to characterize user needs; performing word segmentation processing on the target SQL statement to obtain metadata information contained in the target SQL statement; based on the metadata information contained in the target SQL statement, obtaining local context information and global context information of the target metadata corresponding to the metadata information; the local context information is used to indicate the local latent factors in the target SQL statement, and the global context information is used to indicate the global latent factors in the database corresponding to the target SQL statement, and the local latent factors and the global latent factors are represented in the form of fields; based on the local latent factors and the global latent factors, a first-level cascade context-aware heterogeneous bipartite graph model is used to obtain a latent factor class associated with the target metadata; the latent factor class refers to the category into which all latent factors corresponding to the database are divided, and the category is related to the user's needs.
[0088] Through the scheme provided by the present disclosure, after the processor obtains the target SQL statement, it performs word segmentation processing on the target SQL statement, thereby obtaining the metadata information contained in the target SQL statement; based on the metadata information contained in the target SQL statement, the processor obtains the local context information and global context information of the target metadata corresponding to the metadata information; based on the local context information and global context information of the target metadata, the processor uses the first cascade context-aware heterogeneous bipartite graph model to obtain the latent factor class associated with the target metadata. The scheme provided by the present disclosure performs word segmentation processing on the target SQL statement through the processor, thereby obtaining the metadata information contained in the target SQL statement. Based on the metadata information contained in the target SQL statement, the processor obtains the local context information and global context information of the target metadata corresponding to the metadata information, and uses the first cascade context-aware heterogeneous bipartite graph model to obtain the latent factor class associated with the target metadata. Thereby, the classified management of the target metadata is realized, and the efficiency of target metadata management is improved.
[0089] In one embodiment, the above step 104 includes:
[0090] Constructing a second-level context-aware heterogeneous bipartite graph model;
[0091] In one embodiment, the first cascade context-aware heterogeneous bipartite graph model refers to a trained second cascade context-aware heterogeneous bipartite graph model.
[0092] In one embodiment, the first cascade context-aware heterogeneous bipartite graph model is used to characterize the corresponding relationship between the metadata included in the target SQL statement and the latent factors in the corresponding target database.
[0093] A training set is obtained, and a second-level cascade context-aware heterogeneous bipartite graph model is trained using the training set to obtain a first-level cascade context-aware heterogeneous bipartite graph model.
[0094] In one embodiment, the training set can be obtained from the historical demand. Specifically, the input of the training set includes the historical target metadata of the historical SQL statement corresponding to at least one historical demand, the local context information of the historical target metadata, and the global context information of the historical target metadata. The output of the training set includes classification, and the classification refers to the classification of the local latent factors contained in the local context information of all historical SQL statements and the global latent factors contained in the global context information into preset categories.
[0095] In one embodiment, constructing a second cascade context-aware heterogeneous bipartite graph model includes:
[0096] Based on at least one historical SQL statement corresponding to the historical demand of at least one user, obtaining historical target metadata, local context information of the historical target metadata, and global context information of the historical target metadata for each historical SQL statement;
[0097] In one embodiment, based on at least one historical SQL statement corresponding to the historical needs of at least one user, the method for obtaining the historical target metadata, the local context information of the historical target metadata, and the global context information of the historical target metadata of each historical SQL statement can adopt the methods of step 101 and step 102, which will not be repeated here.
[0098] Based on the historical target metadata of each historical SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed;
[0099] In one embodiment, the bipartite graph of historical demand 1 and historical demand 2 is as follows: Figure 2 shown.
[0100] In one embodiment, each historical requirement is a requirement node, and the historical target metadata of the corresponding SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata are field nodes, forming a 1*N bipartite graph.
[0101] In one embodiment, the field corresponding to the historical demand refers to a field corresponding to the historical target metadata, local context information of the historical target metadata, or global context information of the historical target metadata.
[0102] Compare the local context information of the historical target metadata corresponding to two adjacent historical requirements and the global context information of the historical target metadata;
[0103] In one embodiment, if Figure 2 As shown, in the 1*N bipartite graph corresponding to historical demand 1 and historical demand 2, field n of historical demand 1 is the same as field 1 of historical demand 2.
[0104] In response to the presence of identical local context information and / or global context information in the local context information of the historical target metadata corresponding to two adjacent historical demands and the global context information of the historical target metadata, the historical target metadata corresponding to the two adjacent historical demands are associated to construct a second cascade context-aware heterogeneous bipartite graph model.
[0105] In one embodiment, if Figure 2 As shown in FIG. 1 , field n of historical requirement 1 is the same as field 1 of historical requirement 2, so the historical target metadata corresponding to historical requirement 1 and historical requirement 2 can be associated. Specifically, the historical target metadata corresponding to historical requirement 1 and historical requirement 2 can be associated through the same field node (field n of historical requirement 1 and field 1 of historical requirement 2). Specifically, Figure 3 shown.
[0106] In one embodiment, if Figure 4 As shown, a training set is obtained, and a second-level cascade context-aware heterogeneous bipartite graph model is trained using the training set to obtain a first-level cascade context-aware heterogeneous bipartite graph model, including:
[0107] Step 401, based on at least one historical SQL statement corresponding to a historical demand of at least one user, obtaining historical target metadata, local context information of the historical target metadata, and global context information of the historical target metadata of each historical SQL statement;
[0108] In one embodiment, based on at least one historical SQL statement corresponding to the historical needs of at least one user, the method for obtaining the historical target metadata, the local context information of the historical target metadata, and the global context information of the historical target metadata of each historical SQL statement can adopt the methods of step 101 and step 102, which will not be repeated here.
[0109] Step 402, classifying the local latent factors included in the local context information of all historical SQL statements and the preset categories of the global latent factors included in the global context information;
[0110] In one embodiment, the preset category may be a category set according to user needs.
[0111] In one embodiment, the preset categories may be user income categories, user height categories, and the like.
[0112] In one embodiment, the local latent factors and global latent factors corresponding to the user income category may be latent factors related to user conditions, such as age, gender, etc. The local latent factors and global latent factors corresponding to the user height category may be latent factors related to user conditions, such as age, gender, etc.
[0113] Step 403, taking the historical target metadata of each historical SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata as input, and taking the classification as output to construct a training set;
[0114] Step 404 : train the second cascade context-aware heterogeneous bipartite graph model using the training set to obtain the first cascade context-aware heterogeneous bipartite graph model.
[0115] In one embodiment, if Figure 5 As shown, based on the historical target metadata of each historical SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed, including:
[0116] Step 501, based on the local context information of the historical target metadata, mapping the local context information of the historical target metadata to the same feature space, to obtain a feature vector of the local context information of the mapped historical target metadata;
[0117] In one embodiment, historical user needs are represented by U, and the fields of historical target metadata, local context information of historical target metadata, and global context information of historical target metadata corresponding to the historical user needs are represented by V, where V is a set and contains at least one field.
[0118] In one embodiment, the mathematical expression for mapping the local context information of the historical target metadata to the same feature space is:
[0119] w′ v =M*w v ;
[0120] Among them, w v Represents the local context information before mapping, w′ v The feature vector representing the local context information of the historical target metadata after mapping, and M represents the mapping function.
[0121]
[0122] in, represents the i-th field corresponding to the local context information before mapping, and N represents the number of all fields included in the local context information before mapping.
[0123] Therefore, the feature vector of the local context information of the mapped historical target metadata is
[0124] Step 502, based on the global context information of the historical target metadata, mapping the global context information of the historical target metadata to the same feature space, to obtain a feature vector of the global context information of the mapped historical target metadata;
[0125] In one embodiment, the global context information of the historical target metadata may include more than one dimension, that is, include multiple fields corresponding to the global context information. Therefore, it is necessary to map the multiple fields corresponding to the global context information to the feature space of the dimension.
[0126] Specifically, the top k fields among the fields corresponding to the multiple global context information may be extracted.
[0127] In one embodiment, an attention mechanism algorithm may be used to obtain the weight of each field corresponding to a plurality of global context information fields, and generate a weight matrix.
[0128] In one embodiment, the top k fields from among the fields corresponding to the multiple global context information may be extracted according to the weight of the field corresponding to each global context information.
[0129] Among them, the feature vector of the global context information of the mapped historical target metadata is The mathematical expression is:
[0130]
[0131] Step 503 : construct a heterogeneous bipartite graph model corresponding to each historical demand based on the feature vector of the local context information of the mapped historical target metadata and the feature vector of the global context information of the mapped historical target metadata.
[0132] In one embodiment, the heterogeneous bipartite graph model UV corresponding to each historical demand i The mathematical expression is:
[0133]
[0134] in,
[0135] In order to implement the metadata management method provided by the embodiment of the present disclosure, the embodiment of the present disclosure also provides a metadata management device, such as Figure 6 shown. Figure 6 The metadata management device 600 is a schematic diagram of the structure of the metadata management device provided in the embodiment of the present disclosure, and includes:
[0136] A first acquisition unit 601 acquires a target SQL statement, where the target SQL statement is used to represent the user's needs;
[0137] The word segmentation unit 602 performs word segmentation processing on the target SQL statement to obtain metadata information contained in the target SQL statement;
[0138] The second acquisition unit 603 acquires local context information and global context information of the target metadata corresponding to the metadata information based on the metadata information included in the target SQL statement; the local context information is used to indicate the local latent factor in the target SQL statement, and the global context information is used to indicate the global latent factor in the database corresponding to the target SQL statement, and the local latent factor and the global latent factor are represented in the form of fields;
[0139] The third acquisition unit 604 acquires latent factor classes associated with the target metadata based on the local latent factors and the global latent factors using the first cascade context-aware heterogeneous bipartite graph model; the latent factor classes refer to the categories into which all latent factors corresponding to the database are divided, and the categories are related to the needs of the user.
[0140] In one embodiment, the metadata management device 600 further includes a second construction unit, and the second construction unit is used to:
[0141] Constructing a second-level context-aware heterogeneous bipartite graph model;
[0142] In one embodiment, the metadata management device 600 further includes a training unit, which is used to:
[0143] A training set is obtained, and a second-level cascade context-aware heterogeneous bipartite graph model is trained using the training set to obtain a first-level cascade context-aware heterogeneous bipartite graph model.
[0144] In one embodiment, the second obtaining unit 603 is specifically configured to:
[0145] Based on at least one historical SQL statement corresponding to the historical demand of at least one user, obtaining historical target metadata, local context information of the historical target metadata, and global context information of the historical target metadata for each historical SQL statement;
[0146] In one embodiment, the second building block is specifically used for:
[0147] Based on the historical target metadata of each historical SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed;
[0148] In one embodiment, the metadata management device 600 further includes a comparison unit, which is used to:
[0149] Compare the local context information of the historical target metadata corresponding to two adjacent historical requirements and the global context information of the historical target metadata;
[0150] In one embodiment, the second building block is specifically used for:
[0151] In response to the presence of identical local context information and / or global context information in the local context information of the historical target metadata corresponding to two adjacent historical demands and the global context information of the historical target metadata, the historical target metadata corresponding to the two adjacent historical demands are associated to construct a second cascade context-aware heterogeneous bipartite graph model.
[0152] In one embodiment, the second building block is specifically used for:
[0153] Based on at least one historical SQL statement corresponding to the historical demand of at least one user, obtaining historical target metadata, local context information of the historical target metadata, and global context information of the historical target metadata for each historical SQL statement;
[0154] In one embodiment, the metadata management device 600 further includes a classification unit, which is used to:
[0155] Classify the local latent factors contained in the local context information of all historical SQL statements and the preset categories of the global latent factors contained in the global context information;
[0156] Taking the historical target metadata, local context information of the historical target metadata and global context information of the historical target metadata of each historical SQL statement as input, and taking the classification as output to construct a training set;
[0157] The training set is used to train the second-stage context-aware heterogeneous bipartite graph model to obtain the first-stage context-aware heterogeneous bipartite graph model.
[0158] In one embodiment, the third obtaining unit 604 is specifically configured to:
[0159] Based on the local context information of the historical target metadata, the local context information of the historical target metadata is mapped to the same feature space to obtain a feature vector of the local context information of the historical target metadata after mapping;
[0160] Based on the global context information of the historical target metadata, the global context information of the historical target metadata is mapped to the same feature space to obtain a feature vector of the global context information of the historical target metadata after mapping;
[0161] In one embodiment, the second building block is specifically used for:
[0162] Based on the feature vector of the local context information of the mapped historical target metadata and the feature vector of the global context information of the mapped historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed.
[0163] In one embodiment, the second obtaining unit 603 is specifically configured to:
[0164] In response to a target SQL statement corresponding to a single table, or multiple corresponding tables being associated in a join manner, obtaining latent factors of fields following a select statement of the target SQL statement and conditional latent factors of fields following a where statement;
[0165] The latent factors of the fields following the select statement and the conditional latent factors of the fields following the where statement are combined to obtain the local context information of the target metadata corresponding to the metadata information.
[0166] In one embodiment, the metadata management device 600 further includes a first construction unit, and the first construction unit is used to:
[0167] Parse the target SQL statement after word segmentation processing, and build a syntax tree corresponding to the target SQL statement after word segmentation processing.
[0168] It should be noted that: the metadata management device provided in the above embodiment only uses the division of the above program modules as an example to illustrate when performing metadata management. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the metadata management device is divided into different program modules to complete all or part of the above-described processing. In addition, the metadata management device provided in the above embodiment and the metadata management method embodiment provided in the embodiment of the present disclosure belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0169] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure is shown in FIG. Figure 7 As shown, the electronic device 700 includes at least one processor 702; and a memory 701 communicatively connected to the at least one processor 702; wherein the memory 701 stores instructions that can be executed by the at least one processor 702, and the instructions are executed by the at least one processor 702 to implement the steps of the metadata management method of the embodiment of the present disclosure.
[0170] Optionally, the electronic device may specifically be a metadata management device in an embodiment of the present application, and the electronic device may implement the corresponding processes implemented by the metadata management device in each method in the embodiment of the present application, which will not be described in detail here for the sake of brevity.
[0171] It is understood that the electronic device also includes a communication interface 703. The various components in the electronic device are coupled together through a bus system 704. It is understood that the bus system 704 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 704 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 7 Various buses are labeled as bus system 704 .
[0172] It can be understood that the memory 701 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 701 described in the embodiment of the present invention is intended to include but is not limited to these and any other suitable types of memories.
[0173] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 702, or implemented by the processor 702. The processor 702 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 702 or an instruction in the form of software. The above processor 702 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 702 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. A general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present invention, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 701, and the processor 702 reads the information in the memory 701 and completes the steps of the above method in combination with its hardware.
[0174] In an exemplary embodiment, the electronic device may be implemented by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), FPGAs, general purpose processors, controllers, MCUs, microprocessors, or other electronic components to execute the aforementioned method.
[0175] The disclosed embodiment also provides a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to enable a computer to implement the steps of the metadata management method of the embodiment of the present invention when executed.
[0176] Optionally, the computer-readable storage medium can be applied to the metadata management device in the embodiment of the present application, and the computer instructions enable the computer to execute the corresponding processes implemented by the metadata management device in the various methods of the embodiment of the present application. For the sake of brevity, they are not repeated here.
[0177] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0178] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0179] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0180] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.
[0181] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0182] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A metadata management method, characterized in that: include: Obtaining a target SQL statement, where the target SQL statement is used to represent a user's needs; Perform word segmentation processing on the target SQL statement to obtain metadata information contained in the target SQL statement; Based on the metadata information included in the target SQL statement, obtaining local context information and global context information of the target metadata corresponding to the metadata information; The local context information is used to indicate the local latent factor in the target SQL statement, and the global context information is used to indicate the global latent factor in the database corresponding to the target SQL statement, and the local latent factor and the global latent factor are represented in the form of fields; Based on the local latent factors and the global latent factors, a first cascade context-aware heterogeneous bipartite graph model is used to obtain a latent factor class associated with the target metadata; the latent factor class refers to a category into which all latent factors corresponding to the database are divided, and the category is related to user needs.
2. The method according to claim 1, characterized in that Before acquiring the latent factor class associated with the target metadata by using the first cascade context-aware heterogeneous bipartite graph model based on the local latent factors and the global latent factors, the method further includes: Constructing a second-level context-aware heterogeneous bipartite graph model; A training set is obtained, and a second-level cascade context-aware heterogeneous bipartite graph model is trained using the training set to obtain a first-level cascade context-aware heterogeneous bipartite graph model.
3. The method according to claim 2, characterized in that The constructing of the second cascade context-aware heterogeneous bipartite graph model includes: Based on at least one historical SQL statement corresponding to the historical demand of at least one user, obtaining historical target metadata, local context information of the historical target metadata, and global context information of the historical target metadata for each historical SQL statement; Based on the historical target metadata of each historical SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed; Compare the local context information of the historical target metadata corresponding to two adjacent historical requirements and the global context information of the historical target metadata; In response to the presence of identical local context information and / or global context information in the local context information of the historical target metadata corresponding to the two adjacent historical demands and the global context information of the historical target metadata, the historical target metadata corresponding to the two adjacent historical demands are associated to construct a second cascade context-aware heterogeneous bipartite graph model.
4. The method according to claim 2, characterized in that: The step of obtaining a training set and using the training set to train a second-level cascade context-aware heterogeneous bipartite graph model to obtain a first-level cascade context-aware heterogeneous bipartite graph model includes: Based on at least one historical SQL statement corresponding to the historical demand of at least one user, obtaining historical target metadata, local context information of the historical target metadata, and global context information of the historical target metadata for each historical SQL statement; Classifying the local latent factors included in the local context information of all historical SQL statements and the global latent factors included in the global context information into preset categories; Taking the historical target metadata, local context information of the historical target metadata and global context information of the historical target metadata of each historical SQL statement as input, and taking the classification as output to construct a training set; The training set is used to train the second-stage context-aware heterogeneous bipartite graph model to obtain the first-stage context-aware heterogeneous bipartite graph model.
5. The method according to claim 3, characterized in that: The process of constructing a heterogeneous bipartite graph model corresponding to each historical requirement based on the historical target metadata of each historical SQL statement, the local context information of the historical target metadata, and the global context information of the historical target metadata includes: Based on the local context information of the historical target metadata, mapping the local context information of the historical target metadata to the same feature space to obtain a feature vector of the mapped local context information of the historical target metadata; Based on the global context information of the historical target metadata, mapping the global context information of the historical target metadata to the same feature space to obtain a feature vector of the global context information of the mapped historical target metadata; Based on the feature vector of the local context information of the mapped historical target metadata and the feature vector of the global context information of the mapped historical target metadata, a heterogeneous bipartite graph model corresponding to each historical demand is constructed.
6. The method according to claim 1, characterized in that The acquiring, based on the metadata information included in the target SQL statement, local context information of the target metadata corresponding to the metadata information includes: In response to the target SQL statement corresponding to a single table, or the corresponding multiple tables being associated in a join manner, obtaining latent factors of fields following a select statement of the target SQL statement, and conditional latent factors of fields following a where statement; The latent factors of the fields following the select statement and the conditional latent factors of the fields following the where statement are combined to obtain the local context information of the target metadata corresponding to the metadata information.
7. The method according to claim 1, characterized in that Before acquiring the local context information of the target metadata corresponding to the metadata information based on the metadata information included in the target SQL statement, the method further includes: The target SQL statement after the word segmentation processing is parsed, and a syntax tree corresponding to the target SQL statement after the word segmentation processing is constructed.
8. A device, characterized in that: include: A first acquisition unit acquires a target SQL statement, where the target SQL statement is used to represent a user's needs; A word segmentation unit performs word segmentation processing on the target SQL statement to obtain metadata information contained in the target SQL statement; A second acquisition unit, based on the metadata information included in the target SQL statement, acquires local context information and global context information of target metadata corresponding to the metadata information; The local context information is used to indicate the local latent factor in the target SQL statement, and the global context information is used to indicate the global latent factor in the database corresponding to the target SQL statement, and the local latent factor and the global latent factor are represented in the form of fields; A third acquisition unit acquires a latent factor class associated with the target metadata based on the local latent factors and the global latent factors using a first cascade context-aware heterogeneous bipartite graph model; the latent factor class refers to a category into which all latent factors corresponding to the database are divided, and the category is related to user needs.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Multi-modal data retrieval method and device, storage medium and computer equipment
CN121051286A
