Data analysis method, system and storage medium based on tree structure dimension

By establishing a tree dimension structure diagram and related tables, and using a two-layer SQL query structure for data analysis, the flexibility and diversity of tree dimension data analysis in the existing technology is solved, and dynamic configuration and display of multiple filtering effects is realized.

CN113868250BActive Publication Date: 2025-03-28NANJING SUNING ELECTRONIC INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111120105.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-24
Publication Date
2025-03-28
Estimated Expiration
2041-09-24

AI Technical Summary

Technical Problem

When performing tree structure dimension data analysis, the existing technology cannot dynamically and flexible configuration of dimension nodes, and does not support the summary of multiple tree dimensions and the display of multiple filtering effects of tree dimensions.

Method used

By establishing a tree dimension structure diagram, creating a rule configuration table, a tree dimension table, a bridge table and a filter table, using a two-layer SQL language query structure for data analysis and summary, supporting the dynamic configuration of dimension nodes and the display of multiple filtering effects.

Benefits of technology

It realizes dynamic and flexible configuration of tree dimension nodes, supports the summary of multiple tree dimensions and dimension roll-up, displays various filtering effects of tree dimensions, and improves the flexibility and scalability of data analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113868250B_ABST
    Figure CN113868250B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of big data analysis, and discloses a data analysis method, system and storage medium based on tree structure dimensions, the method comprising: establishing a tree dimension structure diagram based on the statistical attributes of commodities; creating a rule configuration table covering leaf node information according to the tree dimension structure diagram; creating a tree dimension table covering all node information according to the rule configuration table and the tree structure diagram; generating a tree dimension bridge table and a tree dimension filter table covering parent node information according to the tree dimension table; and performing different types of data summary and analysis based on the created rule configuration table and / or tree dimension filter table. The data analysis method and system based on tree structure dimensions of the present invention not only supports dynamic and flexible configuration of tree dimension nodes, but also supports summary and dimensional roll-up of multiple tree dimensions, and also supports multiple filtering effects of tree dimensions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of big data analysis, and in particular, relates to a data analysis method and system based on tree structure dimension. Background Art

[0002] As the concept of data middle platform becomes more and more popular, the importance of data analysis becomes more prominent. In actual scenarios, especially in financial report analysis scenarios, the business is often complex and flexible. The aggregation and filtering of various tree-structure dimensions, and the tree dimensions will change at any time with the changes in business scenarios, need to support ad hoc queries. After the tree dimension configuration is completed and saved, it can be queried immediately; the diversification of filtering rules brings multiple display methods.

[0003] The commonly used implementation methods in the industry currently have the following defects:

[0004] 1. Drill down by continuously clicking on nodes on the front end. This method requires front-end support, and the display method is not intuitive enough. It requires multiple interactions between the front and back ends to fully display the entire tree dimension.

[0005] 2. Split a tree dimension into multiple fixed atomic dimensions according to the hierarchy, and then roll up the dimension based on the full atomic dimension aggregation (based on the withrollup syntax supported by most databases). This method requires the hierarchy of the tree dimension to be fixed. If the hierarchy of the tree dimension changes, the dimension table and aggregation SQL need to be changed synchronously.

[0006] 3. The tree dimension filtering rules are relatively fixed, and generally only specific nodes can be filtered for display or non-display.

[0007] Therefore, designing a dimensional analysis method for a technical tree structure to support dynamic and flexible configuration of tree dimension nodes, support the aggregation and dimensional roll-up of multiple tree dimensions, and support the display of multiple filtering effects of tree dimensions is a technical problem that needs to be solved at present. Summary of the invention

[0008] The purpose of the present invention is to provide a data analysis method and system based on tree-structured dimensions to solve the defects in the prior art that, when performing tree-structured dimensional data analysis, dimension nodes cannot be dynamically and flexibly configured, aggregation and dimension roll-up of multiple tree-shaped dimensions are not supported, and multiple filtering effects of tree-shaped dimensions are not supported.

[0009] In order to solve the above technical problems, the first aspect of the present invention provides a data analysis method based on tree structure dimension, the method comprising:

[0010] Based on the statistical attributes of the products, a tree-shaped dimension structure diagram is established;

