Methods for inferring the meaning of database fields
By combining knowledge base and machine learning technology to infer unknown Chinese meanings of database fields, the problem of lack of annotations in database fields is solved, accurate data understanding and governance is achieved, and the efficiency of system upgrades and data analysis is improved.
Patent Information
- Application Number
- CN202110239741.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-04
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-03-04
AI Technical Summary
Problems such as lack of annotations, incomplete documentation, and unused database fields in the information system lead to difficulties in system upgrades and transformations, data governance, and data analysis, and waste a lot of manpower and material resources.
By combining knowledge base and machine learning technology, unknown Chinese meanings of database fields are inferred, user marks confirm accuracy, and custom writing is provided to influence recommendation accuracy.
Effectively obtain the true meaning of unknown fields, make good preliminary work for data governance, and improve recommendation accuracy and data utilization efficiency.
Smart Images

Figure CN113032360B
Abstract
Description
Technical Field
[0001] The present invention specifically relates to a method for inferring the meaning of a database field. Background Art
[0002] In today's highly information-based society, all kinds of enterprises and institutions have various information systems. However, due to various reasons, the databases in these information systems may have various problems such as lack of annotations in database fields, incomplete database documents, and unused database fields. These problems will lead to difficulties in system upgrades and transformations, data governance, data analysis, and system use. Many business systems have to be overturned and rebuilt because of such problems, wasting a lot of manpower, material resources, and social resources.
[0003] The present invention uses various methods to infer the Chinese meaning of unknown fields in the database itself, and can confirm the accuracy of the inference of these unknown fields through user markings, providing a new solution to the above problem and having great social significance. Summary of the invention
[0004] The purpose of the present invention is to provide a method for inferring the meaning of a database field in view of the deficiencies in the prior art. The method for inferring the meaning of a database field can well solve the above-mentioned problem.
[0005] In order to achieve the above requirements, the technical solution adopted by the present invention is: to provide a method for inferring the meaning of a database field, the method for inferring the meaning of a database field comprises the following steps:
[0006] S1: Summarize the common field knowledge base and obtain three common annotations of common field names and the scores of the annotations;
[0007] S2: Determine whether the field is in English or English-like. If it is in English or English-like, the meaning of the field is its Chinese translation.
[0008] S3: Determine the similarity between the field without Chinese annotation and other fields with Chinese annotation in the same database. Fields with high similarity have the same meaning;
[0009] S4: different Chinese annotations and their scores are obtained according to the above method;
[0010] S5: Select the true meaning of this field based on the recommended results. If none of the above results are within the user's selection range, the user can write custom text. The user-marked results will affect the accuracy of future recommendations.
[0011] The advantages of this method of inferring the meaning of database fields are as follows:
[0012] This method combines knowledge base and machine learning technology, and uses multiple methods to guess the unknown Chinese annotations of fields. It can better obtain the true meaning of unknown fields and do a good job in preliminary work for the next step of data governance. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The same reference numerals are used in these drawings to represent the same or similar parts. The exemplary embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0014] Figure 1 The flowchart according to one embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0015] In order to make the objectives, technical solutions and advantages of the present application more clear, the present application is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0016] In the following description, references to "one embodiment", "an embodiment", "an example", "an example", etc. indicate that the embodiment or example described in this way may include specific features, structures, characteristics, properties, elements or limitations, but not every embodiment or example necessarily includes the specific features, structures, characteristics, properties, elements or limitations. In addition, repeated use of the phrase "according to one embodiment of the present application" may refer to the same embodiment, but does not necessarily refer to the same embodiment.
[0017] For the sake of simplicity, certain technical features well known to those skilled in the art are omitted in the following description.
[0018] According to an embodiment of the present application, a method for inferring the meaning of a database field is provided, such as Figure 1 As shown, the specific steps of the present invention are as follows:
[0019] S1 summarizes the common field knowledge base and obtains three common annotations of common field names and the scores of the annotations.
[0020] S1.1 Obtain a batch of common database metadata information, uniformly process the database fields into uppercase, and retain the fields with Chinese annotations, including fields Z1, Z2...Zi. Establish a mapping table between fields and Chinese annotations. As shown in Table 1:
[0021] Field name (ignore case) Chinese Notes Z1 Name Z1 name Z1 Student Name Z2 gender Z3 gender Z4 Faculty Z4 School .... ....
[0022] Table 1
[0023] S1.2 A field may have multiple Chinese annotations. For example, if field Zx has n Chinese annotations {x1, x2, x3...xn}, then the n Chinese annotations are statistically sorted according to the number of times they appear, and the top three Chinese annotations are retained and assigned scores of a1, a2, and a3 (a1>a2>a3) respectively.
[0024] S1.3 traverses all fields according to the rules of S1.2, so that the fields with Chinese annotations retain n (n<=3) Chinese meanings, and each Chinese meaning has a corresponding score.
[0025] S1.4 uses this method to obtain the Chinese meanings of i fields and the scores corresponding to each Chinese meaning, and these data are used as a knowledge base.
[0026] S1.5 If there is a database with a field without Chinese annotation, the field name can be used to match the corresponding name in the knowledge base, and the corresponding n Chinese meanings and their scores can be found. This inference method is recorded as method A.
[0027] S2. Determine whether a field is in English or similar to English. If it is in English or similar to English, the meaning of the field may be its Chinese translation.
[0028] S2.1 obtains a batch of common database metadata information and uniformly capitalizes the database fields, including fields Z1, Z2, ... Zi. Use code to determine whether these fields are English words. If they are English words, use the online translation API to obtain their translated Chinese meanings.
[0029] S2.2 A field may have multiple Chinese translations. For example, field Z1 has n Chinese translations {x1, x2, x3…xn}. Then, the n Chinese annotations are statistically sorted according to the number of times they appear, and the top three Chinese annotations are retained, and their scores are assigned as b1, b2, b3 (b1>b2>b3).
[0030] S2.3 If there is a database with a field without Chinese annotations, the above method obtains Chinese annotations and the scores of Chinese annotations for these fields. This method is recorded as method B.
[0031] S3 determines the similarity between a field without Chinese annotations and other fields with Chinese annotations in the same database. Fields with high similarity may have the same meaning. For example, the fields id1 and id both represent primary keys.
[0032] S3.1 obtains a field Z1 without Chinese annotations and processes it as uppercase, and a field Z2 with Chinese annotations and processes it as uppercase, and obtains the number of edits of the two through the edit distance. The more times, the smaller the similarity value. The edit distance between the two is D1, and the edit distance calculation method is as follows:
[0033] The Levenshtein distance between two strings a and b is expressed as lev a,b (|a|,|b|), where |a| and |b| correspond to the lengths of a and b respectively. So, here the Levenshtein distance of the two strings a and b is a,b (|a|, |b|) can be described in the following mathematical language:
[0034]
[0035] The above formula is explained in detail as follows:
[0036] Definition of lev a,b (i, j) refers to the distance between the first i characters in a and the first j characters in b. For ease of understanding, i and j here can be regarded as the length. The first character index of the string here starts at 1 (actually because the string needs to be padded with 0 when calculating on the table), so the final edit distance is the distance when i equals the absolute value of a and j equals the absolute value of b: lev a,b (|a|, |b|).
[0037] When min(i, j) = 0, it corresponds to the first i characters in string a and the first j characters in string b. At this time, one of i and j has a value of 0, indicating that one of strings a and b is an empty string. Then, to switch from a to b, only max(i, j) single-character editing operations are required, so the editing distance between them is max(i, j), which is the maximum of i and j.
[0038] S3.2 Z1 calculates the edit distance with all fields with Chinese annotations in the same database, and obtains a set of edit distances {D1, D2, D3…Dn}. Sort the n edit distances from small to large, retain the fields and their Chinese annotations corresponding to the top three edit distances, and assign them values c1, c2, c3 (c1>c2>c3).
[0039] S3.3 If there is a database with a field without Chinese annotations, the above method obtains Chinese annotations and the weights of Chinese annotations for these fields. This method is recorded as method C.
[0040] S4. Given a field Zx with unknown Chinese meaning, different Chinese annotations and scores are obtained according to the above different methods.
[0041] S4.1 Method A obtains a1, a2, a3; method B obtains b1, b2, b3; method C obtains c1, c2, c3.
[0042] S4.2 According to the effectiveness of methods A, B, and C, weights {x, y, z}∈(0, 1) are assigned to methods A, B, and C respectively. The score of method A should be multiplied by its weight, such as a1x, a2x, a3x; the same applies to methods B and C.
[0043] S4.3 Sort the scores of the Chinese annotations obtained for field Zx according to methods A, B, and C. The order of the sorted Chinese annotations represents the likelihood of the Chinese meaning of this field, and recommendations are made to users based on this sorting and score.
[0044] S5 users select the true meaning of this field based on the recommended results. If the above results are not within the user's selection range, the user can write custom words. The results marked by the user will affect the accuracy of future recommendations.
[0045] S5.1 If a field with the same name in multiple databases is marked as a Chinese annotation or a customized Chinese annotation more than n times, then the mapping between this Chinese annotation and this field is placed in the knowledge base of method A.
[0046] S5.2 If a field is customized to a certain name, then the customized writing will be placed in the knowledge base of Party A, and the score will be set to the lowest score among all mapped Chinese annotations of the current field.
[0047] According to one embodiment of the present application, the method for inferring the meaning of a database field uses multiple methods to comprehensively evaluate the correct meaning of an unknown field. At the same time, the user confirms that the recommended Chinese meaning of the field can improve the accuracy of future recommendations, and uses the clipping distance to determine the similarity of the database fields, thereby inferring their Chinese meanings.
[0048] The above-mentioned embodiments only represent several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the claims.
Claims
1. A method for inferring the meaning of a database field, characterized in that: The steps include: S1: Summarize the common field knowledge base and obtain three common annotations of common field names and the scores of the annotations; S2: Determine whether the field is in English or English-like. If it is in English or English-like, the meaning of the field is its Chinese translation. S3: Determine the similarity between the field without Chinese annotation and other fields with Chinese annotation in the same database. Fields with high similarity have the same meaning; S4: different Chinese annotations and their scores are obtained according to the above method; S5: Select the true meaning of this field based on the recommended results. If none of the above results are within the user's selection range, the user can write a custom field. The user-marked results will affect the accuracy of future recommendations. S1: Summarize common field knowledge bases, obtain three common annotations of common field names and the scores of the annotations, specifically including the following steps: S1.1: Obtain database metadata information, convert database fields into uppercase, retain fields with Chinese annotations, including fields Z1, Z2…Zi, and establish a mapping table between fields and Chinese annotations; S1.2: If a field has multiple Chinese annotations, the Chinese annotations are sorted according to the number of occurrences. The top three Chinese annotations are retained and assigned scores of a1, a2, and a3 respectively, and a1 is greater than a2 and greater than a3; S1.3: Traverse all fields according to the rules of step S1.2, and let the fields with Chinese annotations retain n Chinese meanings, where n is less than or equal to 3, and each Chinese meaning has a corresponding score; S1.4: Obtain the Chinese meanings of the i fields and the scores corresponding to each Chinese meaning through the above steps, and use these data as a knowledge base; If there is a database with a field without Chinese annotation, the field name is matched with the corresponding name in the knowledge base, and the corresponding Chinese meaning and score are found. This inference method is recorded as method A. Step S2: Determine whether the field is in English or English-like. If it is in English or English-like, the meaning of the field is its Chinese translation, which specifically includes the following steps: S2.1: Obtain database metadata information, uniformly capitalize the database fields, including fields Z1, Z2…Zi, and use code to determine whether these fields are English words. If they are English words, translate them and obtain their translated Chinese meanings; S2.2: If a field has multiple Chinese translations, then the n Chinese annotations are sorted according to the number of times they appear, and the top three Chinese annotations are retained, and their scores are assigned as b1, b2, and b3, and b1 is greater than b2 and b3; if there is a database with a field without Chinese annotations, the above method obtains Chinese annotations and their scores for these fields, and this method is recorded as method B; Step S3: Determine the similarity between the field without Chinese annotation and other fields with Chinese annotation in the same database. The fields with high similarity have the same meaning. The specific steps are as follows: S3.1: Get a field Z1 without Chinese annotations and process it in uppercase, and a field Z2 with Chinese annotations and process it in uppercase. Get the number of edits between the two through the edit distance. The more times, the smaller the similarity value. The edit distance between the two is D1. The edit distance calculation method is as follows: ; Refers to the distance between the first i characters in a and the first j characters in b; S3.2: Z1 calculates the edit distance with all the fields with Chinese annotations in the same database, and obtains a set of edit distances {D1, D2, D3…Dn}. Sort the n edit distances from small to large, and keep the fields and their Chinese annotations corresponding to the top three edit distances, assigning them values of c1, c2, and c3, and c1 is greater than c2 and greater than c3; if there is a field without Chinese annotations in the database, the above method obtains Chinese annotations and the weights of Chinese annotations for these fields, and this method is recorded as method C; Step S4: different Chinese annotations and their scores are obtained according to the above method, as follows: S4.1: Method A obtains a1, a2, a3; Method B obtains b1, b2, b3; Method C obtains c1, c2, c3; S4.2: According to the effectiveness of methods A, B, and C, weights {x, y, z}∈(0, 1) are assigned to methods A, B, and C respectively; S4.3: Sort the scores of the Chinese annotations obtained by methods A, B, and C. The order of the sorted Chinese annotations represents the possibility of the Chinese meaning of the field. Recommendations are made to users based on the sorting and scores. Select the true meaning of this field based on the recommended results. If none of the above results are within the user's selection range, the user can write custom text. The user-marked results will affect the accuracy of future recommendations. The specific steps are as follows: S5.1: If a field with the same name in multiple databases is marked as a Chinese annotation or a custom Chinese annotation more than n times, put the mapping between this Chinese annotation and this field into the knowledge base of method A; S5.2: If a field is customized to a certain name, then the custom-written name is placed in the knowledge base of method A, and the score is set to the lowest score among all mapped Chinese annotations of the current field.
