A data association reasoning method based on a PostgreSQL database and related equipment

CN118394949BActive Publication Date: 2026-09-22HIGHGO SOFTWARE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410299941.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-15
Publication Date
2026-09-22
Estimated Expiration
2044-03-15

AI Technical Summary

Technical Problem

这使得数据关联变得复杂,尤其是在需要跨不同数据源进行关联时更为困难

Benefits of technology

[0034]本申请实施例的方法通过使用知识图谱补全技术,对数据进行多概念表示学习,使得数据关联更加高效,能够发现多源异构数据间的隐含关系以及数据推理。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394949B_ABST
    Figure CN118394949B_ABST
Patent Text Reader

Abstract

The application discloses a data correlation reasoning method based on a PostgreSQL database and related equipment, relates to computer and database technologies, and comprises the following steps: obtaining data in an existing database, defining an ontology of a knowledge graph based on the obtained data; mapping the obtained data of the database to the knowledge graph; performing multi-concept representation learning on the obtained knowledge graph to correlate and reason data; generating a corresponding query statement according to a query requirement, and performing search based on a correlation reasoning result of the knowledge graph to obtain a query result. Through the use of the knowledge graph completion technology, the embodiment of the application performs multi-concept representation learning on data, makes data correlation more efficient, and can discover the implicit relationship between multi-source heterogeneous data and data reasoning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer and database technology, and in particular to a data association reasoning method and related equipment based on PostgreSQL database. Background Technology

[0002] Traditional databases typically require explicit table structures and relationship definitions, making data management and analysis cumbersome and unsuitable for handling complex, multi-source, unstructured, or semi-structured data. These issues limit the performance of database systems in several ways: First, traditional databases lack the ability for automatic data association and discovery. With ever-increasing data volumes and diversity, users need to spend significant time and resources manually defining relationships between data points. This complicates data association, especially when cross-data source connections are required. Second, implicit relationships are difficult to discover in traditional databases. Because users need to understand the data structure and relationships in advance, implicit data associations are often overlooked, leading to the loss of many potential insights and opportunities. Furthermore, traditional database systems typically do not provide advanced data analysis and inference capabilities. Users usually need to rely on additional tools and techniques for advanced analysis such as data mining, machine learning, and inference, which increases complexity and resource requirements.

[0003] Traditional database systems struggle to infer new information from existing data relationships. This means users must know exactly what they are looking for, making it difficult to explore unknown patterns or connections. Summary of the Invention

[0004] This application provides a data association reasoning method and related device based on a PostgreSQL database. By using knowledge graph completion technology, multi-concept representation learning is performed on the data, making data association more efficient and enabling the discovery of implicit relationships between multi-source heterogeneous data and data reasoning.

[0005] This application provides a data association reasoning method based on a PostgreSQL database, including the following steps:

[0006] Obtain data from the existing database and define the ontology of the knowledge graph based on the obtained data;

[0007] Map the acquired database data to the knowledge graph;

[0008] Multi-concept representation learning is performed on the obtained knowledge graph to connect and reason about the data;

[0009] Based on the query requirements, generate the corresponding query statement, and perform a search based on the association reasoning results of the knowledge graph to obtain the query results.

[0010] Optionally, data can be retrieved from an existing database, including tables, columns, relationships, and data records.

[0011] The knowledge graph is defined based on the acquired data, including the definitions of entities, attributes, and relationships, wherein the ontology includes domain knowledge and semantic information.

[0012] Optionally, mapping the acquired database data to the knowledge graph includes:

[0013] According to the defined mapping rules, the tables in the existing database will be mapped to correspond their data with the entities and attributes of the knowledge graph;

[0014] The data in the existing database and the data in the knowledge graph are transformed to ensure consistency between the data in the existing database and the data in the knowledge graph;

[0015] Determine the primary key or unique identifier for each entity in the knowledge graph;

[0016] The mapped data is then imported into the knowledge graph.

[0017] Optionally, multi-concept representation learning can be performed on the obtained knowledge graph to associate it with reasoning data including:

[0018] Represent the head entities and relations in the knowledge graph as index vectors;

[0019] Multiple feature representations of the entity and the relationship are learned using embedded formulas;

[0020] The learned entity and relation representations are processed using convolutional layers and ReLU nonlinear activation layers to obtain enhanced entity and relation representations;

[0021] Multiple feature representations are fused into enhanced entity and relation representations, and discriminative features are learned from the enhanced entity and relation representations to optimize the feature representations;

[0022] A knowledge graph completion model is determined, and optimized entities are used as feature maps and relations are used as convolution kernels.

[0023] Optionally, learning multiple feature representations of the entity and the relation using embedding formulas includes:

[0024] Multiple feature representations of the entity and the relation are learned using the following embedding formula:

[0025]