[0011] According to the tree-shaped dimension structure diagram, a rule configuration table covering leaf node information is created;

[0012] According to the rule configuration table and the tree structure diagram, a tree dimension table covering all node information is created;

[0013] Generate a tree dimension bridge table and / or a tree dimension filter table covering parent node information according to the tree dimension table;

[0014] Based on the created rule configuration table, and / or tree dimension bridge table, and / or tree dimension filter table, data analysis and aggregation of different dimensions are performed.

[0015] Furthermore, the creation process of the rule configuration table includes:

[0016] According to the tree dimension structure diagram, find the leaf node;

[0017] Configure a unique code for the leaf node, wherein the value of the unique code is represented by a UUID;

[0018] Configure the generation rule of the leaf node, wherein the generation rule needs to meet the general SQL language standard;

[0019] Initialize the names, unique codes and generation rules of all leaf nodes, and establish the rule configuration table.

[0020] Furthermore, the process of creating the tree dimension table includes:

[0021] According to the tree-shaped dimension structure diagram, traverse all nodes;

[0022] Set the hierarchical level of each node;

[0023] Number each node and assign a unique code to each node, where the value of the unique code is represented by UUID;

[0024] Determine the unique code of the parent node to which each node belongs;

[0025] Determine whether a node is a leaf node and mark it with a symbol;

[0026] Initialize the number of each node, the name of the node, the unique code of the node, the unique code of the parent node, the symbol mark of the leaf node, and the hierarchical level of each node to establish the tree dimension table.

[0027] Furthermore, the tree dimension bridge table is established based on the association relationship between all leaf nodes in the tree dimension table and all nodes on the path from the leaf node to the root node, wherein the tree dimension bridge table stores the parent node number, parent node unique code, parent node hierarchy level and leaf node unique code.

[0028] Furthermore, the tree dimension filter table is established based on all leaf nodes in the tree dimension table and the association relationship between all nodes on the path from the leaf nodes to the root node, wherein the tree dimension filter table stores a coding array consisting of unique codes of leaf nodes and unique codes of all parent nodes on the path.

[0029] Furthermore, the data analysis and aggregation are performed using a two-layer SQL language query structure, and the two-layer SQL language query structure includes: an inner subquery and an outer query.

[0030] Furthermore, the leaf node unique codes generated by the inner subquery are associated with the leaf node unique codes in the tree dimension bridge table, and then summarized and sorted according to the parent node numbers in the tree dimension bridge table to achieve dimension rollup.

[0031] Furthermore, the leaf node unique code generated by the inner subquery is associated with the leaf node unique code in the tree dimension filter table, and then combined filtering is performed through the parent node unique code array of the tree dimension filter table and the hierarchical level fields in the tree dimension bridge table to achieve display effects that meet different requirements.

[0032] Another aspect of the present invention further provides a data analysis system based on a tree structure dimension, the system comprising:

[0033] The tree dimension structure diagram creation module is used to create a tree dimension structure diagram based on the statistical attributes of the product;

[0034] A rule configuration table creation module, used to create a rule configuration table covering leaf node information according to the tree-shaped dimension structure diagram;

[0035] A tree dimension table creation module is used to create a tree dimension table covering all node information according to the rule configuration table and the tree structure diagram;

[0036] A tree dimension bridge table creation module, used to generate a tree dimension bridge table covering parent node encoding information according to the tree dimension table;

[0037] A tree dimension filter table creation module, used to generate a tree dimension filter table covering parent node encoding array information according to the tree dimension table;

[0038] A data analysis module performs data analysis of different dimensions based on the created rule configuration table, and / or tree dimension bridge table, and / or tree dimension filter table;

[0039] Wherein, the data analysis and aggregation are performed using a two-layer SQL language query structure, the two-layer SQL language query structure includes an inner subquery and an outer query, the inner subquery generates a unique code of a leaf node of a tree dimension according to the fields of the fact table according to the rules in the rule configuration table, and the outer query associates the relevant data in a tree dimension table bridge table or a filter table according to the unique code of the leaf node of the tree dimension generated by the inner layer.

[0040] According to a third aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program is executed by a processor to perform the steps of the method described in the first aspect of the present invention.

