Government affair data cube construction method and device based on knowledge graph and medium
Through the construction method of government data cube based on knowledge graph, the problem of scattered government data and low analysis efficiency is solved, the comprehensiveness and intuitiveness of data dimensions are realized, the efficiency of analysis and processing is improved, and more complex data expansion and decision support are supported.
Patent Information
- Application Number
- CN202410622846.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-09-27
AI Technical Summary
Government data is scattered, and traditional data processing methods are difficult to efficiently process large-scale and heterogeneous government data, resulting in low efficiency of data analysis and query, incomplete data maintenance, and lack of comprehensiveness.
A government data cube construction method based on knowledge graph is adopted to construct a multi-dimensional knowledge graph by obtaining government service data for dimension preprocessing, entity extraction and relationship extraction, and the preset cube construction model and MapReduce algorithm are used to construct the data cube for optimization and Index processing.
It achieves more comprehensive data dimensions and more intuitive display, improves data analysis processing and query efficiency, and supports more complex data expansion and decision-making.
Smart Images

Figure CN118708656A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method for constructing a government data cube based on a knowledge graph. Background Art
[0002] Government service data are usually scattered in different systems, lacking effective integration and utilization. Secondly, government data resources are becoming increasingly abundant, but the integration, analysis and utilization of data face many challenges. Traditional data processing methods are difficult to efficiently process large-scale, heterogeneous government data and meet complex data analysis needs. On the other hand, directly constructing a data cube from government service metadata will lead to problems such as incomplete data maintenance and incomplete data, resulting in omissions in data analysis and query. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a method, device and medium for constructing a government data cube based on a knowledge graph, which can make the data dimension more comprehensive, the display more intuitive, and the data analysis, processing and query efficiency high.
[0004] In order to solve the above technical problems, the present invention provides a method for constructing a government data cube based on a knowledge graph, including: obtaining government service data and performing dimensional preprocessing on the government service data to obtain multi-dimensional data; performing entity extraction and relationship extraction on the multi-dimensional data to obtain entity data and entity relationship data corresponding to each dimensional data in the multi-dimensional data; constructing a multi-dimensional knowledge graph of government service matters based on the entity data and entity relationship data; performing cube construction processing on the multi-dimensional knowledge graph of government service matters through a preset cube construction model to construct an original government data cube; optimizing and indexing the original government data cube to obtain a new government data cube.
[0005] As an improvement of the above-mentioned scheme, the step of performing dimensional preprocessing on the government service data to obtain multi-dimensional data includes: using the government service matter data in the government service data as dimensional benchmark data; using the basic data related to the government service matter data as dimensional basic data of the corresponding dimensional benchmark data; and constructing multi-dimensional data through the dimensional benchmark data and dimensional basic data.
[0006] As an improvement of the above scheme, after the step of performing dimensional preprocessing on the government service data to obtain multi-dimensional data, the step also includes: performing data cleaning on the multi-dimensional data to ensure data consistency; and assigning a corresponding ID to each data in the multi-dimensional data.
[0007] As an improvement of the above-mentioned scheme, the step of performing entity extraction and relationship extraction on the multi-dimensional data to obtain entity data and entity relationship data corresponding to each dimensional data includes: performing entity identification based on the dimensional reference data ID in the multi-dimensional data to obtain entity data of government service items; extracting the association relationship of the identified entity data to obtain entity relationship data.
[0008] As an improvement of the above scheme, the step of extracting the relationship status of the entity data after identification to obtain entity relationship data includes: extracting the association relationship status of the entity data after identification to obtain entity initial relationship data; performing classification and weighting according to the association relationship degree of the entity initial relationship data to obtain the corresponding relationship degree value; and constructing the entity relationship data according to the entity initial relationship data and its relationship degree value.
[0009] As an improvement of the above-mentioned scheme, the step of constructing a government data cube by cube construction processing of the multidimensional knowledge graph of government service items through a preset cube construction model includes: taking the dimensional reference data ID in the multidimensional knowledge graph of government service items as the basis, encoding the corresponding dimensional column data, and replacing the original dimensional values with surrogate keys to construct a basic cube through the processed graph database; and cube construction processing of the basic cube through the MapReduce construction algorithm to obtain a government data cube.
[0010] As an improvement of the above scheme, the step of performing cube construction processing on the basic cube through the MapReduce construction algorithm to obtain the government data cube includes: slicing the data of the basic cube and forming key-value pairs; removing at least one dimension through a preset removal rule to generate a new key-value pair; aggregating values with the same key to obtain the key-value pair with the minimum value, and outputting the new basic cube; looping the above steps until the number of dimension combinations of the new basic cube reaches the preset maximum number of dimension combinations, and using the current basic cube as the government data cube.
[0011] As an improvement of the above-mentioned scheme, the steps of optimizing and indexing the government data cube to obtain the new government data cube include: performing data compression optimization on the government data cube through the Dwarf algorithm to obtain an optimized government data cube; and constructing an index for the optimized government data cube through the B+ tree algorithm to obtain the index data structure of the government data cube.
[0012] The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0013] The present invention also provides a storage medium storing a computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0014] The implementation of the present invention has the following beneficial effects:
[0015] By constructing a knowledge graph from government service data, the present invention can connect independent items, item basic data, and the relationship between items in series, ensuring that the content of government service data can cover all data; and on this basis, it is converted into a government data cube, which can make the data dimension more comprehensive and the display more intuitive. At the same time, based on the network relationship of the knowledge graph, it can better support the expansion of more dimensions of government service data and greatly improve the efficiency of data analysis and processing. When querying government service data through a government data cube based on a knowledge graph, real-time and accurate data analysis results can be obtained more conveniently, thereby better supporting decision-making and business development. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flow chart of the method for constructing a government data cube based on a knowledge graph of the present invention;
[0017] Figure 2 The present invention uses a preset cube construction model to perform cube construction processing on the multi-dimensional knowledge graph of government service items to construct a flowchart of a government data cube;
[0018] Figure 3 It is a flowchart of the present invention for optimizing and indexing the government data cube to obtain a new government data cube. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. It is hereby stated that the directional terms such as up, down, left, right, front, back, inside, outside, etc. that appear or will appear in the text of the present invention are only based on the accompanying drawings of the present invention, and are not specific limitations of the present invention.
[0020] like Figure 1 As shown, a specific embodiment of the present invention provides a method for constructing a government data cube based on a knowledge graph, including:
[0021] S101, acquiring government service data and performing dimension preprocessing on the government service data to obtain multi-dimensional data;
[0022] Specifically, the step of performing dimension preprocessing on the government service data to obtain multi-dimensional data includes:
[0023] Step 1: Use the government service item data in the government service data as dimension benchmark data;
[0024] Step 2: Using the basic data related to the government service item data as the dimensional basic data of the corresponding dimensional reference data;
[0025] Step 3: construct multi-dimensional data using the dimensional benchmark data and dimensional basic data.
[0026] It should be noted that the government service data is obtained from multiple government service systems, and the government service item data in the government service data is used as the dimension benchmark data, that is, the dimension construction benchmark; the basic data related to the government service item data is used as the dimension basic data of the corresponding dimension benchmark data, such as the basic data related to the handling information, service channel information, results, required materials, etc. as the dimension basic data. Multi-dimensional data is constructed through multiple dimensional benchmark data and dimensional basic data, that is, each government service item data is used as the dimensional benchmark, and the relevant basic data is the specific associated data content of the corresponding dimension. For example, the government service item "applying for a resident ID card" is used as an example, and its associated data includes dimensional basic data such as handling standards, handling conditions, handling procedures, application materials, corresponding policy requirements and approval requirements.
[0027] Preferably, each dimension can also expand the data content of the dimension according to actual conditions to meet actual use.
[0028] Among them, after the step of performing dimensional preprocessing on the government service data to obtain multi-dimensional data, the step also includes the following steps: performing data cleaning on the multi-dimensional data to ensure data consistency; and assigning corresponding IDs to each data in the multi-dimensional data.
[0029] It should be noted that data cleaning is performed on multi-dimensional data to ensure the consistency of data with the same meaning but different expressions, such as tax payment certificates and tax payment vouchers, to ensure that data with the same meaning but different expressions are classified into one category, to ensure data processing consistency, and to achieve one number, one source, and one standard; and to assign a corresponding unique ID to each data after cleaning, in order to improve the efficiency and accuracy of subsequent data processing.
[0030] S102, performing entity extraction and relationship extraction on the multi-dimensional data to obtain entity data and entity relationship data corresponding to each dimension data in the multi-dimensional data;
[0031] Specifically, the step of performing entity extraction and relationship extraction on the multi-dimensional data to obtain entity data and entity relationship data corresponding to each dimensional data includes:
[0032] Step 1: Perform entity identification according to the dimensional reference data ID in the multi-dimensional data to obtain entity data of government service items;
[0033] It should be noted that the embodiment of the present invention uses the known government service item code ID as a unique identifier to determine the entity to be identified based on the knowledge and business rules in the field of government services. Based on the unique identifier matching pattern, the government service items are entity identified according to the dimensional reference data ID in the multi-dimensional data to obtain the entity data of all required government service items.
[0034] Step 2: extract the association relationship of the identified entity data to obtain entity relationship data.
[0035] Among them, the step of extracting the relationship situation of the entity data after identification to obtain entity relationship data includes: extracting the association relationship situation of the entity data after identification to obtain entity initial relationship data; performing classification and weighting according to the association relationship degree of the entity initial relationship data to obtain the corresponding relationship degree value; constructing the entity relationship data according to the entity initial relationship data and its relationship degree value.
[0036] It should be noted that by extracting the association relationship of the entity data of each government service item, the entity relationship data of the corresponding entity can be obtained and linked to the corresponding relationship network in the knowledge graph. The relationship network includes the relationship between items, such as the relationship between the certificates required for items and the results of items. At the same time, the extracted entity relationship data is classified and classified and weighted according to the degree of association of the initial relationship data of the entity (such as factors such as the closeness and importance of the relationship between the data). The higher the weight, the higher the final degree of association, indicating that the correlation between the data is closer, and thus the closer it is to the core basic information in the knowledge graph, the easier it is to query in the subsequent data cube, and the better the query efficiency.
[0037] S103, constructing a multi-dimensional knowledge graph of government service items based on the entity data and entity relationship data;
[0038] It should be noted that after entity data is identified, based on the results of relationship extraction and association, single items can be associated with the basic data of items, and then the relationships between items can be associated, and finally the relationships between the basic data of items can be associated to form a multi-dimensional knowledge graph of government service items.
[0039] By using the graph database management system to store data, such as CREATE(n: event element {id:'1001', name:' event name', note:' note'}), CREATE(n: event element {id:'1002', name:' basic code', note:' note'}), CREATE(p: event table {id:'2001', name:' apply for resident identity card', event element id:'1001',.....}), CREATE(p: event table {id:'2002', name:' apply for resident identity card', event element id:'1002'.....}), construct two relationships MATCH(n: event element)-[:WORKS_FOR]->(p: event table) WHERE n.id=p. element id RETURN n,p. The graph database can achieve more efficient query and search speed. In addition, the graph database can allow entity nodes to retain attributes, thereby expanding the amount of information of the entity.
[0040] The embodiment of the present invention constructs a knowledge graph based on government service data, which can connect independent matters, basic data of matters, and the relationships between matters, ensuring that the government service graph data content can cover all data, thereby facilitating data processing and query.
[0041] S104, performing cube construction processing on the multi-dimensional knowledge graph of government service items through a preset cube construction model to construct an original government data cube;
[0042] S105: Optimize and index the original government data cube to obtain a new government data cube.
[0043] It should be noted that by constructing a government data cube based on the multi-dimensional knowledge graph of government service items, the data dimensions can be more comprehensive and the display can be more intuitive. At the same time, based on the network relationship of the knowledge graph, it can better support the expansion of government service data in more dimensions and greatly improve the efficiency of data analysis and processing. When querying government service data through the government data cube based on the knowledge graph, due to the establishment of a good data index structure, it is more convenient to obtain real-time and accurate data analysis results, thereby better supporting decision-making and business development.
[0044] like Figure 2 As shown, the steps of performing cube construction processing on the multi-dimensional knowledge graph of government service items through a preset cube construction model to construct a government data cube include:
[0045] S201. Using the dimension reference data ID in the multi-dimensional knowledge graph of government service items as a basis, encoding the corresponding dimension column data, and using surrogate keys to replace the original dimension values, so as to construct a basic cube through the processed graph database;
[0046] It should be noted that the dimension benchmark data ID (i.e., government service item ID) is selected as the most fine-grained data and used as the benchmark. The corresponding dimension column data is encoded and the original dimension value is replaced with surrogate keys. Then, a complete data set containing all dimensions and measures is created as the benchmark cube in the graph database after the above processing.
[0047] S202: Perform cube construction processing on the basic cube through MapReduce construction algorithm to obtain a government data cube.
[0048] Specifically, the step of performing cube construction processing on the basic cube by using the MapReduce construction algorithm to obtain the government data cube includes:
[0049] Step 1: Slice the data of the basic cube and form key-value pairs;
[0050] Step 2: Remove at least one dimension using a preset removal rule to generate a new key-value pair;
[0051] It should be noted that Maptask is used to slice the basic cube and form<key,va l ue> Key-value pairs. Remove one or more dimensions through preset removal rules and generate new key-value pairs. The key is the combination of the remaining dimensions, and the value is the aggregated measurement value.
[0052] Step 3: Aggregate the values with the same key to obtain the key-value pair with the minimum value, and output the new basic cube;
[0053] Step 4: Execute the above steps repeatedly until the number of dimension combinations of the new basic cube reaches the preset maximum number of dimension combinations, and then use the current basic cube as the government data cube.
[0054] It should be noted that after the above MapReduce construction process is executed cyclically, a higher-level basic cube will be generated each time; when the number of dimension combinations of the new basic cube reaches the preset maximum number of dimension combinations, the current basic cube will be used as the government data cube. Among them, pruning technology is used to avoid generating unnecessary cubes (cubes) to reduce storage space requirements and computing costs.
[0055] like Figure 3 As shown, the step of optimizing and indexing the government data cube to obtain the new government data cube includes:
[0056] S301, performing data compression optimization on the government data cube by using the Dwarf algorithm to obtain an optimized government data cube;
[0057] S302: construct an index for the optimized government data cube using a B+ tree algorithm to obtain an index data structure of the government data cube.
[0058] It should be noted that the government data cube is optimized for data compression by using the Dwarf algorithm to identify and merge the prefix and suffix structure redundancy in the data, and the B+ tree algorithm is used to build an index data structure for the government data cube to improve query efficiency. Hot data (material lists, approval points, etc.) are cached according to the query mode to further improve query efficiency.
[0059] Among them, the index data structure of the government data cube includes government service items as the main data table (main table), and constructing an index table for each benchmark data in the government service items. Each index corresponds to a node in the knowledge graph, and a bidirectional index is established with the main table at the same time, so that the main table and the index can be bidirectionally referenced to maintain the graph relationship, which is convenient for indexing to the corresponding data dimension through the graph relationship from both forward and reverse directions.
[0060] Preferably, the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0061] Preferably, the present invention further provides a storage medium storing a computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0062] In summary, the present invention can connect independent matters, basic data of matters, and the relationship between matters by constructing a knowledge graph from government service data, ensuring that the content of government service data can cover all data; and on this basis, it can be converted into a government data cube, which can make the data dimension more comprehensive and the display more intuitive. At the same time, based on the network relationship of the knowledge graph, it can better support the expansion of more dimensions of government service data and greatly improve the efficiency of data analysis and processing. When querying government service data through a government data cube based on a knowledge graph, real-time and accurate data analysis results can be obtained more conveniently, thereby better supporting decision-making and business development.
[0063] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A method for constructing a government data cube based on a knowledge graph, characterized in that: include: Acquire government service data and perform dimension preprocessing on the government service data to obtain multi-dimensional data; Performing entity extraction and relationship extraction on the multi-dimensional data to obtain entity data and entity relationship data corresponding to each dimension data in the multi-dimensional data; Construct a multi-dimensional knowledge graph of government service items based on the entity data and entity relationship data; The multi-dimensional knowledge graph of government service items is cube-constructed by using a preset cube construction model to construct an original government data cube; The original government affairs data cube is optimized and indexed to obtain a new government affairs data cube.
2. The method for constructing a government data cube based on a knowledge graph according to claim 1 is characterized in that: The step of performing dimension preprocessing on the government service data to obtain multi-dimensional data includes: Using the government service item data in the government service data as dimension benchmark data; Using basic data related to the government service item data as dimensional basic data of the corresponding dimensional benchmark data; Multi-dimensional data is constructed by using the dimensional reference data and the dimensional basic data.
3. The method for constructing a government data cube based on a knowledge graph according to claim 2 is characterized in that: After the step of performing dimension preprocessing on the government service data to obtain multi-dimensional data, the following step further includes: Performing data cleaning on the multi-dimensional data to ensure data consistency; A corresponding ID is assigned to each data in the multi-dimensional data.
4. The method for constructing a government data cube based on a knowledge graph according to claim 1 is characterized in that: The step of performing entity extraction and relationship extraction on the multi-dimensional data to obtain entity data and entity relationship data corresponding to each dimensional data includes: Perform entity identification according to the dimensional reference data ID in the multi-dimensional data to obtain entity data of government service items; The association relationship of the identified entity data is extracted to obtain entity relationship data.
5. The method for constructing a government data cube based on a knowledge graph according to claim 4 is characterized in that: The step of extracting the relationship of the entity data after identification to obtain entity relationship data comprises: Extracting the associated relationship of the identified entity data to obtain entity initial relationship data; Perform classification weighting according to the association relationship degree of the initial relationship data of the entities to obtain a corresponding relationship degree value; The entity relationship data is constructed according to the entity initial relationship data and the relationship degree values thereof.
6. The method for constructing a government data cube based on a knowledge graph according to claim 1 is characterized in that: The step of performing cube construction processing on the multi-dimensional knowledge graph of government service items through a preset cube construction model to construct a government data cube includes: Using the dimensional benchmark data ID in the multi-dimensional knowledge graph of government service items as a basis, encoding the corresponding dimensional column data, and using surrogate keys to replace the original dimensional values, so as to construct a basic cube through the processed graph database; The basic cube is processed by cube construction through MapReduce construction algorithm to obtain the government data cube.
7. The method for constructing a government data cube based on a knowledge graph according to claim 6 is characterized in that: The step of performing cube construction processing on the basic cube by using the MapReduce construction algorithm to obtain the government data cube includes: Slicing the basic cube and forming key-value pairs; At least one dimension is removed by a preset removal rule to generate a new key-value pair; Aggregate the values with the same key to obtain the key-value pair with the minimum value, and output the new basic cube; The above steps are executed repeatedly until the number of dimension combinations of the new basic cube reaches the preset maximum number of dimension combinations, and the current basic cube is used as the government data cube.
8. The method for constructing a government data cube based on a knowledge graph according to claim 1 is characterized in that: The step of optimizing and indexing the government data cube to obtain a new government data cube includes: The government data cube is compressed and optimized by using the Dwarf algorithm to obtain an optimized government data cube; An index is constructed for the optimized government data cube through a B+ tree algorithm to obtain an index data structure of the government data cube.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
10. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Power grid operation and maintenance knowledge graph construction method and system
CN115759253A
Government affair service knowledge graph construction management method and system and medium
CN117787398A