[0026] Among them, e 1i r jThese are multiple embedded features corresponding to multiple implicit concepts of entity e1 and relation r, respectively. There are multiple embedding matrices, where m and n are the number of concepts that need to be learned for entities and relations.

[0027] Optionally, the learned feature representations of the entities and relations are processed using convolutional layers and ReLU nonlinear activation layers to obtain enhanced entity and relation representations, including:

[0028] The learned entity and relation feature representations are processed using a 1×1 convolutional layer and a ReLU nonlinear activation layer, where the ReLU nonlinear activation layer is a nonlinear activation function.

[0029] Optionally, discriminative features are learned from the enhanced entity and relation representations to optimize the feature representations to satisfy:

[0030]

[0031] Where W1 represents the projection matrix, and DN(·) represents the denoising network. Update the entity representation using denoised representations of entities and relations. This indicates that the correlation between entities and relations is captured from the channel attention branch and the spatial attention branch, respectively.

[0032] This application also proposes a computer device, which includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the steps of the data association reasoning method based on the PostgreSQL database as described above.

[0033] This application also proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the data association reasoning method based on a PostgreSQL database as described above.

[0034] The method in this application embodiment uses knowledge graph completion technology to learn multi-concept representations of data, making data association more efficient and enabling the discovery of implicit relationships between multi-source heterogeneous data and data reasoning.

[0035] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0036] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0037] Figure 1 This is a basic flowchart example of the data association reasoning method in this application embodiment;

[0038] Figure 2 This is a schematic diagram of the ontology sub-process of the definition knowledge graph of the data association reasoning method in this application embodiment;

[0039] Figure 3 This is a schematic diagram of the database data mapping to knowledge graph sub-process of the data association reasoning method in this application embodiment;

[0040] Figure 4 This is a schematic diagram of the knowledge graph construction and completion sub-process of the data association reasoning method in this application embodiment;

[0041] Figure 5 This is a schematic diagram of the data query sub-process of the data association reasoning method in this application embodiment. Detailed Implementation

[0042] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0043] To address the challenges of automated data association and discovery, as well as the discovery of implicit relationships, existing technologies rely on stored procedures and user-defined functions, or SQL queries for data association. Developers can write custom stored procedures and functions to implement data association and reasoning. However, this typically requires extensive programming and database extensions. Traditional databases can use complex SQL queries to attempt data association and discovery, but this often results in complex query statements. While these techniques attempt to solve the problems of data association and implicit relationship discovery, they generally lack efficiency, comprehensiveness, and semantic reasoning capabilities, and are prone to deviating from real-world scenarios.

[0044] Based on this, this application provides a data association reasoning method based on a PostgreSQL database, such as... Figure 1 As shown, it includes the following steps:

[0045] In step S1, data from an existing database is acquired, and an ontology for the knowledge graph is defined based on the acquired data. In some embodiments, acquiring data from an existing database includes: acquiring data from the existing database including tables, columns, relationships, and data records in the database; defining an ontology for the knowledge graph based on the acquired data, including definitions of entities, attributes, and relationships, wherein the ontology includes domain knowledge and semantic information. Specifically, this can be accomplished in the following ways: Figure 2 As shown:

[0046] In step 101, data from a traditional database is collected, including tables, columns, relationships, and data records.

[0047] In step 102, the ontology of the knowledge graph is defined, including the definitions of entities, attributes, and relationships. The ontology should include domain knowledge and semantic information.

[0048] In step 103, ensure that the data is mapped to the ontology model of the knowledge graph, and transform the data from the traditional database into the format of the knowledge graph.

[0049] In step 104, a detailed analysis of the data schema in the traditional database is conducted to understand the relationships between tables, the meaning of fields, and the structure of data, which helps in defining inference rules.

[0050] In step S2, the data obtained from the database is mapped to the knowledge graph.

[0051] In step S3, multi-concept representation learning is performed on the obtained knowledge graph to associate reasoning data, thereby discovering implicit relationships.

[0052] In step S4, a corresponding query statement is generated according to the query requirements, and a search is performed based on the association reasoning results of the knowledge graph to obtain the query results.

[0053] The method in this application embodiment uses knowledge graph completion technology to learn multi-concept representations of data, making data association more efficient and enabling the discovery of implicit relationships between multi-source heterogeneous data and data reasoning.

[0054] In some embodiments, such as Figure 3 As shown, mapping the acquired database data to the knowledge graph includes:

[0055] In step S201, according to the defined mapping rules, the tables in the existing database are mapped to correspond their data with the entities and attributes of the knowledge graph. Specifically, mapping rules can be defined according to the actual situation; for example, the names of database tables can be mapped to entity types in the knowledge graph, and column names can be mapped to attributes.

[0056] In step S202, the tables in the traditional database are mapped to correspond to the entities and attributes of the knowledge graph.