[0041] Compared with the prior art, the data analysis method and system based on tree structure dimension provided by the present invention have the following technical effects:

[0042] 1. The data statistical analysis of the present invention is based on a tree structure model, and multiple dimension tables are established. The analysis method is flexible and changeable, and can respond to changes in analysis business scenarios in a timely manner. After modifying the relevant configuration of the tree dimension table, the ad hoc query of the report can display the latest results.

[0043] 2. The method of the present invention has high scalability for dimension tables and can support report queries in a variety of customized formats.

[0044] 3. The deployment method of the present invention is simple, and the display of tree-shaped reports of different requirements can be realized by means of several customized dimension tables. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a flow chart of a data analysis method based on tree structure dimension according to an embodiment of the present invention.

[0046] Figure 2 It is a schematic diagram of the tree dimension structure of an embodiment of the present invention.

[0047] Figure 3 It is an architecture diagram of a data analysis system based on a tree structure dimension according to an embodiment of the present invention. DETAILED DESCRIPTION

[0048] The following examples are only used to more clearly illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. For example, certain words are used in the specification and claims to refer to specific components. Those skilled in the art should understand that hardware or software manufacturers may use different nouns to refer to the same component. This specification and claims do not use the difference in name as a way to distinguish components, but use the difference in function of the components as the criterion for distinction. The subsequent description of the specification is a preferred embodiment of the present invention, but the description is for the purpose of illustrating the general principles of the present invention, and is not intended to limit the scope of the present invention. The scope of protection of the present invention shall be determined by the definition of the attached claims.

[0049] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0050] like Figure 1 , Figure 2 As shown, the present invention discloses a data analysis method based on tree structure dimension, comprising the following steps:

[0051] Step S1, establishing a tree dimension structure diagram based on the statistical attributes of the product;

[0052] According to the statistical model of the commodity, a structural diagram with a tree dimension is established, where the tree dimension is a special dimension displayed in the form of a multi-branch tree structure. Figure 2 It is a schematic diagram of a tree-shaped dimension structure diagram in an embodiment of the present invention. There are multiple nodes in the structure diagram, such as the total of goods as the root node, the commodity air conditioner, extended warranty air conditioner, commodity black electric appliance and extended warranty black electric appliance are all leaf nodes, the parent node of the commodity air conditioner and extended warranty air conditioner is air conditioner, the parent node of the commodity black electric appliance and extended warranty black electric appliance is black electric appliance, the parent node of the air conditioner and black electric appliance is the household appliance subtotal, the parent node of the household appliance subtotal is the physical commodity subtotal, the physical commodity subtotal and other types of subtotals are at the same level, their parent node is the total, the total has no parent node, and the upper nodes and the lower nodes are connected by arrows to form a directional diagram with an associated relationship. It should be noted that it is not limited to the statistical modes listed above. Different statistical modes form different tree-shaped dimension structure diagrams. In theory, there can be an infinite number of branches and nodes.

[0053] Step S2, creating a rule configuration table covering leaf node information according to the tree dimension structure diagram;

[0054] The creation process of the rule configuration table includes the following steps:

[0055] According to the established tree dimension structure diagram, find the leaf node, which has no next child node adjacent to it; Figure 2 There are four leaf nodes, named commercial air conditioner, extended warranty air conditioner, commercial black electricity, and extended warranty black electricity.

[0056] Configure the generation rules of all leaf nodes, where the generation rules must meet the general SQL language standards to facilitate subsequent analysis and query; for example, the node rule of the black-out goods is described in SQL as: PD_WD_0001 = 'black-out' and FNC_WD_0005 not in ('extended warranty black-out'), and the node rule of extended warranty black-out is described in SQL as FNC_WD_0005 = 'extended warranty black-out'.

[0057] Configure the unique code of the leaf node, where the value of the unique code is represented by UUID; the value of the leaf node code is represented by a 32-bit UUID (Universally Unique Identifier) ​​to ensure the uniqueness of the leaf node code and facilitate subsequent accurate searches. Each leaf node with a name corresponds to a unique code and a unique node generation rule.

[0058] Initialize the leaf node name, leaf node unique code and node generation rule contained in each leaf node, arrange them in order, and establish a rule configuration table, as shown in Table 1.

