A method for interactive table data transformation based on declarative mapping
This interactive tabular data transformation method based on declarative mapping solves the problems of data transformation efficiency and accuracy, achieving efficient and unambiguous data transformation, providing flexible workflows and real-time feedback, and is suitable for fields such as financial statements, scientific research experiments, and enterprise data analysis.
Patent Information
- Application Number
- CN202210981995.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-16
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-08-16
AI Technical Summary
Existing data transformation methods are inadequate in terms of efficiency and accuracy, especially in complex transformation tasks where they are time-consuming and difficult to fully express user intent and explore multiple transformation methods.
An interactive table data transformation method based on declarative mapping is adopted. By constructing a mapping model, data attributes are mapped to rows, columns and cell channels. The mapping method is defined using formulas (1) and (2). Table examples are constructed by combining drag and drop and typing text, generating and visualizing the target data table, and recommending a variety of table variations.
It achieves efficient and unambiguous data transformation, can adapt to various data needs, provides flexible workflows, provides real-time feedback on transformation results, helps users explore multiple transformation methods, and avoids the inefficiency of traditional methods and the insufficient expression of intent in existing systems.
Smart Images

Figure CN115391437B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of data conversion, and particularly relates to a method for interactive table data conversion based on declarative mapping. BACKGROUND
[0002] In the process of data analysis and decision making, it is very important to transform source data into a comprehensible form. However, this data conversion process is often tedious, difficult and time-consuming. According to statistics, this process may account for up to 80% of the time in data analysis.
[0003] Generally speaking, data conversion is usually performed by editing data entries one by one. This method is obviously not suitable for larger data sets. High-level users may choose to write scripts to convert data in batches, and this process usually calls some additional data processing libraries. However, it takes a lot of time and effort to learn to write such scripts, so it is very challenging. In addition, most of these scripts are written for specific data sets, and there is often a great lack of promotion.
[0004] In recent years, the emergence of many interactive systems enables general users to efficiently complete data conversion. These systems usually provide a variety of data operations (such as aggregation, filtering, splitting, etc.), and can recommend the next data operation in real time to help subsequent data conversion. However, this step-by-step recommendation is not suitable for complex conversion tasks, as it will make data conversion lengthy and time-consuming.
[0005] To solve this problem, some systems use a method of converting based on examples. This method automatically recommends a series of integrated operations based on the examples of data conversion provided by the user. For example, when the user changes the cell with the value "John Smith" in the data table to "Smith, John", a set of operations that can exchange the first two strings and insert a comma in the middle is obtained. Although this kind of example-based conversion method improves the recommendation quality, it still has great limitations. Specific limitations include:
[0006] First, the user needs to be able to provide high-quality examples without ambiguity, otherwise the user's intention may be misunderstood, resulting in inaccurate recommendations or excessive computational overhead. In addition, this method requires the user to have a clear understanding of the goal of data conversion. However, in some specific cases where the user does not have a clear goal, such as finding a suitable table form that is easy to understand, this example-based method cannot help the user explore the results of different conversion methods well, so it is difficult to help them find the real conversion goal.
[0007] In summary, in view of the current data conversion requirements, there is an urgent need for an interactive data conversion system that can fully express user intent, save time and be efficient, and help users explore possible conversion methods. SUMMARY
[0008] In view of the above, the purpose of the present application is to provide an interactive table data conversion method based on declarative mapping, which is suitable for various data conversion requirements through a data conversion model based on declarative mapping.
[0009] To achieve the above-mentioned purpose of the application, an embodiment provides a method for interactive table data conversion based on declarative mapping, comprising the following steps:
[0010] (a1) constructing a mapping model based on declarative mapping;
[0011] (a2) obtaining data to be converted, and converting the data to be converted into a relational data table form, extracting data attributes in the data and visualizing them;
[0012] (a3) constructing a table mapping for data attributes based on the mapping mode in the mapping model based on declarative mapping, and generating a data target table and visualizing it according to the table mapping;
[0013] (a4) performing a variant on the data target table to generate a series of data variant tables and visualize them for recommendation to the user.
[0014] To achieve the above-mentioned purpose of the application, another embodiment provides a method for interactive table data conversion based on declarative mapping, comprising the following steps:
[0015] (b1) constructing a mapping model based on declarative mapping;
[0016] (b2) obtaining data to be converted, and converting the data to be converted into a relational data table form, extracting data attributes in the data and visualizing them;
[0017] (b3) the user dragging the data in the relational data table obtained in step (b2) to an empty target table, or entering text in a cell of the empty target table according to the data, to construct a table example;
[0018] (b4) generating a table mapping according to the table example, combining the mapping model based on declarative mapping and generating a data target table and visualizing it according to the table mapping;
[0019] (b5) performing a variant on the data target table to generate a series of data variant tables and visualize them for recommendation to the user.
[0020] Preferably, the mapping model based on declarative mapping is described as:
[0021] The relational data table is input to the mapping model of the declarative mapping as a source table, in the source table, each column is called a single original data attribute, and each cell in each column contains the value of the data attribute. The set of values of all cells in each column becomes the value set of the data attribute;
[0022] The target table is represented as three channels: row, column, and cell. Based on this representation, the source table instance is modeled as a mapping of data to three channels, which is formally defined as:
[0023] table:=(row),(column)→(cell) (1)
[0024] row|column|cell:=var (2)
[0025] In formula (1), the original data attribute in the source table is mapped to the row, column, and cell channels in the target table table. In formula (2), the row, column, and cell in the table are all data attributes var.
[0026] When a new data attribute is needed by performing one or more data operations on existing data attributes, the new data attribute is defined as:
[0027] Var’=f(var) (3)
[0028] Where Var’ represents the new data attribute, and f(·) represents the conversion function corresponding to the data operation.
[0029] When multiple data attributes need to be mapped to the same channel of the target table, new data attributes are generated using formulas (4) and (5):
[0030] var:=var×var (4)
[0031] var:=var+var (5)
[0032] Where formula (4) is used to generate the Cartesian product of data attributes mapped to the row or column of the target table, and formula (5) is used to connect multiple data attributes and map them to the cell of the target table to represent multi-dimensional data.
[0033] To ensure that the formal definition shown in formula (1) corresponds to a meaningful and unique target table, the following two rules are required for a legal formal definition:
[0034] At least one of the row and column channels in formula (1) is non-empty.
[0035] When both row and column channels in formula (1) are non-empty, formula (5) cannot be used to generate new data attributes.
[0036] Preferably, the conversion function comprises:
[0037] The function union(A, B) is represented as: connecting two data attributes A, B and their corresponding relations.
[0038] The function ascsort(A) is represented as: ascending order arrangement of the values of data attribute A.
[0039] The function descsort(A) is represented as: descending order arrangement of the values of data attribute A.
[0040] The function concat(A) is represented as: concatenating the values of data attribute A into a string in order.
[0041] The function filterByBound(A, l, r) is represented as: filtering the values of data attribute A according to the interval [l, r), which is only applicable to quantitative data attributes.
[0042] The function filterByValue(A, a1, a 2, …) is represented as: filtering the values of data attribute A according to the specified values a1, a 2, …, which is only applicable to qualitative data attributes.
[0043] The function split(A, pattern)[index] is represented as: regarding each value of data attribute A as a string, splitting it according to the characters or strings represented by the parameter pattern to obtain a string array (each element of the array does not contain the characters or strings represented by the parameter pattern itself), and taking the string corresponding to the index parameter index (starting from 0) in the obtained array, for example, the value of data attribute A is [“aa,bb,cc”], split(A, ‘,’)[0] represents that the value of data attribute A, i.e. the string “aa,bb,cc”, is split according to the comma character ‘,’ to obtain a string array [“aa”, “bb”, “cc”], and the string at index 0, i.e. “aa”, is taken.
[0044] The function sum(A) is represented as: summing the values of data attribute A, which is only applicable to quantitative data attributes.
[0045] The function average(A) is represented as: averaging the values of data attribute A, which is only applicable to quantitative data attributes.
[0046] count(A) represents the number of different values of data attribute A.
[0047] bin(A, l, r, step) represents the interval [l, r] is divided into step sub-intervals, each of which has the same length, and these sub-intervals are returned. This function is only applicable to quantitative data attributes; when parameters l and r are omitted, the interval to be divided is the value domain of data attribute A.
[0048] Preferably, the step (a2) and the step (b2) each comprises:
[0049] Obtaining the data to be converted, when the data is not in the form of a data table, converting the data into the form of a data table, and checking whether the data table is in the form of a relational data table, and visualizing the relational data table;
[0050] Defining a data attribute for each column in the relational data table, and the values contained in all cells in the column form a value set, which is presented to the user in the form of a histogram or a bar chart.
[0051] Preferably, in the step (a3), the user uses a drag-and-drop or marking method to map the data attribute to the row, column or cell channel of the empty target table, to explicitly indicate the desired table mapping. Based on the explicit indication, a mapping model based on declarative mapping is used to construct the table mapping of the data attribute in the relational data table to the target table according to the mapping method defined in formulas (1) and (2), and then a data target table is generated based on the table mapping and visualized and presented to the user.
[0052] Preferably, the step (b3) comprises:
[0053] The user drags the value of a cell in the relational data table to the cell of the empty target table to construct a table example.
[0054] The user drags a data attribute (i.e. a group of data values) in the relational data table into the empty target table. If the user drags the data attribute to the left edge of the cell in the empty target table, the values of the data attribute are arranged in the row in which the cell is located from left to right. If the user drags the data attribute to the top edge of the cell in the empty target table, the values of the data attribute are arranged in the column in which the cell is located from top to bottom, to construct a table example.
[0055] The user directly enters text in the empty target table, and an automatic completion function is provided, i.e. according to the entered text, the user is recommended with the matching cell values in the relational data table, to construct a table example.
[0056] Preferably, step (b4) comprises:
[0057] To disambiguate the table examples to generate corresponding table mappings and merge the table mappings with the table mappings obtained in the previous round, including: in each round, the user needs to determine the data attribute, the channel to which the data attribute is mapped, and the possible data operation to construct a mapping from the table example, the following uses a heuristic algorithm to help the user determine the three parts, first, the drag operation directly determines the data attribute that the user wants, and typing text into a cell may bring multiple selectable data attributes, because the typed text may appear in the value range of multiple data attributes, then, enumerate all possible channels to which the data attribute is mapped, finally, when a quantitative data attribute is mapped to a row or column channel, recommend using the partition value interval operation on the data attribute, in addition, if a mapping will result in multiple values in the same cell, recommend that the user use the aggregation operation to combine the values to improve the readability of the table.
[0058] In merging the mappings, the attribute values are merged in the manner presented in equations (4) and (5) in the mapping model based on declarative mapping.
[0059] Preferably, step (a4) and step (b5) each comprise:
[0060] Enumerate the data attributes in the existing table mappings, map these data attributes to different table channels to explore alternative table variants, and recommend the following three representative table variants: a table without a row channel, a table without a column channel, and a cross table containing both row and column channels.
[0061] Enumerate and add unused data attributes to obtain more table variants to enrich the current table.
[0062] Preferably, the method further comprises: the user applies a conversion function in the mapping model based on declarative mapping to a specified data attribute to generate a new data attribute.
[0063] Compared with the prior art, the present application has at least the following beneficial effects:
[0064] The method for interactive table data conversion based on the declarative mapping provided by the embodiment can efficiently and unambiguously convert relational data used in various fields or data that can be converted into a table form of relational data into a data form required by a user through a mapping model of the declarative mapping constructed, can be widely applied to various fields such as financial statement making, scientific research experiment data processing, enterprise data analysis, and the like, avoids the problem of low efficiency of using a traditional table tool (such as Microsoft Excel) or manually writing a script, and also avoids the problem of insufficient expression of user intention and existence of ambiguity in the existing interactive table data conversion system. In addition, the method for interactive table data conversion based on the declarative mapping provided by the embodiment provides a flexible and efficient workflow, can feed back a result of data conversion to a user in real time, helps the user to discover problems in time, and the recommendation mechanism in the method can also help the user to systematically explore possible data conversion without an explicit data conversion intention. BRIEF DESCRIPTION OF DRAWINGS
[0065] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0066] Figure 1 is a flowchart of the method for interactive table data conversion based on the declarative mapping provided by the embodiment;
[0067] Figure 2 is a flowchart of another method for interactive table data conversion based on the declarative mapping provided by the embodiment;
[0068] Figure 3 is a data conversion schematic diagram of the mapping model based on the declarative mapping provided by the embodiment. DETAILED DESCRIPTION
[0069] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and do not limit the protection scope of the present application.
[0070] In view of the problems in the background art, the method for interactive table data conversion based on the declarative mapping provided by the embodiment can realize an interactive data conversion method that can express user intention, save time and be efficient, and can help users to explore possible conversion methods
[0071] As Figure 1As shown, the embodiment provides a method for interactive table data transformation based on declarative mapping, comprising the following steps:
[0072] Step a1, constructing a mapping model based on declarative mapping.
[0073] In the embodiment, the mapping model based on declarative mapping constructed is described as:
[0074] Taking a relational data table as a source table input to the mapping model of declarative mapping, in the source table, each column is called a single original data attribute, and each cell in each column contains the numerical value of the data attribute. The set of numerical values of all cells in each column becomes the value set of the data attribute;
[0075] The target table is represented as three channels: row, column and cell. Based on this representation, the source table instance is modeled as a mapping of data to the three channels, which is formally defined as:
[0076] table:=(row),(column)→(cell) (1)
[0077] row|column|cell:=var (2)
[0078] Wherein, formula (1) is understood as mapping the original data attribute in the source table to the row row, column column and cell cell three channels in the target table table, and formula (2) is understood as that the row row, column column and cell cell in the table are all data attributes var;
[0079] For example, assuming that the source table is as shown in (1) of Figure 3 , representing the GDP values of some states in the United States in some years, containing three original data attributes Year, State and GDP, Figure 3 The target table shown in (2) can be modeled as mapping the three original data attributes Year, State and GDP to the row, column and cell channels of the target table, respectively. Therefore, in the table shown in Figure 3 (2), each row represents a year, each column represents a state, and each cell represents the GDP value of the corresponding state in the corresponding year.
[0080] In the mapping model based on declarative mapping, the data attribute, which can represent the original data attribute in the source table, can also be a new data attribute obtained by performing a number of data operations on one or more existing data attributes. That is, when a new data attribute is needed to be obtained by performing a number of data operations on one or more existing data attributes, the new data attribute is defined as:
[0081] Var’=f(var) (3)
[0082] Where Var' represents the new data attribute, and f(·) represents the transformation function corresponding to the data operation; the specific mapping functions are shown in Table 1:
[0083] Table 1 Data Conversion Functions
[0084]
[0085]
[0086] In the declarative mapping model, when multiple data attributes need to be mapped to the same channel of the target table, new data attributes are generated using formulas (4) and (5):
[0087] var:=var×var (4)
[0088] var:=var+var (5)
[0089] Formula (4) is used to generate the Cartesian product of data attributes and map it to the rows or columns of the target table. Formula (5) is used to connect multiple data attributes and map them to the cells of the target table to represent multidimensional data.
[0090] For example, such as Figure 3 The table in (1) can also be formally written as (Year × State), () → (GDP), because the table can be seen as mapping the two attributes Year and State to the rows of the table, with each row corresponding to a combination of a year and a state. The attribute GDP is mapped to the cells of the table, representing the GDP value of the corresponding state in the corresponding year. Formula (5) is used to connect multiple attributes and map them to the cell channels of the table to represent multidimensional data. For example, suppose the input data includes Figure 3 Zhong (1) and Figure 3 The table shown in (3) represents the GDP and population of several US states in specific years. Figure 3 The table in (4) can be formally written as (Year×State), ()→(GDP+Population), which maps the two data attributes of GDP and Population to the cells of the table at the same time. Therefore, the GDP and population values of the corresponding state in the corresponding year are displayed in the same row.
[0091] To ensure that the target table corresponding to the formal definition shown in formula (1) is meaningful and unique, a valid formal definition must satisfy the following two rules:
[0092] In formula (1), at least one of the row and column channels must be non-empty;
[0093] When both row and column channels in formula (1) are non-empty, formula (5) cannot be used to generate new data attributes.
[0094] In step a2, the data to be converted is obtained, and the data to be converted is converted into a relational data table form, and the data attributes in the data are extracted and visualized.
[0095] In the embodiment, first, the data to be converted is obtained, when the data is not in the form of a data table, such as JSON data exchange form, the data is converted into a data table form, and after checking whether the data table form is a relational data table form, the relational data table form is visualized; then, each column in the relational data table is defined as a data attribute, and all cells in the column contain a value set, and the value set is presented to the user in the form of a column chart or a histogram.
[0096] In step a2, the user can also apply a conversion function in the mapping model based on declarative mapping to a specified data attribute to generate a new data attribute. This process can be implemented in any step of the method for interactive table data conversion based on declarative mapping.
[0097] In step a3, the mapping mode in the mapping model based on declarative mapping is used to construct table mapping of the data attribute, and the data target table is generated based on the table mapping and visualized.
[0098] In step a3, the user uses drag and drop or marking and other methods to map the data attribute to the row, column or cell channel of the empty target table to explicitly indicate the desired table mapping. If so, based on the explicit indication, the mapping mode defined in formula (1) and (2) in the mapping model based on declarative mapping is used to construct the table mapping of the data attribute in the relational data table to the target table, and then the data target table is generated based on the table mapping and visualized and presented to the user.
[0099] In step a4, the data target table is subjected to variation to generate a series of data variation tables and visualized and recommended to the user.
[0100] In an embodiment, the data attributes in the existing mapping are enumerated first, and these data attributes are mapped to different table channels to explore alternative table variants. Considering the need to balance between the exhaustiveness of the search and the diversity of the search results, the method only recommends three representative table variants, which are the table without row channel, the table without column channel, and the cross table containing both row and column channels. For example, for the mapping (A), (B)→(C), Rigel will recommend (A x B), ()→(C) and (), (A x B)→(C) to help the user think and optimize the mapping. Other alternative tables, such as (B x A), ()→(C), will not be recommended, because it can be obtained by simply manually fine-tuning the order of data attributes in the target table row channel.
[0101] In an embodiment, it is also possible to enumerate and add unused data attributes to obtain more table variants to enrich the current table. For example, when the unused data attribute D is to be added to the current table mapping (A x B), ()→(C), the new table mapping is (A x B), ()→(C+D).
[0102] Step a5, the user previews the recommended table variants, selects and applies the most suitable one; or the user can also choose to return to step a3 to provide more hints for conversion needs.
[0103] Step a6, the steps a2 to a5 are repeated in a loop until the user obtains a satisfactory target table.
[0104] Specifically, when the user obtains a satisfactory target table, the user can choose to export the target table into a common table file format (such as csv).
[0105] Based on the same inventive concept, as shown in Figure 2 The embodiment provides a method for interactive table data conversion based on declarative mapping, which comprises the following steps:
[0106] Step b1, constructing a mapping model based on declarative mapping.
[0107] Step b1 and step a1 construct the same mapping model based on declarative mapping, which will not be repeated here.
[0108] Step b2, obtaining the data to be converted, and converting the data to be converted into a relational data table form, extracting data attributes in the data and visualizing.
[0109] Step b2 and step a2 implement the same process, which will not be repeated here.
[0110] Step b3, the user drags the data in the relational data table obtained in step b2 into the empty target table, or enters text in the cells of the empty target table according to the data, to construct the table example.
[0111] In the step b3 of the embodiment, the user drags the value of a cell in the relational data table to the cell in the empty target table, to construct the table example.
[0112] The user drags a data attribute (i.e. a set of data values) in the relational data table into the empty target table, if the user drags the data attribute to the left edge of a cell in the empty target table, the values of the data attribute are arranged in the row of the cell from left to right, if the user drags the data attribute to the top edge of a cell in the empty target table, the values of the data attribute are arranged in the column of the cell from top to bottom, to construct the table example.
[0113] The user directly enters text in the empty target table, and an automatic completion function is provided, i.e. according to the entered text, the user is recommended with the matched cell values in the relational data table, to construct the table example.
[0114] Step b4, generating a table mapping according to the table example, combining the mapping model based on the declarative mapping, and generating a data target table according to the table mapping and visualizing.
[0115] In the b4 of the embodiment, the table example is disambiguated to generate a corresponding table mapping, and the table mapping is combined with the table mapping obtained in the last round, including: in each round, the user needs to determine the data attribute, the channel to which the data attribute is mapped, and the possible data operation to construct a mapping from the table example, the following uses a heuristic algorithm to help the user determine the three parts, first, the drag operation directly determines the data attribute that the user wants, and the text entered into the cell may bring multiple selectable data attributes, because the entered text may appear in the value range of multiple data attributes, then, all possible channels to which the data attribute is mapped are enumerated, for example, when the data is filled into a column of the target table in the operation, and the row and column channels are empty, the attribute is recommended to be mapped to the row channel. Finally, when a quantitative data attribute is mapped to the row or column channel, it is recommended to use the partition value interval operation on the data attribute, in addition, if a mapping will cause multiple values in the same cell, it is recommended that the user use the aggregation operation to combine the values, to improve the readability of the table.
[0116] In the merging of the mapping, the attribute value is merged in the manner presented in formula (4) and formula (5) in the mapping model based on the declarative mapping. For example, (A), ()→() and (), ()→(C) will be merged into (A), ()→(C).
[0117] Step b5, the data target table is mutated to generate a series of data variant tables and visualize the recommendations to the user.
[0118] The implementation process of step b5 is the same as that of step a4, which will not be repeated here.
[0119] Step b5, the user previews the recommended table variants, selects and applies the most suitable one; or the user can also choose to return to step b3 to provide more hints for conversion.
[0120] Step b7, repeat steps b2 to b6 until the user is satisfied with the target table.
[0121] The method for interactive table data conversion based on declarative mapping provided by the above embodiment can be applied to various fields such as financial statement making, scientific research experimental data processing, and enterprise data analysis. When applied to financial statement making, commonly used relational data tables such as sales statistics table, payroll table, and inventory table can be converted into the desired report form; when applied to scientific research experimental data processing, experimental data tables containing records of several experiments can be converted into the form after summary statistics, thereby facilitating experimental result analysis; when applied to the field of enterprise data analysis, enterprise revenue data, enterprise database data, or relational data in a self-built data platform can be converted into the desired form according to actual needs to obtain useful analysis conclusions.
[0122] The specific embodiments described above have detailed the technical solutions and beneficial effects of the present application. It should be understood that the above description is only the most preferred embodiment of the present application and is not intended to limit the present application. Any modifications, supplements, and equivalent replacements made within the principle range of the present application shall be included in the protection scope of the present application.
Claims
1. A method for interactive tabular data transformation based on declarative mapping, characterized in that, Includes the following steps: (a1) Construct a mapping model based on declarative mapping, which is described as: A mapping model that uses a relational data table as the source table input to a declarative mapping. In the source table, each column is called a single raw data attribute, and each cell in the column contains the value of the data attribute. The set of values of all cells in each column is called the set of values of the data attribute. The target table is represented as three channels: rows, columns, and cells. Based on this representation, the source table instance is modeled as a mapping from data to these three channels, formally defined as: table := ( row ) , ( column ) → ( cell ) (1) row | column | cell := var (2) Formula (1) can be understood as mapping the original data attributes in the source table to the target table. table line row ,List column and cells cell Three channels, formula (2) can be understood as rows in the table. row ,List column and cells cell All are data attributes var ; When a new data attribute needs to be obtained by performing several data operations on one or more existing data attributes, the new data attribute is defined as: Var'= f ( var ) (3) in, Var' Indicates a new data attribute. f (·) represents the conversion function corresponding to the data operation; When multiple data attributes need to be mapped to the same channel of the target table, new data attributes are generated using formulas (4) and (5): var := var × var (4) var := var + var (5) Formula (4) is used to generate the Cartesian product of data attributes and map it to the rows or columns of the target table. Formula (5) is used to connect multiple data attributes and map them to the cells of the target table to represent multidimensional data. To ensure that the target table corresponding to the formal definition shown in formula (1) is meaningful and unique, a valid formal definition must satisfy the following two rules: In formula (1), at least one of the row and column channels must be non-empty; When both row and column channels in formula (1) are not empty, formula (5) cannot be used to generate new data attributes; (a2) Obtain the data to be transformed, convert it into a relational data table format, extract the data attributes from the data and visualize them; (a3) Based on the mapping method in the declarative mapping mapping model, construct a table mapping for data attributes, and generate and visualize the data target table according to the table mapping; (a4) Variant the target data table to generate a series of data variant tables and visualize them to recommend to the user.
2. The method for interactive tabular data transformation based on declarative mapping according to claim 1, characterized in that, The conversion function includes: The function union(A, B) means: to connect two data attributes A and B and their corresponding relationship; The function ascsort(A) means: sort the values of data attribute A in ascending order; The function `descsort(A)` means: sort the values of data attribute A in descending order; The function concat(A) means: concatenate the values of data attribute A in order into a single string; The function filterByBound(A, l, r) means: filter the values of data attribute A according to the interval [l, r), and it is only applicable to quantitative data attributes; The function filterByValue(A, a1, a2, …) means: filter the values of data attribute A according to the specified values a1, a2, …, and it is only applicable to qualitative data attributes; The function split(A, pattern)[index] means: treat each value of data attribute A as a string, split it according to the characters or strings represented by the parameter pattern to obtain a string array, and take the string with the index corresponding to the parameter index in the array. The function sum(A) is used to sum the values of data attribute A. It is only applicable to quantitative data attributes. The function average(A) means: calculate the average value of data attribute A, and it is only applicable to quantitative data attributes; The function count(A) is used to count the number of different values for data attribute A. The function bin(A, l, r, step) means: divide the interval [l, r] into step subintervals of equal length and return these subintervals. This function is only applicable to quantitative data attributes. When the parameters l and r are omitted, the divided interval is the value range of the data attribute A.
3. The method for interactive tabular data transformation based on declarative mapping according to claim 1, characterized in that, Step (a2) includes: Obtain the data to be converted. If the data is not in tabular format, convert it to tabular format and then check whether the data is in relational table format before visualizing the relational table. Define data attributes for each column in a relational data table. The values contained in all cells of a column form a set of values, which are then presented to the user in the form of a bar chart or histogram.
4. The method for interactive tabular data transformation based on declarative mapping according to claim 1, characterized in that, In step (a3), the user uses drag-and-drop or marking to map data attributes to rows, columns or cell channels of an empty target table to explicitly specify the desired table mapping. Based on this explicit specification, the mapping method defined in formulas (1) and (2) in the declarative mapping model is used to construct the table mapping from data attributes in the relational data table to the target table. Then, the data target table is generated based on the table mapping and presented to the user.
5. The method for interactive tabular data transformation based on declarative mapping according to claim 1, characterized in that, Step (a4) includes: Enumerate the data attributes in the existing table mappings and map these data attributes to different table channels to explore alternative table variants. The following three representative table variants are recommended: a table without row channels, a table without column channels, and a cross table that contains both row and column channels. Enumerate and add unused data attributes to get more table variations to enrich the current table.
6. The method for interactive tabular data transformation based on declarative mapping according to claim 1, characterized in that, Also includes: Users generate new data attributes by selecting transformation functions in a declarative mapping-based mapping model and applying them to specified data attributes.
7. A method for interactive tabular data transformation based on declarative mapping, characterized in that, Includes the following steps: (b1) Construct a mapping model based on declarative mapping, which is described as follows: A mapping model that uses a relational data table as the source table input to a declarative mapping. In the source table, each column is called a single raw data attribute, and each cell in the column contains the value of the data attribute. The set of values of all cells in each column is called the set of values of the data attribute. The target table is represented as three channels: rows, columns, and cells. Based on this representation, the source table instance is modeled as a mapping from data to these three channels, formally defined as: table := ( row ) , ( column ) → ( cell ) (1) row | column | cell := var (2) Formula (1) can be understood as mapping the original data attributes in the source table to the target table. table line row ,List column and cells cell Three channels, formula (2) can be understood as rows in the table. row ,List column and cells cell All are data attributes var ; When a new data attribute needs to be obtained by performing several data operations on one or more existing data attributes, the new data attribute is defined as: Var'= f ( var ) (3) in, Var' Indicates a new data attribute. f (·) represents the conversion function corresponding to the data operation; When multiple data attributes need to be mapped to the same channel of the target table, new data attributes are generated using formulas (4) and (5): var := var × var (4) var := var + var (5) Formula (4) is used to generate the Cartesian product of data attributes and map it to the rows or columns of the target table. Formula (5) is used to connect multiple data attributes and map them to the cells of the target table to represent multidimensional data. To ensure that the target table corresponding to the formal definition shown in formula (1) is meaningful and unique, a valid formal definition must satisfy the following two rules: In formula (1), at least one of the row and column channels must be non-empty; When both row and column channels in formula (1) are not empty, formula (5) cannot be used to generate new data attributes; (b2) Obtain the data to be transformed, convert it into a relational data table format, extract the data attributes from the data, and visualize them; (b3) The user drags and drops the data from the relational data table obtained in step (b2) into the empty target table, or enters text in the cells of the empty target table according to the data to build a table sample; (b4) Generate a table mapping based on the table sample, combine it with a mapping model based on declarative mapping, and generate and visualize the target data table based on the table mapping; (b5) Variant the target data table to generate a series of data variant tables and visualize them for users.
8. The method for interactive tabular data transformation based on declarative mapping according to claim 7, characterized in that, The conversion function includes: The function union(A, B) means: to connect two data attributes A and B and their corresponding relationship; The function ascsort(A) means: sort the values of data attribute A in ascending order; The function `descsort(A)` means: sort the values of data attribute A in descending order; The function concat(A) means: concatenate the values of data attribute A in order into a single string; The function filterByBound(A, l, r) means: filter the values of data attribute A according to the interval [l, r), and it is only applicable to quantitative data attributes; The function filterByValue(A, a1, a) 2, …), which means: the value of data attribute A is determined by the specified value a1, a 2, …Filtering is only applicable to qualitative data attributes; The function split(A, pattern)[index] means: treat each value of data attribute A as a string, split it according to the characters or strings represented by the parameter pattern to obtain a string array, and take the string with the index corresponding to the parameter index in the array. The function sum(A) is used to sum the values of data attribute A. It is only applicable to quantitative data attributes. The function average(A) means: calculate the average value of data attribute A, and it is only applicable to quantitative data attributes; The function count(A) is used to count the number of different values for data attribute A. The function bin(A, l, r, step) means: divide the interval [l, r] into step subintervals of equal length and return these subintervals. This function is only applicable to quantitative data attributes. When the parameters l and r are omitted, the divided interval is the value range of the data attribute A.
9. The method for interactive tabular data transformation based on declarative mapping according to claim 7, characterized in that, Each step (b2) includes: Obtain the data to be converted. If the data is not in tabular format, convert it to tabular format and then check whether the data is in relational table format before visualizing the relational table. Define data attributes for each column in a relational data table. The values contained in all cells of a column form a set of values, which are then presented to the user in the form of a bar chart or histogram.
10. The method for interactive tabular data transformation based on declarative mapping according to claim 7, characterized in that, Step (b3) includes: Users drag and drop the value of a cell from a relational data table into a cell in an empty target table to build a table template; When a user drags a data attribute from a relational data table into an empty target table, if the user drags the data attribute to the left edge of a cell in the empty target table, the value of the data attribute will be placed in the row containing that cell and arranged from left to right starting from the cell; if the user drags the data attribute to the top edge of a cell in the empty target table, the value of the data attribute will be placed in the column containing that cell and arranged from top to bottom starting from the cell, thus constructing a table example. Users can directly type text into an empty target table, and an auto-completion function is provided, which recommends matching cell values from a relational data table to the user based on the text entered, in order to build a table sample.
11. The method for interactive tabular data transformation based on declarative mapping according to claim 7, characterized in that, Step (b4) includes: The table sample is deambigued to generate the corresponding table mapping, and this table mapping is merged with the table mapping obtained in the previous round. This includes: In each round, the user needs to determine the data attribute, the channel to which the data attribute is mapped, and the possible data operations to construct a mapping from the table sample. The following uses a heuristic algorithm to help the user determine these three parts. First, the drag operation directly determines the data attribute that the user wants, while typing text into a cell may result in multiple selectable data attributes because the typed text may appear in the value range of multiple data attributes. Next, all possible channels to which the data attribute can be mapped are enumerated. Finally, when a quantitative data attribute is mapped to a row or column channel, it is recommended to use the value range operation for the data attribute. In addition, if a mapping will result in multiple values in the same cell, it is recommended that the user use the aggregation operation to merge these values to improve the readability of the table. When merging mappings, the attribute values are merged in the manner presented in formulas (4) and (5) of the declarative mapping mapping model.
12. The method for interactive tabular data transformation based on declarative mapping according to claim 7, characterized in that, Step (b5) includes: Enumerate the data attributes in the existing table mappings and map these data attributes to different table channels to explore alternative table variants. The following three representative table variants are recommended: a table without row channels, a table without column channels, and a cross table that contains both row and column channels. Enumerate and add unused data attributes to get more table variations to enrich the current table.
13. The method for interactive tabular data transformation based on declarative mapping according to claim 7, characterized in that, Also includes: Users generate new data attributes by selecting transformation functions in a declarative mapping-based mapping model and applying them to specified data attributes.