[0057] The data in the existing database and the data in the knowledge graph are transformed to ensure consistency between the two. In a specific example, in step S203, data type conversion is required because the data types may differ between the traditional database and the knowledge graph. For example, the date format is converted to ensure data consistency.

[0058] In step S204, the meaning of the data values ​​also needs to be transformed, especially the mapping between different domains. A mapping table is established to map the values ​​from the traditional database to the semantic values ​​of the knowledge graph.

[0059] In step S205, when there are multi-valued attributes in the traditional database, the data is mapped to the knowledge graph by creating duplicate attributes or mapping the multi-valued attributes to a list of attributes.

[0060] In step S206, if there are relationships between entities in the database, these relationships are mapped to relationships in the knowledge graph, and the types of relationships are defined.

[0061] Next, in step S207, the primary key or unique identifier of each entity in the knowledge graph is determined. Specifically, the primary key or unique identifier of each entity in the knowledge graph is determined to ensure the uniqueness and consistency of the data.

[0062] Finally, in step S208, the mapped data is imported into the knowledge graph. Specifically, a custom script can be used to import the mapped data from a traditional database into the knowledge graph. During the import process, the accuracy and completeness of the data are ensured.

[0063] In some embodiments, such as Figure 4 As shown, multi-concept representation learning is performed on the obtained knowledge graph to associate reasoning data including:

[0064] In step S301, the head entity e1 and relation r in the knowledge graph are represented as index vectors, for example, as high-dimensional index vectors. Then, multiple feature representations of the entity and the relation are learned using embedding formulas.

[0065] In some embodiments, learning multiple feature representations of the entity and the relationship using embedding formulas includes:

[0066] Multiple feature representations of the entity and the relation are learned using the following embedding formula:

[0067]

[0068] Among them, e 1i r j These are multiple embedded features corresponding to multiple implicit concepts of entity e1 and relation r, respectively. There are multiple embedding matrices, where m and n are the number of concepts that need to be learned for entities and relations.

[0069] In step S302, the learned feature representations of the entities and relationships are processed using convolutional layers and ReLU nonlinear activation layers to obtain enhanced entity and relationship representations.

[0070] In some embodiments, the learned feature representations of the entities and relationships are processed using convolutional layers and ReLU nonlinear activation layers to obtain enhanced entity and relationship representations, including:

[0071] The learned entity and relation feature representations are processed using 1×1 convolutional layers and ReLU nonlinear activation layers, where the ReLU nonlinear activation layer is a nonlinear activation function.

[0072] In a specific example, e can be used 1i and r j By feeding a 1×1 convolutional layer and a ReLU nonlinear activation layer into the enhanced entity and relation representation, we obtain the enhanced entity and relation representation. and This can be achieved using the following formula:

[0073]

[0074] Among them, f 1×1 This represents a 1×1 convolutional layer with the goal of cross-channel fusion. and [r1; r2; ...; r n [] represents a connection operation, and ReLU is a non-linear activation function. It connects r1, r2, ..., r... n and e 11 c 12 , ..., e 1m These channels are used as separate channels, and their features are integrated into the global representations of relations and entities, respectively. and middle.

[0075] For the entity branch, the input and output channels of ConvR1 are m and m, respectively. c1 Defined as: Where δ is a hyperparameter, The base function is m. The input channels of ConvR1 are m. c1The output channel is 1. In the relational branch, the input and output channels of ConvR1 are n and n', respectively. c1 , where n c1 The calculation method and m c1 Similarly, ConvR1 has n input channels and n output channels. c1 And 1.

[0076] To obtain the optimal entity embedding and relation embedding that conform to the current conceptual context, in step S304, multiple feature representations are fused into the enhanced entity. Relationship characteristics The following formula can be used.

[0077]

[0078] Among them, [m r ⊙r1;m r ⊙r2;…;m r ⊙r m ] and [m e ⊙e 11 ;m e ⊙e 12 ;...;m e ⊙e 1n ] Concatenated vector and The matrix form. The function SumPool(x, k) performs a weighted pooling operation on x using a 2D non-overlapping window of size (k, 1).

[0079] Discriminative features are learned from enhanced entity and relation representations to optimize the feature representation. In some embodiments, discriminative features are learned from enhanced entity and relation representations to optimize the feature representation to satisfy:

[0080]

[0081] Where W1 represents the projection matrix, and DN(·) represents the denoising network. Update the entity representation using denoised representations of entities and relations. This indicates that the correlation between entities and relations is captured from the channel attention branch and the spatial attention branch, respectively.

[0082] In step S305, a knowledge graph completion model is determined, and optimized entities are used as feature maps and relations are used as convolutional kernels. In some specific examples, a lightweight HypER knowledge graph completion model can be selected as the decoder. HypER uses entities as feature maps and relations as convolutional kernels to enhance the interactivity between entities and relations.

[0083] In step S4, a corresponding query statement is generated based on the query requirements, and a search is performed based on the association reasoning results of the knowledge graph to obtain the query results. For example... Figure 5 As shown, some specific examples can be implemented in the following ways:

[0084] In step 401, a corresponding SQL query statement is generated according to the query requirements. The query statement may include association conditions, filtering conditions, and sorting methods.

[0085] In step 402, the generated query statement is sent to the database and the query operation is executed. The related information and reasoning results from knowledge graph completion technology are used to search and match within the data.

[0086] In step 403, a result set matching the query conditions is returned, and the returned data is parsed and processed based on the query results.

[0087] In step 404, the required related information is extracted and further processed, analyzed, or displayed as needed. This application's knowledge graph-based method enables database systems to interpret queries more intelligently and automatically optimize query execution plans to improve query performance, which helps meet complex query requirements.

[0088] The method in this application allows data to be associated with a knowledge graph, making the semantic relationships between data clearer and richer, going beyond the tabular format of a database and making it easier to establish complex relationships between entities. Through the knowledge graph's inference engine, it allows for automatic inference based on existing data, generating new relationships and knowledge, facilitating the discovery of hidden information and potential connections, going beyond static data stored in a database, making it easier to automatically infer and discover new knowledge, without requiring users to manually define relationships. This helps eliminate data silos and makes the relationships between different datasets clearer and easier to understand.

[0089] This application also proposes a computer device, which includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the steps of the data association reasoning method based on the PostgreSQL database as described above.

[0090] This application also proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the data association reasoning method based on a PostgreSQL database as described above.

[0091] It should be noted that, in the embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0092] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0093] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0094] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims. All of these forms are within the protection scope of this application.