[0059] Table 1 Leaf node rule configuration table

[0060]

[0061] Step S3, creating a tree dimension table according to the rule configuration table and the tree structure diagram.

[0062] The process of creating a tree dimension table includes:

[0063] According to the tree dimension structure diagram, find all nodes, including all nodes from the root node to the leaf nodes;

[0064] Set the hierarchical level of each node, where the first node of the tree dimension is called the root node. The root node has the highest level and the leaf node has the lowest level. From the root node to the leaf node, the levels are set in sequence, represented by 1, 2, 3, etc. As shown in Table 2, "Total" is level 1, "Subtotal of Physical Goods" is level 2, "Air Conditioner" and "Black Appliances" are level 4, and "Commodity Black Appliances" and "Extended Warranty Black Appliances" are both level 5.

[0065] Starting from the root node, each node is numbered in sequence according to the level. The number of the next adjacent node (equivalent to the child node) retains the number of its previous node (equivalent to their parent node). The numbers of different nodes at the same level are arranged in sequence. At the same time, each node is given a unique code, where the unique code is also represented by a 32-bit UUID; for example, the root node is fixed to 0001, and the nodes at the same level are numbered sequentially from 0001 to 9999, and are numbered based on the number of the parent node. Use underscores as prefixes to separate, for example: "Total" as the parent node is numbered 0001, and its first child node, physical product subtotal, is numbered 0001_0001. Similarly, the node number corresponding to the child node of physical product subtotal, home appliance subtotal, is 0001_0001_0001, while "black appliances" and "air conditioners" are its child nodes, and their node numbers can be expressed as 0001_0001_0001_0001 and 0001_0001_0001_0002 respectively.

[0066] Determine the unique code of the parent node to which each node belongs; when a node has no parent node, such as "Total" is the root node and has no parent node, it is identified by Null, and the parent node code of "Physical Product Subtotal" is the node code corresponding to "Total".

[0067] Mark it according to whether it is a leaf node. If it is not a leaf node, it is represented by N. If it is a leaf node, it is represented by Y. For example, there are 4 leaf nodes in Table 2;

[0068] Initialize the number of each node, the name of the node, the unique code of the node, the unique code of the parent node, the mark of the leaf node, and the hierarchical level of the node to establish a tree dimension table as shown in Table 2.

[0069] Table 2 Tree dimension table

[0070]

[0071] The tree dimension table basically covers all node information of a product's statistical attributes.

[0072] Step S4, generating a tree dimension bridge table and / or a tree dimension filter table according to the tree dimension table;

[0073] First, the tree dimension bridge table is established according to the association relationship between all leaf nodes in the tree dimension table and all nodes on the path from the leaf node to the root node. When there is a direct association between two nodes, it means that one of them is a parent node, wherein the tree dimension bridge table stores the parent node number, the parent node unique code, the parent node hierarchical level and the leaf node unique code. As shown in Table 3, it is a schematic table of a tree dimension bridge table in an embodiment of the present invention. The root node "Total" is the parent node of "Subtotal of Physical Goods", which is numbered 0001, coded as the set "Total" code, and the hierarchical level is 1, and there are four leaf node codes. Therefore, when building the table, "Total" has four parent node numbers 0001, and "Subtotal of Physical Goods" and "Subtotal of Home Appliances" also have four parent node numbers, and the parent node numbers are 0001_0001 and 0001_0001_0001 respectively. Starting from the root node with the highest level as the parent node, all parent node numbers and codes are counted in sequence, and then the parent node level and the corresponding leaf node code are combined to obtain a complete statistical table.

[0074] Table 3 Tree dimension bridge table

[0075]

[0076] A tree dimension filter table is established based on the association relationship between all leaf nodes in the tree dimension table and all nodes on the path from the leaf node to the root node, wherein the tree dimension filter table stores a coding array consisting of the unique code of the leaf node and the unique code of all parent nodes. As shown in Table 4, it is a schematic table of a tree dimension filter table in an embodiment of the present invention. For example, when the leaf node is "commodity black electronics", there are 5 nodes on all the paths between it and the root node, then the recorded parent node unique coding array includes: "Total" code, "Physical commodity subtotal" code, "Household appliance subtotal" code, "Black electronics" code, "Commodity black electronics" code.

