Automatic method and device for converting relational data into attribute graph
By inputting relational data into large language models and using semantic transformation syntax to automatically generate and update the ontology collection, the problem of difficulty in capturing implicit associations in data in the existing technology is solved, and more accurate and comprehensive big data relationship representation and management is achieved.
Patent Information
- Application Number
- CN202510272237.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-03-10
AI Technical Summary
The prior art is difficult to automatically capture all relationships in data, especially implicit associations, resulting in complexity in information management in the field of biosecurity.
By inputting data relational patterns and data instances in relational data into the large language model, an initial ontology collection is generated, and the ontology collection is updated according to the weighted score of the initial attribute data, and the target ontology collection is generated. Then, the target ontology collection is mapped using semantic transformation syntax to construct a property graph.
It realizes automatic identification and capture of potential associations in the data, and the generated attribute map is more comprehensive and accurate, which can meet users' personalized query needs.
Smart Images

Figure CN119782405A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of general relational data and artificial intelligence technology, and in particular to an automated method and device for converting relational data into an attribute graph. Background Art
[0002] The attribute graph is a graphical structure based on entities and relationships. In general relational data, the attribute graph is used to represent and manage biological entities (such as viruses, bacteria, etc.) and the relationships between biological entities (such as the relationship between viruses and diseases, etc.), so as to solve complex information problems in the field of biosafety.
[0003] Property graphs usually rely on expert definitions or simple constraints, which makes it difficult to capture all relationships in the data. For example, in relational data, entity relationships are often defined through foreign key constraints. This approach can handle explicit relationships, but it is difficult to discover potential implicit associations that may exist between data. Summary of the invention
[0004] In view of the above problems, the present invention provides an automated method and device for converting relational data into a property graph.
[0005] According to a first aspect of the present invention, there is provided an automated method for converting relational data into an attribute graph, comprising: inputting a relational pattern of data in the relational data and a data instance corresponding to the relational pattern into a large language model to obtain an initial ontology set, the initial ontology set comprising a plurality of initial entities and association relationships between the plurality of initial entities, the initial entity comprising at least one initial attribute data extracted from attribute sampling data, the attribute sampling data being sampled and extracted from the data instance; updating the initial ontology set according to weighted scores of each initial attribute data in the initial entity to obtain a target ontology set, the weighted score being determined according to user query frequency and information entropy of the initial attribute data; mapping the target ontology set using a semantic transformation grammar to obtain a relational algebra of the target ontology set, the relational algebra being used to retrieve relational data; and constructing an attribute graph based on the target ontology set and the relational algebra.
[0006] According to an embodiment of the present invention, the initial ontology set is updated according to the weighted scores of each initial attribute data in the entity to obtain the target ontology set, including: for each initial entity, calculating the weighted score of the initial attribute data in the initial entity; when the weighted score meets a preset threshold, determining the initial attribute data as the target entity; and updating the initial ontology set according to the target entity to obtain the target ontology set.
[0007] According to an embodiment of the present invention, for each initial entity, calculating the weighted score of the initial attribute data in the initial entity includes: for each initial entity, calculating the query score of the initial attribute data according to the user query frequency; calculating the information score of the initial attribute data according to the information entropy of the initial attribute data; and performing weighted summation of the query score and the information score to obtain a weighted score.
[0008] According to an embodiment of the present invention, updating the initial ontology set according to the target entity to obtain the target ontology set includes: extracting target attribute data of the target entity from the initial attribute data in the initial entity; using a large language model to determine the target association relationship between the target entity and multiple initial entities in the initial ontology set; adding the target attribute data and the target association relationship of the target entity to the initial ontology set to obtain the target ontology set.
[0009] According to an embodiment of the present invention, relational algebra includes projected relational algebra, and the target ontology set is mapped using semantic transformation syntax to obtain the relational algebra of the target ontology set, including: for target attribute data in the target entity coming from the same relational model, projection operation is performed on the target attribute data to obtain projected relational algebra; for target attribute data in the target entity coming from different relational models, query mappings of different relational models are established.
[0010] According to an embodiment of the present invention, relational algebra also includes full outer join relational algebra and inner join relational algebra. For target attribute data in a target entity coming from different relational schemas, establishing query mappings for different relational schemas includes: for target attribute data in a target entity coming from different relational schemas, performing a full outer join operation on the target attribute data to obtain a full outer join relational algebra; performing an inner join between different relational schemas to obtain an inner join relational algebra.
[0011] According to an embodiment of the present invention, constructing a property graph based on a target ontology set and relational algebra includes: constructing a property graph based on a target ontology set, projection relational algebra, full outer join relational algebra and inner join relational algebra, entities and target entities are nodes of the property graph, and the connecting edges between the nodes represent the association relationship between multiple entities or an entity and a target entity.
[0012] According to an embodiment of the present invention, the method further includes: sampling data from the relational data according to a data sampling strategy to obtain multiple groups of attribute sampling data under the relational model, and the data collection strategy is determined according to the data value range in the relational data.
[0013] According to an embodiment of the present invention, data sampling is performed from relational data according to a data sampling strategy to obtain multiple groups of attribute sampling data under the relational model, including: dividing a data set in the relational data into multiple subsets according to a data value range, the multiple subsets representing different data value ranges; and data sampling is performed from multiple subsets of the relational data respectively to obtain attribute sampling data under the relational model.
[0014] The second aspect of the present invention provides an automated device for converting relational data into an attribute graph, comprising: an input module, used to input the relational model of data in the relational data and the data instance corresponding to the relational model into a large language model to obtain an initial ontology set, wherein the initial ontology set includes multiple initial entities and the association relationships between the multiple initial entities, and the initial entity includes at least one initial attribute data extracted from attribute sampling data, and the attribute sampling data is obtained by sampling and extracting from the data instance; an update module, used to update the initial ontology set according to the weighted score of each initial attribute data in the initial entity to obtain a target ontology set, and the weighted score is determined according to the user query frequency and information entropy of the initial attribute data; a mapping module, used to map the target ontology set using a semantic transformation grammar to obtain a relational algebra of the target ontology set, and the relational algebra is used to retrieve relational data; a construction module, used to construct an attribute graph based on the target ontology set and the relational algebra.
[0015] A third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above method.
[0016] The fourth aspect of the present invention further provides a computer-readable storage medium having an executable computer program stored thereon, which implements the steps of the above method when executed by a processor.
[0017] The fifth aspect of the present invention also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0018] According to the automated method and device for converting relational data into an attribute graph provided by the present invention, the relational pattern of data in the relational data and the data instance corresponding to the relational pattern are input into a large language model to obtain an initial ontology set. Therefore, the large language model can be used to analyze the potential association between data in the data instance, making the initial text set more accurate. The initial ontology set is updated according to the weighted score of each initial attribute data in the initial entity to obtain a target ontology set. Since the weighted score is determined according to the user query frequency and information entropy of the attribute data, the personalized query needs of the user can be met.
[0019] The target ontology set is mapped using semantic transformation syntax to obtain the relational algebra of the target ontology set; a property graph is constructed based on the target ontology set and the relational algebra, so that the data relationship presented by the constructed property graph is more comprehensive and accurate, and can also meet the user's personalized query needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0021] Figure 1 An application scenario diagram of an automated method for converting relational data into a property graph according to an embodiment of the present invention is shown;
[0022] Figure 2 A flowchart of an automated method for converting relational data into a property graph according to an embodiment of the present invention is shown;
[0023] Figure 3 A schematic diagram of the output of a large language model according to an embodiment of the present invention is shown;
[0024] Figure 4 A schematic diagram showing how to update the initial ontology set according to the weighted scores of each initial attribute data in the initial entity to obtain the target ontology set;
[0025] Figure 5 A schematic diagram showing, for each initial entity, calculating a weighted score of initial attribute data in the initial entity according to an embodiment of the present invention;
[0026] Figure 6 A schematic diagram showing an automated method for converting relational data into a property graph according to an embodiment of the present invention;
[0027] Figure 7 A structural block diagram of an automated device for converting relational data into an attribute graph according to an embodiment of the present invention is shown;
[0028] Figure 8 A block diagram of an electronic device suitable for implementing an automated method for converting relational data into a property graph according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0029] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.
[0030] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0031] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0032] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0033] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, invention and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0034] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present invention provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.
[0035] An embodiment of the present invention provides an automated method for converting relational data into an attribute graph, comprising: inputting a relational pattern of data in relational data and a data instance corresponding to the relational pattern into a large language model to obtain an initial ontology set, wherein the initial ontology set includes multiple initial entities and association relationships between the multiple initial entities, and the initial entity includes at least one initial attribute data extracted from attribute sampling data, and the attribute sampling data is obtained by sampling and extracting from the data instance; updating the initial ontology set according to the weighted score of each initial attribute data in the initial entity to obtain a target ontology set, and the weighted score is determined according to the user query frequency and information entropy of the initial attribute data; mapping the target ontology set using a semantic transformation grammar to obtain a relational algebra of the target ontology set, and the relational algebra is used to retrieve relational data; and constructing an attribute graph based on the target ontology set and the relational algebra.
[0036] Figure 1 An application scenario diagram of an automated method for converting relational data into a property graph according to an embodiment of the present invention is shown.
[0037] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0038] The user may use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0039] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0040] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0041] It should be noted that the automated method for converting relational data into a property graph provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the automated device for converting relational data into a property graph provided in the embodiment of the present invention can generally be set in the server 105. The automated method for converting relational data into a property graph provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the automated device for converting relational data into a property graph provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0042] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only . According to the implementation requirements, there can be any number of terminal devices, networks and servers.
[0043] Figure 2 A flow chart of an automated method for converting relational data into a property graph according to an embodiment of the present invention is shown.
[0044] like Figure 2 As shown, the automated method for converting relational data into a property graph in this embodiment includes operations S210 to S240.
[0045] In operation S210, the relational schema of data in the relational data and the data instances corresponding to the relational schema are input into the large language model to obtain an initial ontology set.
[0046] According to an embodiment of the present invention, a relational schema may be a basic concept for describing a data structure in relational data, and a relational schema may define a name of a relational table, attribute sampling data and its attribute type. The name of the relational table is usually the name of the data described.
[0047] According to an embodiment of the present invention, the relational schema includes at least one attribute data for describing data, and the attribute sampling data is obtained by sampling and extracting from a data instance.
[0048] Define the relational schema of data in relational database R j for( ). They are different attribute sampling data. For example, the data can be virus transmission information in biosafety, and the relationship model of virus transmission information involves (pathogens, hosts, transmission routes, and prevention and control measures).
[0049] Data instances can be biosafety-related documents and reports stored in relational data. Biological experts construct entity types and attributes contained in entities based on their experience. Attribute sampling data can include expert experience attribute data, and can also include attribute data obtained by extracting attribute features from data instances.
[0050] For example, applying a large language model as a classifier to an ontology generation tool can support and improve the process of acquiring and representing biological knowledge in data instances.
[0051] Figure 3 A schematic diagram of the output of a large language model according to an embodiment of the present invention is shown.
[0052] The large language model can automatically extract ontology information from relational patterns and data instances. The process includes identifying entity types in relational patterns and understanding the semantics of the relationships between multiple entities. Data instances can be text summaries of corresponding relational patterns. The output of the large language model is to identify relevant entity types and their attributes in data instances and attribute sampling data, relationships between entity types, and relationships between entity instances. Entity types can represent an entity.
[0053] According to an embodiment of the present invention, the initial ontology set includes a plurality of initial entities and association relationships between the plurality of initial entities, and the initial entity includes at least one initial attribute data extracted from the attribute sampling data.
[0054] For example, for entity type extraction in a large language model, the process is described as follows: For each relation pattern R j Attribute A in i , the large language model will output a relevant entity . Among them A ijis a specific attribute name, so in the relational schema R j In the large language model, entity V in this pattern oi All properties of When entity V oi` The attributes are spread across multiple modes (such as R j and R k ), the large language model uses foreign key dependencies to merge attributes to form the same entity. Specifically, according to the foreign key definition in relational data, for a given foreign key in the attributes of different relational tables in the database , which represents the same as A i The entity associated with A j The associated entities are the same, i.e. A i , A j Describes the same entity information, so the attribute A traversed later can be j Merge to A i In the entity to which it belongs. In addition, construct an attribute tuple, represented as , and update the relevant attributes and entities in the attribute tuple. As more attributes of entity 𝑣 are identified through the entity recognition process, the attribute tuple is continuously updated To include newly recognized attributes. In addition, the big language model will standardize the naming format of the data.
[0055] For the same relational model R j The entity type in the large language model recognizes the relationship between pairs of entities, represented as v i and v j The relationship between entities is represented by a link v i and v j The edge of the i, v j ). The big language model can explain the semantics of the relationship between entities. Entities are presented as nodes in the attribute graph, and the relationship between entities is presented as edges between nodes in the attribute graph. The direction of the edge between nodes can be determined by the big language model or based on the specific needs of the downstream task.
[0056] The prompts of the large language model are organized into three parts: instruction, input, and output. Instruction describes the goal, input includes attribute sampling data, data instances, and related entities, and output details the relationship between the above three. For the training of the large language model, hundreds of ontologies can be selectively extracted for training, which are specially designed for extracting ontologies, including attribute sampling data related to features, entity names, relationships between entities, and specific data instances. The structure of the prompt word is as follows Figure 3As shown in the input, hints help maintain consistent labels of relational data according to the trained ontology, improving the overall quality and uniformity of the extracted data.
[0057] The map construction method of the embodiment of the present invention is not limited to the biosafety direction, and can also be used for map construction in other directions. Figure 3 The input prompt words and output templates are provided in the output template. After inputting the relational model and its corresponding data instance, the large language model will output the entity type and attribute information. For example, import other relational data in the output template: including the relational model (student name, student number, instructor name) and related data instances into the large language model, and then output the entities and the relationships therein. The output can be: Entity 1: student, attributes include student name and student number; Entity 2: instructor, attributes include instructor name; students and instructors have a teacher-student relationship, and the semantics of this relationship can be automatically generated by the large language model.
[0058] In operation S220, the initial ontology set is updated according to the weighted scores of each initial attribute data in the initial entity to obtain a target ontology set.
[0059] According to an embodiment of the present invention, the weighted score is determined based on the user query frequency and information entropy of the initial attribute data.
[0060] According to an embodiment of the present invention, the user query frequency represents the number of times a user queries the initial attribute data in the relational data within a certain period of time.
[0061] According to an embodiment of the present invention, information entropy is used to evaluate the frequency of occurrence of attribute values. In the case of less diversity of attribute values, information entropy can be used to evaluate initial attribute data with greater query value.
[0062] For example, the initial entity is bacteria, and the initial attribute data of bacteria include decomposition, symbiotic relationship, disease caused, and type. The weighted score of the symbiotic relationship in the initial attribute data meets the threshold for promotion from attribute to entity, and the symbiotic relationship in the initial attribute data can be determined as the target entity in the target ontology set. Then, the semantic relationship between the symbiotic relationship and other target entities is analyzed to determine the relationship between the target entities.
[0063] Figure 4 A schematic diagram is shown of updating the initial ontology set according to the weighted scores of each initial attribute data in the initial entity to obtain the target ontology set.
[0064] While the initial attribute data can be viewed as attributes of the initial entity in a relationship, the initial attribute data can also be viewed as the entity itself.
[0065] For example, in Figure 4In the example, (a) the database fragment includes data such as "name", "student number" and "address". (b) The result before optimization only presents the corresponding data.
[0066] The “address” attribute can be considered as both a property of the original entity and an entity itself. It is worth noting that treating certain attributes as entities can improve performance and reduce query response time in some query-intensive applications.
[0067] For example, consider Figure 4 The user query (c) in Figure 1 extracts the information of place A, aiming to query the database log to return all customers whose address is "place A". If the "address" attribute is considered as an entity, the optimized result (d) can be found by checking the "place A" entity, that is, all data related to "place A" is presented, while data related to "place B" is not queried out.
[0068] However, if "A place" is not considered as an entity, it is necessary to search all customer entities and check their attributes to find the desired results. The target ontology collection can include the entity "A place", and the target attribute data includes "name" and "student number".
[0069] In order to decide which initial attribute data should be promoted to entities, a scoring mechanism called "benefit gain" is introduced. This scoring combines two aspects: user query frequency and information entropy. Initial attribute data that does not appear frequently but appears frequently in historical queries will receive a higher weighted score and is more likely to be promoted to an independent entity.
[0070] In operation S230, the target ontology set is mapped using a semantic transformation grammar to obtain a relational algebra of the target ontology set.
[0071] According to an embodiment of the present invention, relational algebra is used to search relational data.
[0072] According to an embodiment of the present invention, the semantic transformation grammar may be STG (Semantic Tree Grammar), which can map the target ontology set to a set of algebraic queries without losing any information. Once a set of relational algebras is generated, these queries are executed using mature relational query optimization and execution techniques. The query results are then used to generate a property graph.
[0073] In operation S240 , a property graph is constructed based on the target ontology set and relational algebra.
[0074] According to an embodiment of the present invention, the nodes in the property graph represent target entities in the target ontology set, and the edges between the nodes represent the relationships between the target entities.
[0075] According to an embodiment of the present invention, an initial ontology set is obtained by inputting the relational model of data in relational data and the data instance corresponding to the relational model into a large language model. Therefore, the large language model can be used to analyze the potential association between the data in the data instance, making the initial text set more accurate. The initial ontology set is updated according to the weighted scores of each initial attribute data in the initial entity to obtain a target ontology set. Since the weighted scores are determined based on the user query frequency and information entropy of the attribute data, the personalized query needs of the user can be met. The target ontology set is mapped using a semantic transformation grammar to obtain the relational algebra of the target ontology set; a property graph is constructed based on the target ontology set and the relational algebra, so that the data relationship presented by the constructed property graph is more comprehensive and accurate, and can also meet the personalized query needs of the user.
[0076] The construction of property graphs usually relies on expert definitions or simple constraints, which may not fully capture all relationships in the data. The large language model is trained using a wide range of data sources, covering multiple fields and topics, and can understand the semantics of the data and the complex relationships between data points. The large language model has a more comprehensive and precise understanding ability, can automatically identify relevant points in the data, and capture potential relationships between entities, including implicit and non-explicit associations. It makes it possible to have a more comprehensive description of entities and their relationships in the data, thereby generating a more accurate and complete ontology.
[0077] The intuitive way to generate ontology from relational data is to input the relational schema into a large language model, which can then infer the ontology present in the relational schema. However, this approach is limited by the lack of concrete data support for the relational schema itself, making it difficult for the large language model to fully understand the complex relationships and changes in real-world data. In addition, without a detailed description of the specific data, it may be difficult for the language model to understand the various situations and anomalies that may occur in the actual data. If the relational schema itself is erroneous or incomplete, it may also have a negative impact on the accuracy of the output of the large language model.
[0078] To address these limitations, relational schemas and data instances can be input into a large language model. However, processing large-scale data instances may result in high computational costs, and much of the data may be redundant for ontology generation, thereby reducing the efficiency and accuracy of the ontology construction process. To overcome this challenge, representative data samples are selected or key features are extracted to create compressed data summaries. The data summary represents the key information extracted from the original data, captures key data features and relational schemas, and makes it possible to better understand the relationships in real-world data. By analyzing and processing this data summary, a balance can be achieved between computing resource utilization and ontology construction accuracy. Therefore, selecting a suitable data summary becomes a key issue that needs to be addressed in this context. The present invention can first perform text processing such as cleaning and speech analysis on the data instance to obtain a key data summary. The data summary and its corresponding relational schema are then input into the large language model to obtain an initial ontology set.
[0079] According to an embodiment of the present invention, the method further includes: sampling data from the relational data according to a data sampling strategy to obtain multiple groups of attribute sampling data under the relational model, and the data collection strategy is determined according to the data value range in the relational data.
[0080] The attribute sampling data in the multi-group relationship mode can cover all data value ranges and clearly show the structural characteristics of data values. The attribute sampling data can include information about data format, data range and data dependency to enhance the understanding of the attribute sampling data.
[0081] For example, those aged between 16 and 18 may be students. Small and non-cellular structures may be viruses. However, due to the input limitations of large language models, it is not feasible to directly input all data. Therefore, the most representative attribute sampling data is input after sampling to optimize the use of the available input space.
[0082] In order to aggregate data, a data sampling strategy is designed, which is determined according to the data value range in the relational data.
[0083] According to an embodiment of the present invention, data sampling is performed from relational data according to a data sampling strategy to obtain multiple groups of attribute sampling data under the relational model, including: dividing a data set in the relational data into multiple subsets according to a data value range, the multiple subsets representing different data value ranges; and data sampling is performed from multiple subsets of the relational data respectively to obtain attribute sampling data under the relational model.
[0084] For example, if the number of instances is 100, but the attribute data value range can be 1-100, the data set can be divided into multiple subsets with different data value ranges according to the data value range. That is, the attribute data value range of the first subset is 1-20, the attribute data value range of the second subset is 20-40... The attribute data value range of the fifth subset is 80-100, ensuring that the data set used to train the large language model is both diverse and representative.
[0085] For example, if the number of instances is 100, the dataset can be divided into 10 subsets. Data is then randomly sampled from each subset. The effectiveness of our sampling method is evaluated by examining the characteristics of the sampled data. This is achieved by verifying whether the value domain of the sampled data comprehensively covers the entire range of data values. If the value domain is incomplete, indicating a lack of characteristics, adjustments are made based on the initial sampling results. These adjustments may include dynamically changing the sampling rate or adjusting the sampling area, taking into account the characteristics of the samples obtained. Emphasis is placed on enhancing data diversity while eliminating redundancy. This is achieved by removing duplicate or redundant data points from the sampled data. Subsequently, resampling is performed from the refined data pool to supplement the initial sample, ensuring that the dataset used to train the large language model is both diverse and representative.
[0086] Although large language models can understand the relationships in data to a certain extent, they still have limitations. For example, large models may encounter bias or incompleteness when dealing with expertise or complex relationships in a specific field. To overcome these limitations, you can choose to leverage multiple property graph ontologies built by domain experts, which contain rich information about entities and their relationships. By combining these ontologies with large language models, the model's domain knowledge can be further enhanced, achieving more accurate ontology construction.
[0087] The enhancement of the large language model uses an ontology integration strategy, where the training data is enriched with multiple ontologies, focusing mainly on DBpedia ontologies (a structured framework used by DBpedia ontologies to describe and organize knowledge), while also integrating other ontology resources. More specifically, to integrate multiple ontology data sources, an ontology merging approach is used. This process is based on an ontology knowledge base, with DBpedia ontologies as the underlying structure. The result is a new ontology structure , The new ontology contains entity type information and relationship information between entities. In the merging process, the knowledge of multiple ontologies is transferred to the newly created ontology structure. To achieve this, different information needs to be merged according to the specified common format. Alignment. After alignment, the knowledge content of each individual ontology is merged and integrated into the newly established ontology structure. The output of this merging process is a unified ontology. , which is then used to enhance and improve the capabilities of large language models.
[0088] According to an embodiment of the present invention, the initial ontology set is updated according to the weighted scores of each initial attribute data in the entity to obtain the target ontology set, including: for each initial entity, calculating the weighted score of the initial attribute data in the initial entity; when the weighted score meets a preset threshold, determining the initial attribute data as the target entity; and updating the initial ontology set according to the target entity to obtain the target ontology set.
[0089] According to an embodiment of the present invention, the weighted scores of the initial attribute data in the initial entity are sorted, and a preset threshold is set based on the weighted scores ranked at a preset position. That is, the initial attribute data with weighted scores before the preset position ranking is determined as the target entity. For example, the initial attribute data with the first k weighted scores are determined as the target entity, where k is an integer greater than 1.
[0090] The preset threshold can be adjusted according to actual conditions and is not limited here.
[0091] According to an embodiment of the present invention, for each initial entity, calculating the weighted score of the initial attribute data in the initial entity includes: for each initial entity, calculating the query score of the initial attribute data according to the user query frequency; calculating the information score of the initial attribute data according to the information entropy of the initial attribute data; and performing weighted summation of the query score and the information score to obtain a weighted score.
[0092] Given an attribute A i , weighted score The definition is as follows:
[0093] (1);
[0094] where 𝛼 is a weight parameter in the range [0, 1], Defined as A i The information score is calculated as:
[0095] (2);
[0096] p(x i ) means when the value is x i Time A i Query(A i ) is A i The query score of n represents the number of initial attribute data, which is determined by normalizing its frequency of appearance in the historical query log.
[0097] Figure 5 A schematic diagram is shown of calculating a weighted score of initial attribute data in an initial entity for each initial entity according to an embodiment of the present invention.
[0098] Given a relational table such as Figure 5 As shown, the attribute sampling data included in the relationship table are "name", "address" and "other content".
[0099] Large language models (such as Figure 5 The classifier in ( ) outputs the initial ontology set, such as the initial ontology set including the entity "customer", and the initial attribute data includes "name", "address" and "other content".
[0100] By querying the log, we can get the query scores corresponding to the three initial attribute data. By sampling, we can calculate the information score of the initial attribute data based on the information entropy of the three initial attribute data. The weights of the query score and the information score are 0.5 respectively, and the weighted score of the initial attribute data "address" can be calculated ( Figure 5 The total score in the initial ontology is the highest among the three weighted scores, and the initial attribute data "address" can be selected as the target entity. Then, the target association relationship between the target entity and multiple initial entities in the initial ontology set is determined using the large language model.
[0101] According to an embodiment of the present invention, updating the initial ontology set according to the target entity to obtain the target ontology set includes: extracting target attribute data of the target entity from the initial attribute data in the initial entity; using a large language model to determine the target association relationship between the target entity and multiple initial entities in the initial ontology set; adding the target attribute data and the target association relationship of the target entity to the initial ontology set to obtain the target ontology set.
[0102] According to an embodiment of the present invention, the large language model can be used to semantically analyze the initial attribute data associated with the target entity in the data instance, and the initial attribute data associated with the target entity can be determined as the target attribute data.
[0103] For example, from the initialization Set:= First, use the large language model to extract the relational pattern of the relational data and the actual text corresponding to the relational pattern, and update the output entities and the relationships between entities into the Set.
[0104] More specifically, for each relational schema R i and its data instances, the ontology generation tool applies the large language model to generate entities. Then the entities and attributes are updated to the initial ontology Set to obtain the initial ontology set. If the entity is already part of the ontology, the ontology generation tool will update the ontology with attribute A; if the entity is not yet in the ontology (i.e., a new entity), the entity is added to the ontology 𝑂, and the initial ontology set is updated and the corresponding attributes are inserted.
[0105] Next, the relations generated by the large language model are updated into the new initial ontology set to obtain the target ontology set. More specifically, for the same R i The ontology generation tool generates a new relation E using the large language model for the entities generated under the same relation (i.e., belonging to the same relational schema). Next, the gain score of each attribute A is calculated. Then, the attribute A with a high weighted score is extracted. j , and A j Treat as target entity V Aj Finally, V Aj and its new relations are updated to the initial ontology set 𝑆𝑒𝑡.
[0106] The specific steps include: Initialize the entity O as Set= (empty set); for each relational schema R i , use the large language model to extract the ontology of the relational model and obtain the initial entity Entity i , integrate to generate a set of relationship entity pairs { j, Entity i >}.
[0107] For each attribute entity pair j, Entity i >, if the initial entity Entity i Already in ontology O, use Entity i Updating Entity i , A j Update the Entity added to O i Otherwise, Entity i Add to the body O. At the same time, for each i The entity pairs generated under i , Entity j ), using a large language model to generate entity pairs (Entity i , Entity j ) to obtain the target ontology set.
[0108] According to an embodiment of the present invention, relational algebra includes projected relational algebra, and the target ontology set is mapped using semantic transformation syntax to obtain the relational algebra of the target ontology set, including: for target attribute data in the target entity coming from the same relational model, projection operation is performed on the target attribute data to obtain projected relational algebra; for target attribute data in the target entity coming from different relational models, query mappings of different relational models are established.
[0109] According to an embodiment of the present invention, relational algebra also includes full outer join relational algebra and inner join relational algebra. For target attribute data in a target entity coming from different relational schemas, establishing query mappings for different relational schemas includes: for target attribute data in a target entity coming from different relational schemas, performing a full outer join operation on the target attribute data to obtain a full outer join relational algebra; performing an inner join between different relational schemas to obtain an inner join relational algebra.
[0110] Given a relational schema and an entity , Vo represents entity, E O Represents entity relationships and defines a set of mappings from R to O, which includes:
[0111] Attribute tuple: For each entity v in the ontology, there is a set of attribute tuples x,…,y associated with it. This tuple is defined as the mapping attributes of entity v, denoted as $v. The mapped attributes can be denoted as $vx, ...,$vy.
[0112] Entity generation rule: For each entity in the ontology, there is a mapping rule from the attribute A in R to the attribute of entity v, expressed as .
[0113] Relationship generation rules: for each relationship between entities in the ontology, a rule is generated for a given entity. and , there exists a mapping rule from the attribute pair (A, B) in R to the entity relationship (u, v).
[0114] In terms of implementation, STG is explained using a set of algebraic queries. For each entity generation rule, there exists an algebraic query Q v To specify how to generate an instance of an entity, where Q is defined as follows: For a relational schema R i The attributes A1, ... An in this case , for different relational models .
[0115] (3);
[0116] in Represents the full outer join symbol.
[0117] For each relationship, generate a rule (representing the mapping rule of attribute pairs (A, B) to entity relationships (u, v)) There is an algebraic query , indicating that attributes A and B are in Inner join in .
[0118] According to an embodiment of the present invention, constructing a property graph based on a target ontology set and relational algebra includes: constructing a property graph based on a target ontology set, projection relational algebra, full outer join relational algebra and inner join relational algebra, entities and target entities are nodes of the property graph, and the connecting edges between the nodes represent the association relationship between multiple entities or an entity and a target entity.
[0119] STG maps ontology to a set of algebraic queries. The generated relational algebraic queries can generate a property graph G, where nodes create properties through queries defined by rules for entity generation, and edges are generated through queries defined by rules for relationship generation. The rules of STG can be obtained during ontology generation, while algebraic queries can be obtained based on the semantic definition of STG.
[0120] In STG, the relationship generation rules determine the relationship between entities based on the relationship between attribute subsets of different entities, but only when these subsets exist in a single relationship. If the attributes of two entities do not co-occur, it means that there is no direct relationship between the two entities. Indirect relationships are not considered at this stage, but they can be incorporated into the generated graph through optimization techniques.
[0121] The STG conversion process does not result in any information loss. We demonstrate this by checking whether the original database can be reconstructed from the generated graph by reverse transformation.
[0122] A transformation from a relational schema R to an attribute graph G is considered lossless if it satisfies the following conditions: First, the transformation is injective, meaning that each element in the original database can be uniquely mapped to an element in the generated graph. Second, the transformation is surjective, meaning that each element in the generated graph has a corresponding element in the original database.
[0123] By satisfying these conditions, we can ensure that the STG conversion process preserves all information present in the original database, allowing for a complete reconstruction of the database from the generated graph.
[0124] The STG transformation has the property of losslessness. The losslessness property is proved in the following ways: (1) Injection. Injection is obvious. During the ontology construction process, each attribute of the relation schema R corresponds to a unique entity type in O. This ensures that each element (attribute) in the relation instance is mapped to a single attribute of the corresponding entity instance in the attribute graph G. (2) Surjection. To prove surjectivity, show that the relation instance I' obtained by a set of mappings from R to O is equivalent to the original relation instance I. Equivalence here means that the set of tuples in I and I' is the same, regardless of the order of the tuples. The construction process of I' is as follows: for each entity generation rule and the attribute tuple to which the entity belongs, a table is created by summarizing all entity groups of the same entity, and then each entity table is combined or a new relational table is created according to the relational generation rule. At this time, for the newly constructed I', it is necessary to prove that I can be transformed into I' through a finite number of transformations, and define an inverse mapping from O to R, which is reconstructed according to the id information in the relational data. It can be seen that the reconstruction from I to I' can be achieved essentially through the number of rows and id information of the table (the number of rows and id information of the original table hidden in the entity in I' is filled into I). In essence, since the relational table is bounded, I can be transformed into I' with a finite number of steps. This proves that the STG transformation is lossless, ensuring that the original database can be completely reconstructed from the generated graph.
[0125] Therefore, it is proved that STG provides a powerful method to maintain the integrity and consistency of data without losing information in the process of converting relational data into graph data. This is particularly important for application scenarios that need to ensure data quality and reliability.
[0126] In summary, STG provides an effective way to convert complex relational data models into graph structures by defining clear grammatical and semantic rules and guaranteeing lossless conversion properties, so that data analysis and processing can be expressed more richly and intuitively in the graph field.
[0127] In practical applications, STG can not only ensure the losslessness of data conversion, but also simplify and automate the graph construction process through automatically generated algebraic queries. Once STG is defined, the query optimization and execution engine of the existing relational data management system can be used to execute these queries, thereby effectively building a property graph.
[0128] In addition, the STG framework also provides a certain degree of flexibility, allowing users to adjust and optimize the generated graph structure according to specific needs. For example, by modifying the generation rules of entities and relationships, new node types or edge types can be easily added, or the existing structure can be adjusted to better reflect the semantics of the data.
[0129] After the graph is constructed, some hidden relationships that are not directly captured may appear. Although these relationships are not directly reflected in the original relational data, they can be inferred through the logical relationship between the data. In order to complete these potential relationships, graph reasoning techniques, such as rule-based reasoning or machine learning methods, can be further applied to discover and add these missing edges. This step helps to enrich the semantics of the graph and enhance the connectivity between data, making the graph a more comprehensive and accurate model that reflects real-world entities and their relationships.
[0130] Finally, it is worth noting that although STG provides an effective data conversion method, its performance and efficiency are highly dependent on the query execution capabilities and optimization strategies of the underlying database management system. Therefore, when applying STG on large-scale datasets, it becomes particularly important to choose a suitable database system and appropriately adjust query optimization parameters. In addition, for specific application scenarios, further customized development may be required to ensure the efficiency of the conversion process and the quality of the generated graph.
[0131] In summary, STG provides a powerful and flexible framework for converting relational data into graph data while maintaining the integrity and richness of the data. Through further optimization and extension, STG can play an important role in various application fields, providing support for data analysis, knowledge discovery, and intelligent applications.
[0132] For example, for the customer entity, the associated attributes are all contained in the relational schema "Customer". Therefore, only projection operations are used to extract the associated instances. For the address entity, its associated attributes are contained in multiple schemas (for example, "Customer: custkey, address, comment, mstsegment, nationKey" and "Nation: nationKey, name, regionkey"). The ontology identified using the large language model is {Customer: custkey, address, comment, mstsegment; Nation: nationKey, name,}. Therefore, a full outer join operation is used to aggregate the attributes of the "Customer" and "Nation" schemas.
[0133] The relationship between "customer" and "nation" is primarily stored in the "Customer" schema. To achieve this, simple identifiers are created using the table ID and row ID. An inner join operation is applied and these identifiers are introduced to ensure that each customer instance corresponds to a unique relationship with each address instance.
[0134] The conversion syntax is: (nationKey, name) →V nation ;Algebra: V nation : Π((nationKey)) Π((name, nationKey)) (Nation), implements a full outer join operation.
[0135] (custkey) →V customer ;Algebra: V customer : Π((custkey)) (Customer), implements the projection operation.
[0136] E(nation-customer) = (V nation , V customer ); Algebra: E(nation-customer):(Π(tableId, rowId, nationKey) (Customer)) (Π(tableId, rowId, nationKey)(Nation)) (Π(tableId, rowId, custkey) (Customer)) to implement the inner join operation.
[0137] Through these steps, a set of relational algebra is used to transform the original relational data into an attribute graph. The relational algebra can find the corresponding SQL statements and output specific entities and relationships. These entities and relationships are regarded as nodes and edges of the graph.
[0138] Given at least one set of relational tables in a relational database, extract the relational tables and the instances therein to form an equivalent attribute graph. , where V represents entity, E represents entity relationship, and L represents entity label. Representation attribute functions to identify and represent entities and relations present in relational data.
[0139] Therefore, an automatic property graph construction method for relational data is proposed, which includes two stages: the first is the generation of the target ontology set, and the second is the property graph construction.
[0140] Figure 6 A schematic diagram of an automated method for converting relational data into a property graph according to an embodiment of the present invention is shown.
[0141] like Figure 6As shown, attribute sampling is performed from a relational database (or database) to obtain a relational schema and a data instance. In the generation phase of the target ontology set, the attribute sampling data under the relational schema and the data instance corresponding to the relational schema are input into the large language model to extract and generate an initial ontology set. The initial ontology set includes multiple initial entities and the relationships between the initial entities. Based on the log records of the initial attribute data under the initial entity, the weighted score of the initial attribute data can be calculated. The initial ontology set is updated according to the weighted score of the initial attribute data to obtain the target ontology set.
[0142] In the automated stage of transforming relational data into attribute graphs, the target ontology set in the relational data is mapped using relational algebra in semantic transformation grammar to obtain an attribute graph. The nodes in the attribute graph represent the target entities in the target ontology set, and the edges between the nodes represent the relationships between the target entities.
[0143] The large language model can be a large model classifier, and the relational patterns obtained by attribute sampling and their corresponding data instance data are input into the large language model to extract the initial ontology set. A mapping translation grammar (such as semantic transformation grammar) between ontology and relational data is defined. The grammar can be used to transform the mapping relationship between entity relationships and data into a relational algebra, which can be used to extract examples from relational data to output attribute graphs.
[0144] Taking the automated construction of a biological risk attribute graph as an example, according to an embodiment of the present invention, an automated method for converting relational data into an attribute graph may include: ontology definition step: using a top-down approach, defining biological risk factor entities and relationships based on a predetermined ontology set, wherein the ontology set at least includes entities such as pathogens, hosts, transmission pathways, and prevention and control measures. Extraction step: based on the defined entities and relationships, automatically extract information entities and their attributes in the field of biosafety risks from structured data sources, including but not limited to researchers, research results, research institutions, and research events, and define the relationships between these entities. Instance extraction step: automatically identify specific instances in the data and integrate them into the attribute graph. Construction step: based on instance data, integrate and generate an attribute graph for the field of biosafety risks, involving the generation, integration, linking, and output of graph data. Data matching step: Use advanced string matching algorithms and semantic understanding technology to accurately match data attribute names and instances to ensure that all data describe the same entity, thereby ensuring data consistency and accuracy; Graph data connection step: For multi-relational table structured data, design and apply efficient connection algorithms based on predefined entity relationship patterns to link the same instances in different relational tables to ensure high efficiency and high accuracy in practical applications, including but not limited to low time complexity, low space complexity and high connection accuracy.
[0145] Read and save data information in relational data in CSV (Comma-Separated Values) or TSV (Tab-Separated Values) format, and receive predefined biosafety risk domain entity information as input; identify and match biosafety risk instance information in the data based on predefined entities and relationships; generate entities and relationships through aggregation and connection operations based on the matched biosafety risk instance information to form a property graph; save the constructed graph data entities and relationships as node files and edge files for storage, visualization and analysis of graph databases. Clean, standardize and preliminarily classify the imported data. Understand and interpret entities and relationships in the data based on ontology to enhance the accuracy and robustness of data matching.
[0146] In the ontology generation phase of building the attribute graph, the key is to accurately identify and classify entity types, entity attributes, and the associations between entities in the relational data. This process starts with using a large language model (LLM) that has been pre-trained with domain knowledge as a classifier and is optimized specifically for the complexity and expertise of domain knowledge. For example, by training and fine-tuning the LLM with biosafety domain knowledge, it pays special attention to key concepts in the biosafety field, such as papers, patents, research institutions, researchers, etc.
[0147] After generating the preliminary ontology set, the LLM classifier combines domain knowledge to optimize and refine the output ontology, including the log records of the database and the attribute distribution of the relationship instance, analyzes which biosafety attribute information users are most concerned about, and extracts valuable attributes as new entities. The generated ontology can be used to guide the mapping syntax defined later, so that the nodes and relationships in the attribute graph can generate instances through the query statements of the relationship data, and then construct the attribute graph.
[0148] Figure 7 A structural block diagram of an automatic device for converting relational data into a property graph according to an embodiment of the present invention is shown.
[0149] like Figure 7 As shown, the automated device 700 for converting relational data into a property graph in this embodiment includes an input module 710 , an update module 720 , a mapping module 730 , and a construction module 740 .
[0150] The input module 710 is used to input the relational schema of the data in the relational data and the data instances corresponding to the relational schema into the large language model to obtain an initial ontology set. In one embodiment, the input module 710 can be used to perform the operation S210 described above, which will not be described in detail here.
[0151] The updating module 720 is used to update the initial ontology set according to the weighted scores of each initial attribute data in the initial entity to obtain the target ontology set, wherein the weighted scores are determined according to the user query frequency and information entropy of the initial attribute data. In one embodiment, the updating module 720 can be used to perform the operation S220 described above, which will not be repeated here.
[0152] The mapping module 730 is used to map the target ontology set using semantic transformation syntax to obtain the relational algebra of the target ontology set, and the relational algebra is used to retrieve relational data. In one embodiment, the mapping module 730 can be used to perform the operation S230 described above, which will not be repeated here.
[0153] The construction module 740 is used to construct a property graph based on the target ontology set and the relational algebra. In one embodiment, the construction module 740 can be used to perform the operation S240 described above, which will not be described in detail here.
[0154] According to an embodiment of the present invention, the updating module 720 includes a first calculating submodule, a first determining submodule and an updating submodule. The first calculating submodule is used to calculate the weighted score of the initial attribute data in the initial entity for each initial entity. The first determining submodule is used to determine the initial attribute data as a target entity when the weighted score meets a preset threshold. The updating submodule is used to update the initial ontology set according to the target entity to obtain the target ontology set.
[0155] According to an embodiment of the present invention, the first calculation submodule includes a first calculation unit, a second calculation unit and a weighted summation unit. The first calculation unit is used to calculate the query score of the initial attribute data according to the user query frequency for each initial entity. The second calculation unit is used to calculate the information score of the initial attribute data according to the information entropy of the initial attribute data. The weighted summation unit is used to perform weighted summation on the query score and the information score to obtain a weighted score.
[0156] According to an embodiment of the present invention, the updating module 720 includes an extraction unit, a determination unit and an addition unit. The extraction unit is used to extract the target attribute data of the target entity from the initial attribute data in the initial entity. The determination unit is used to determine the target association relationship between the target entity and multiple initial entities in the initial ontology set using a large language model. The adding unit is used to add the target attribute data and the target association relationship of the target entity to the initial ontology set to obtain the target ontology set.
[0157] According to an embodiment of the present invention, the relational algebra includes projection relational algebra, and the mapping module 730 includes a projection submodule and a query mapping submodule. The projection submodule is used to perform a projection operation on the target attribute data in the target entity from the same relational schema to obtain the projection relational algebra. The query mapping submodule is used to establish query mappings of different relational schemas for target attribute data in the target entity from different relational schemas.
[0158] According to an embodiment of the present invention, the relational algebra further includes a full outer join relational algebra and an inner join relational algebra, and the query mapping submodule includes a full outer join unit and an inner join unit. The full outer join unit is used to perform a full outer join operation on the target attribute data in the target entity from different relational schemas to obtain a full outer join relational algebra. The inner join unit is used to perform inner joins between different relational schemas to obtain an inner join relational algebra.
[0159] According to an embodiment of the present invention, the construction module 740 includes a construction submodule, which is used to construct a property graph based on a target ontology set, projection relational algebra, full outer join relational algebra and inner join relational algebra. The entities and target entities are nodes of the property graph, and the connecting edges between the nodes represent the association relationship between multiple entities or an entity and a target entity.
[0160] According to an embodiment of the present invention, the above-mentioned device also includes a data sampling module, which is used to sample data from the relational data according to the data sampling strategy to obtain multiple groups of attribute sampling data under the relational model. The data collection strategy is determined according to the data value range in the relational data.
[0161] According to an embodiment of the present invention, the data sampling module includes a partitioning submodule and a data sampling submodule. The partitioning submodule is used to partition a data set in the relational data into multiple subsets according to a data value range, and the data value ranges represented by the multiple subsets are different. The data sampling submodule is used to sample data from the multiple subsets of the relational data respectively to obtain attribute sampling data under the relational model.
[0162] It should be noted that the automated device part for converting relational data into an attribute graph in the embodiment of the present invention corresponds to the automated method part for converting relational data into an attribute graph in the embodiment of the present invention. The description of the automated device part for converting relational data into an attribute graph specifically refers to the automated method part for converting relational data into an attribute graph, which will not be repeated here.
[0163] According to an embodiment of the present invention, any multiple modules among the input module 710, the update module 720, the mapping module 730 and the construction module 740 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present invention, at least one of the input module 710, the update module 720, the mapping module 730 and the construction module 740 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or can be implemented in any one of the three implementation methods of software, hardware and firmware or in a suitable combination of any of them. Alternatively, at least one of the input module 710, the update module 720, the mapping module 730 and the construction module 740 can be at least partially implemented as a computer program module, which can perform the corresponding function when it is executed.
[0164] Figure 8 A block diagram of an electronic device suitable for implementing an automated method for converting relational data into a property graph according to an embodiment of the present invention is shown.
[0165] like Figure 8 As shown, the electronic device 800 according to an embodiment of the present invention includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0166] In RAM 803, various programs and data required for the operation of electronic device 800 are stored. Processor 801, ROM 802 and RAM 803 are connected to each other via bus 804. Processor 801 performs various operations of the method flow according to the embodiment of the present invention by executing the programs in ROM 802 and / or RAM 803. It should be noted that the program can also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 can also perform various operations of the method flow according to the embodiment of the present invention by executing the programs stored in the one or more memories.
[0167] According to an embodiment of the present invention, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the input / output (I / O) interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 809 including a network interface card such as a LAN card, a modem, etc. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output (I / O) interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that the computer program read therefrom is installed into the storage portion 808 as needed.
[0168] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.
[0169] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: 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 portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.
[0170] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program includes a program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the automatic method for converting relational data into an attribute graph provided by the embodiment of the present invention.
[0171] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when it is executed by the processor 801. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0172] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 809, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0173] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0174] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0175] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0176] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present invention may be combined and / or combined in various ways, even if such combinations and / or combinations are not explicitly described in the present invention. In particular, the features described in the various embodiments and / or claims of the present invention may be combined and / or combined in various ways without departing from the spirit and teachings of the present invention. All of these combinations and / or combinations fall within the scope of the present invention.
[0177] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination. The scope of the present invention is defined by the attached claims and their equivalents. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.
Claims
1. An automated method for converting relational data into a property graph, characterized in that: The method comprises: Inputting a relational pattern of data in the relational data and a data instance corresponding to the relational pattern into a large language model to obtain an initial ontology set, wherein the initial ontology set includes a plurality of initial entities and association relationships between the plurality of initial entities, wherein the initial entity includes at least one initial attribute data extracted from attribute sampling data, wherein the attribute sampling data is sampled and extracted from the data instance; updating the initial ontology set according to the weighted scores of each of the initial attribute data in the initial entity to obtain a target ontology set, wherein the weighted scores are determined according to the user query frequency and information entropy of the initial attribute data; Mapping the target ontology set by using semantic transformation grammar to obtain a relational algebra of the target ontology set, wherein the relational algebra is used to retrieve the relational data; A property graph is constructed based on the target ontology set and the relational algebra.
2. The method according to claim 1, characterized in that The updating of the initial ontology set according to the weighted scores of each of the initial attribute data in the initial entity to obtain the target ontology set comprises: For each of the initial entities, calculating a weighted score of the initial attribute data in the initial entity; In the case where the weighted score meets a preset threshold, determining the initial attribute data as a target entity; The initial ontology set is updated according to the target entity to obtain the target ontology set.
3. The method according to claim 2, characterized in that The step of calculating the weighted score of the initial attribute data in each initial entity comprises: For each of the initial entities, calculating a query score of the initial attribute data according to the user query frequency; Calculating the information score of the initial attribute data according to the information entropy of the initial attribute data; The query score and the information score are weighted and summed to obtain the weighted score.
4. The method according to claim 2, characterized in that: The updating of the initial ontology set according to the target entity to obtain the target ontology set comprises: Extracting target attribute data of the target entity from the initial attribute data in the initial entity; Determine a target association relationship between the target entity and a plurality of the initial entities in the initial ontology set by using the large language model; The target attribute data and target association relationship of the target entity are added to the initial ontology set to obtain the target ontology set.
5. The method according to claim 1, characterized in that The relational algebra includes projected relational algebra, The mapping of the target ontology set by using semantic transformation grammar to obtain the relational algebra of the target ontology set includes: For target attribute data in a target entity that come from the same relational schema, a projection operation is performed on the target attribute data to obtain the projection relational algebra; For the target attribute data in the target entity coming from different relational schemas, query mappings of the different relational schemas are established.
6. The method according to claim 5, characterized in that The relational algebra also includes full outer join relational algebra and inner join relational algebra. The target attribute data in the target entity comes from different relational schemas, and establishing query mappings of the different relational schemas includes: For the target attribute data in the target entity coming from the different relational schemas, a full outer join operation is performed on the target attribute data to obtain the full outer join relational algebra; Inner joins are performed between the different relational schemas to obtain the inner join relational algebra.
7. The method according to claim 6, characterized in that The constructing of a property graph based on the target ontology set and the relational algebra comprises: The property graph is constructed based on the target ontology set, the projection relational algebra, the full outer join relational algebra and the inner join relational algebra. The entities and the target entities are nodes of the property graph, and the connecting edges between the nodes represent the association relationship between multiple entities or between the entity and the target entity.
8. The method according to claim 1, characterized in that The method further comprises: Data sampling is performed from the relational data according to a data sampling strategy to obtain a plurality of groups of attribute sampling data under the relational model, wherein the data collection strategy is determined according to a data value range in the relational data.
9. The method according to claim 8, characterized in that The step of sampling data from the relational data according to the data sampling strategy to obtain multiple groups of attribute sampling data under the relational model includes: Dividing the data set in the relational data into a plurality of subsets according to the data value range, wherein the data value ranges represented by the plurality of subsets are different; Data sampling is performed respectively from the plurality of subsets of the relational data to obtain the attribute sampling data under the relational model.
10. An automated device for converting relational data into an attribute graph, characterized in that: The device comprises: An input module, used for inputting a relational pattern of data in the relational data and a relational instance corresponding to the relational pattern into a large language model to obtain an initial ontology set, wherein the initial ontology set includes a plurality of initial entities and association relationships between the plurality of initial entities, wherein the initial entity includes at least one initial attribute data extracted from attribute sampling data, wherein the attribute sampling data is obtained by sampling and extracting from the data instance; An updating module, configured to update the initial ontology set according to the weighted scores of each of the initial attribute data in the initial entity to obtain a target ontology set, wherein the weighted scores are determined according to the user query frequency and information entropy of the initial attribute data; A mapping module, used to map the target ontology set using a semantic conversion grammar to obtain a relational algebra of the target ontology set, wherein the relational algebra is used to retrieve the relational data; A construction module is used to construct a property graph based on the target ontology set and the relational algebra.
Citation Information
Patent Citations
BIM-based data storage method, query method, database and medium
CN117971991A
Mapping method and equipment for converting relational database into graph database and medium
CN118820376A
SQL statement generation method and device based on large model
CN118981475A
Deep learning-based creative application knowledge graph construction method
CN119474331A
Ensemble learning enhanced prompting for open relation extraction
WO2024233222A1