Claims

1. A data association reasoning method based on a PostgreSQL database, characterized in that, The steps include the following: Obtain data from the existing database and define the ontology of the knowledge graph based on the obtained data; Map the acquired database data to the knowledge graph; Multi-concept representation learning is performed on the obtained knowledge graph to connect and reason about the data; Based on the query requirements, generate the corresponding query statement, and perform the search based on the association reasoning results of the knowledge graph to obtain the query results; Multi-concept representation learning is performed on the obtained knowledge graph to connect inference data including: Represent the head entities and relations in the knowledge graph as index vectors; Multiple feature representations of the entity and the relationship are learned using embedded formulas; The learned entity and relation representations are processed using convolutional layers and ReLU nonlinear activation layers to obtain enhanced entity and relation representations; Multiple feature representations are fused into enhanced entity and relation representations, and discriminative features are learned from the enhanced entity and relation representations to optimize the feature representations; Determine the knowledge graph completion model, and use the optimized entities as feature maps and relations as convolution kernels; Learning multiple feature representations of the entity and the relation using embedding formulas includes: Multiple feature representations of the entity and the relation are learned using the following embedding formula: in, , Entities and relationships r Multiple implicit concepts correspond to multiple embedded features. , There are multiple embedding matrices, where m and n are the number of concepts that need to be learned for entities and relations; Discriminative features are learned from enhanced entity and relation representations to optimize the feature representations to satisfy: in, Represents the projection matrix. This represents a denoising network. Update the entity representation using denoised representations of entities and relations. This indicates that the correlation between entities and relations is captured from the channel attention branch and the spatial attention branch, respectively.

2. The data association reasoning method based on PostgreSQL database as described in claim 1, characterized in that, Retrieve data from an existing database, including tables, columns, relationships, and data records. The knowledge graph is defined based on the acquired data, including the definitions of entities, attributes, and relationships, wherein the ontology includes domain knowledge and semantic information.

3. The data association reasoning method based on a PostgreSQL database as described in claim 1, characterized in that, Mapping the acquired database data to the knowledge graph includes: Based on the defined mapping rules, the tables in the existing database are mapped to correspond their data with the entities and attributes of the knowledge graph; Transform the data in the existing database and the data in the knowledge graph to ensure consistency between the data in the existing database and the data in the knowledge graph; Determine the primary key or unique identifier for each entity in the knowledge graph; The mapped data is then imported into the knowledge graph.

4. The data association reasoning method based on PostgreSQL database as described in claim 1, characterized in that, The learned feature representations of the entities and relationships are processed using convolutional layers and ReLU nonlinear activation layers to obtain enhanced entity and relationship representations, including: The learned entity and relation feature representations are processed using 1×1 convolutional layers and ReLU nonlinear activation layers, where the ReLU nonlinear activation layer is a nonlinear activation function.

5. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that, when executed by the processor, implements the steps of the data association reasoning method based on a PostgreSQL database as described in any one of claims 1 to 4.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data association reasoning method based on a PostgreSQL database as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Intelligent question answering method and system based on domain knowledge graph

    CN117648984A

  • Conversational reasoning with knowledge graph paths for assistant systems

    US11442992B1