[0077] Table 4 Tree dimension filtering table

[0078]

[0079] Step S5, performing different types of data analysis based on the created rule configuration table, and / or tree dimension table, and / or tree dimension bridge table, and / or tree dimension filter table.

[0080] According to the dimension construction process, four dimension tables are created, namely, the special node rule configuration table, the tree dimension table, the tree dimension bridge table, and the tree dimension filter table, and the table data is initialized according to the example. After completing the construction of the four dimension tables, the SQL is constructed according to the following sample through the rule configuration table, the tree dimension bridge table, and the tree dimension filter table, and the analysis and summary of the tree dimension can be performed. The tree dimension table does not participate in the SQL analysis. It is the basic table for constructing the tree dimension bridge table and the tree dimension filter table, and is used to convert the code into a name when the report is displayed. In order to support the dynamic and flexible configuration of the tree dimension nodes, the present invention adopts a two-layer SQL language query structure, wherein the inner subquery generates the leaf node code of the tree dimension according to the fields of the fact table according to the rules in the leaf node rule configuration table, and the outer query associates the relevant data in the tree dimension table bridge table or the filter table according to the leaf node code of the tree dimension generated by the inner layer, such as associating the unique code field of the leaf node, and constructs a complete tree dimension by summarizing and sorting according to the parent node number. An example of the expression of the two-layer SQL statement is as follows:

[0081]

[0082]

[0083] The query in the brackets after the FROM keyword is the inner subquery, and the query outside the brackets is the outer query.

[0084] When the inner subquery queries fact table data, the leaf node unique code of the tree dimension is dynamically generated according to the leaf node rules configured in the leaf node rule configuration table, and the new dimension FNC_0016 is generated by summarizing the newly generated leaf node unique codes.

[0085] A schematic expression for generating the tree dimension FNC_0016 according to the configured rules is as follows:

[0086] CASE

[0087] WHEN(PD_WD_0001='Black TV' and FNC_WD_0005not in('Extended warranty black TV')) THEN

[0088] 'Product black electronics code',

[0089] WHEN(FNC_WD_0005='Extended warranty for black battery') THEN'Extended warranty for black battery code',

[0090] ...other node configuration

[0091] ELSE 'Other'

[0092] ENDAS FNC_0016

[0093] The tree dimension FNC_0016 generated by the inner subquery is associated with the unique code of the leaf nodes of the tree dimension bridge table, and is summarized and sorted according to the node number in the tree dimension bridge table. In this way, the final statistical result is that the statistical value of each parent node is equal to the accumulation of all child nodes to achieve the effect of dimension roll-up, as shown in Table 4. Among them, dimension roll-up refers to the operation of observing data from fine-grained to coarse-grained or aggregating and summarizing data upward along the dimension level.

[0094] Table 4 Summary of multiple attribute dimensions and dimension roll-up display

[0095]

[0096] The tree dimension FNC_0016 generated by the inner subquery is associated with the leaf node unique code field of the tree dimension filter table. The parent node unique code array field of the tree dimension filter table and the hierarchical level field of the tree dimension table bridge table are combined for filtering to support the three filtering effects shown in Table 5, Table 6, and Table 7.

[0097] The first filtering effect: Assuming the full path display based on the "Black TV" node filtering, filtering is performed based on whether the parent node unique code array field of the "Tree Dimension Filter Table" contains the unique code of the "Black TV" node;

[0098] The specific expression is as follows: ARRAY_CONTAINS(node_cd_array,'210464979185303552').

[0099] Table 5 Full path display based on “black electricity” node filtering

[0100]

[0101] The second filtering effect: Assuming the upper-level path display based on the "Black Electricity" node filtering, filtering is performed based on whether the parent node unique code array field of the "Tree Dimension Filter Table" contains the unique code of the "Black Electricity" node and the hierarchical level field of the "Tree Dimension Table Bridge Table" is less than or equal to the hierarchical level of the fourth-level node "Black Electricity".

[0102] The specific expression is as follows: ARRAY_CONTAINS(node_cd_array,'210464979185303552')ANDcurrent_level<=4.

[0103] Table 6 Display of upper-level paths based on “black electricity” node filtering

[0104]

[0105] The third filtering effect: Assuming the lower-level path display based on the "Black Electricity" node filtering, filtering is performed based on whether the parent node unique code array field of the "Tree Dimension Filter Table" contains the unique code of the "Black Electricity" node and the level field of the "Tree Dimension Table Bridge Table" is greater than or equal to the level of the fourth-level node "Black Electricity";

[0106] The specific expression is as follows: ARRAY_CONTAINS(node_cd_array,'210464979185303552')ANDcurrent_level>=4.

[0107] Table 7 Display of lower-level paths based on “black electricity” node filtering

[0108]

[0109] In addition, alternatively, the above method can be implemented by a computer program product, i.e., a computer-readable storage medium. The computer program product may include a computer-readable storage medium on which are loaded computer-readable program instructions for executing various aspects of the present invention. The computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. The computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive lists) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a protruding structure in a groove on which instructions are stored, and any suitable combination thereof. The computer-readable storage medium used herein is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., light pulses through a fiber optic cable), or an electrical signal transmitted through wires.

[0110] Please refer to Figure 3 As shown, another embodiment of the present invention further provides a data analysis system based on tree structure dimension, the system comprising:

[0111] The tree dimension structure diagram creation module is used to create a tree dimension structure diagram based on the statistical attributes of the product; a schematic diagram of the tree dimension structure diagram is as follows Figure 2As shown, it establishes a structure diagram with multiple bifurcated trees based on the statistical needs of commodities from different angles or types. Of course, those skilled in the art should be able to understand that based on different statistical trees, the tree structure diagram is different, and there can be more branches and more bifurcated nodes. This method supports flexible tree structure analysis with no fixed level, and theoretically can support tree dimension structures with unlimited levels.

[0112] The rule configuration table creation module is used to create a rule configuration table covering leaf node information based on the tree dimension structure diagram; the rule configuration table mainly involves relevant information about the leaf nodes, including the leaf node name, the unique code of the leaf node, and the generation rule language of the leaf node.

[0113] The tree dimension table creation module is used to create a tree dimension table covering all node information according to the rule configuration table and the tree structure diagram; the tree dimension table covers all node-related information, including the node number, the node name, the node's unique code, the parent node's unique code, the leaf node's mark, the node's hierarchical level, and is arranged in order from the root node to the leaf node to form a complete data table.

[0114] A tree dimension bridge table creation module is used to generate a tree dimension bridge table covering parent node information based on the tree dimension table; the tree dimension bridge table stores the relative relationship between all leaf nodes and all nodes on the path to the root node, represented by parent node information, including parent node number, parent node unique code, parent node hierarchy level and leaf node unique code.

[0115] The tree dimension filter table creation module is used to generate a tree dimension filter table covering the parent node codes according to the tree dimension table; the tree dimension filter table also stores the codes of all leaf nodes and the relationship table formed by the array composed of all node codes on the path from the leaf node to the root node.

[0116] The data analysis module performs different types of data analysis based on the created rule configuration table, and / or tree dimension table, and / or tree dimension bridge table, and / or tree dimension filter table.

[0117] Since the embodiment of the present invention is based on a tree structure and is configured with multiple dimension tables, application analysis from multiple angles and presentation of multiple tree reports can be achieved through common SQL syntax, and different presentation effects can be obtained through ad hoc queries.

[0118] It is worth noting that the above is only a preferred embodiment of the present invention, and does not limit the scope of patent protection of the present invention. The present invention can also improve the materials and structures of the above-mentioned various parts, or replace them with technical equivalents. Therefore, all equivalent structural changes made by using the description and illustrations of the present invention, or directly or indirectly applied to other related technical fields are also included in the scope of the present invention.

Claims

1. A data analysis method based on tree structure dimension, characterized in that: The method includes: Based on the statistical attributes of the products, a tree-shaped dimension structure diagram is established; According to the tree-shaped dimension structure diagram, a rule configuration table covering leaf node information is created; According to the rule configuration table and the tree dimension structure diagram, a tree dimension table covering all node information is created; Generate a tree dimension bridge table and / or a tree dimension filter table covering parent node information according to the tree dimension table; Based on the created rule configuration table, and / or tree dimension bridge table, and / or tree dimension filter table, data analysis and aggregation of different dimensions are performed; Among them, the data analysis and aggregation are performed using a two-layer SQL language query structure, and the two-layer SQL language query structure includes an inner subquery and an outer query. The inner subquery generates a unique code of a leaf node of a tree dimension according to the fields of the fact table according to the rules in the rule configuration table, and the outer query associates the relevant data in the tree dimension table bridge table or the tree dimension filter table according to the unique code of the leaf node of the tree dimension generated by the inner layer.

2. The data analysis method according to claim 1, characterized in that: The process of creating the rule configuration table includes: According to the tree-shaped dimension structure diagram, find all leaf nodes; Configure a unique code for the leaf node, wherein the value of the unique code is represented by a UUID; Configuring a generation rule for the leaf node, wherein the generation rule meets a common SQL language standard; Initialize the names, unique codes and generation rules of all leaf nodes, and establish the rule configuration table.

3. The data analysis method according to claim 2, characterized in that: The process of creating the tree dimension table includes: According to the tree-shaped dimension structure diagram, traverse all nodes; Set the hierarchical level of each node; Number each node in sequence and assign each node a unique code, where the value of the unique code is represented by UUID; Determine the unique code of each node corresponding to its parent node; Determine whether a node is a leaf node and mark it with a symbol; Initialize the number of each node, the name of the node, the unique code of the node, the unique code of the parent node, the symbol mark of the leaf node, and the hierarchical level of each node to establish the tree dimension table.

4. The data analysis method according to claim 3, characterized in that: The tree dimension bridge table is established according to the association relationship between all leaf nodes in the tree dimension table and all nodes on the path from the leaf node to the root node, wherein the tree dimension bridge table stores the parent node number, parent node unique code, parent node hierarchy level and leaf node unique code.

5. The data analysis method according to claim 3, characterized in that: The tree dimension filter table is established according to the association relationship between all leaf nodes in the tree dimension table and all nodes on the path from the leaf node to the root node, wherein the tree dimension filter table stores a coding array consisting of the unique codes of the leaf nodes and the unique codes of all parent nodes on the path.

6. The data analysis method according to claim 1, characterized in that: The unique code of the leaf node generated by the inner subquery is associated with the unique code of the leaf node in the tree dimension bridge table, and then summarized and sorted according to the parent node number in the tree dimension bridge table to achieve dimension rollup.

7. The data analysis method according to claim 1, characterized in that: The unique code of the leaf node generated by the inner subquery is associated with the unique code of the leaf node in the tree dimension filter table, and then combined filtering is performed through the code array of the parent node of the tree dimension filter table and the hierarchical level field in the tree dimension bridge table to achieve display effects for different needs.

8. A system for implementing the data analysis method based on tree structure dimension as claimed in claim 1, characterized in that: The system includes: The tree dimension structure diagram creation module is used to create a tree dimension structure diagram based on the statistical attributes of the product; A rule configuration table creation module, used to create a rule configuration table covering leaf node information according to the tree-shaped dimension structure diagram; A tree dimension table creation module is used to create a tree dimension table covering all node information according to the rule configuration table and the tree dimension structure diagram; A tree dimension bridge table creation module, used to generate a tree dimension bridge table covering parent node encoding information according to the tree dimension table; A tree dimension filter table creation module, used to generate a tree dimension filter table covering parent node encoding array information according to the tree dimension table; A data analysis module performs data analysis of different dimensions based on the created rule configuration table, and / or tree dimension bridge table, and / or tree dimension filter table; Among them, the data analysis and aggregation are performed using a two-layer SQL language query structure, and the two-layer SQL language query structure includes an inner subquery and an outer query. The inner subquery generates a unique code of a leaf node of a tree dimension according to the fields of the fact table according to the rules in the rule configuration table, and the outer query associates the relevant data in the tree dimension table bridge table or the tree dimension filter table according to the unique code of the leaf node of the tree dimension generated by the inner layer.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are executed.

Citation Information

Patent Citations

  • Visualized structured query language (SQL) condition tree establishing method and device

    CN104899207A

  • Data structure construction method and device, equipment and storage medium

    CN111708782A