Graph database construction method, query method and computing equipment

By extracting and analyzing multi-level relationships between entities from text data, a graph database is constructed, which solves the problem of poor data quality in traditional methods and achieves more efficient and accurate data storage and retrieval.

CN121542434APending Publication Date: 2026-02-17XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511448144.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-10
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Traditional graph database construction methods struggle to cover the multiple relationships between entities in complex contexts, resulting in poor data quality.

Method used

By extracting target entities from raw target data in text format, and combining natural language processing tools and deep semantic analysis, multi-level relationships between entities, between entities and types, and between types are identified, and a graph database is constructed.

Benefits of technology

It significantly improves the integrity of graph database construction and data quality, ensures data comprehensiveness and consistency, and improves query accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121542434A_ABST
    Figure CN121542434A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a graph database construction method, a graph database query method and computing equipment. The method comprises the following steps: extracting at least one target entity from target original data; classifying the at least one target entity, and determining a first corresponding relationship between the target entity and the target entity category; based on the first corresponding relation, the context information of the target original data and the first description text, determining a second corresponding relation; wherein the second corresponding relationship is used for representing a mapping relationship between the at least two target entities; the first description text is prompt information used for identifying the relationship between the target entities; determining a third corresponding relation based on the target entity and the target entity category; and constructing a graph database based on the first corresponding relation, the second corresponding relation and the third corresponding relation. By the adoption of the method, the integrity and data quality of graph database construction are remarkably improved by comprehensively extracting the multi-level incidence relation between the entities, between the entities and the types and between the types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a database construction method, query method, and computing device. Background Technology

[0002] Graph databases, as a type of database system that stores and queries data using a graph structure, can intuitively and flexibly describe complex relationships between entities, thereby providing more accurate support for subsequent data analysis.

[0003] However, the construction of graph databases faces numerous challenges. Traditional methods often identify and extract entities and their relationships from raw data, organizing them into single relationships between entities (such as "head entity—relationship—tail entity") for graph database construction. These methods struggle to cover multiple relationships between entities in complex contexts, resulting in poor data quality in the constructed graph database. Summary of the Invention

[0004] This application provides a method for constructing and querying a graph database, as well as a computing device. By comprehensively extracting multi-level relationships between entities, between entities and types, and between types, the completeness and data quality of the graph database construction are significantly improved. To achieve the above objectives, this application adopts the following technical solution: In a first aspect, embodiments of this application provide a method for constructing a graph database. The method includes: extracting target entities from target raw data; wherein the target raw data is text-formatted data; classifying the target entities to determine a first correspondence between the target entities and target entity categories; determining a second correspondence based on the first correspondence, contextual information of the target raw data, and a first descriptive text; wherein the second correspondence is used to characterize the mapping relationship between at least two target entities; the first descriptive text is a prompt message used to identify the relationship between target entities; determining a third correspondence based on the target entities and target entity categories; the third correspondence is used to characterize the mapping relationship between target entity categories; and constructing a graph database based on the first, second, and third correspondences.

[0005] Based on this scheme, target entities are extracted from the original target data in text format. The mapping relationships between entities are determined by combining contextual information with the initial descriptive text. Simultaneously, entity categories are identified, and the attribution relationships between entities and categories, as well as the association relationships between categories, are established. Finally, a graph database is constructed based on these three types of relationships. In this way, by comprehensively extracting multi-level association relationships between entities, between entities and types, and between types to construct the graph database, the completeness and data quality of the graph database construction can be effectively improved.

[0006] In one possible implementation, extracting a target entity from the target raw data includes: acquiring the target raw data; using the target raw data as input to a natural language processing tool, and using the natural language processing tool to obtain at least one output entity; using the at least one output entity as input to a first model, and using the first model to obtain the target entity.

[0007] Based on this approach, the original target data is first acquired, and the text is preliminarily parsed using natural language processing tools to extract preliminary output entities. These output entities are then input into a first model for deep semantic analysis and feature optimization, ultimately identifying more accurate and context-relevant target entities. This combination of natural language processing tools and the first model for secondary verification of target entity recognition effectively improves the accuracy of entity recognition.

[0008] In one possible implementation, the method further includes: acquiring first raw data; the first raw data includes structured data and unstructured data in different formats; using the structured data, unstructured data in different formats, and second descriptive text as input to a first model, and using the first model to obtain target raw data; the second descriptive text is used to describe user input instructions for converting the data format of the first raw data into text format.

[0009] Based on this solution, the first model transforms various forms of raw data into plain text data, enabling unified semantic understanding and fusion of heterogeneous data sources. This provides standardized input for subsequent entity recognition, relation extraction, and knowledge graph construction, enhancing the adaptability of the entire system in complex scenarios and effectively ensuring the data quality of subsequent graph database construction.

[0010] In one possible implementation, classifying the target entities and determining a first correspondence between the target entities and their categories includes: using the target entities and third descriptive text as input to a first model, and using the first model to obtain the first correspondence between the target entities and their categories; wherein the third descriptive text is used to describe user input instructions that generate corresponding entity categories for each entity based on the target entities; or, using the target entities as input to a second model, and using the second model to obtain the first correspondence between the target entities and their categories.

[0011] Based on this scheme, the target entity category of the target entity can be predicted by using the first model or the second model, which can accurately determine the semantic category of the entity. In this way, by leveraging the advantages of the model in semantic understanding and pattern recognition, not only is the accuracy of entity classification improved, but also the efficient processing of large-scale and diverse entities is achieved, thereby accelerating the speed of entity category acquisition and improving overall efficiency.

[0012] In one possible implementation, determining a third correspondence based on the target entity and the target entity category includes: using the target entity, the target entity category, and a fourth descriptive text as input to a first model, and using the first model to obtain the third correspondence; wherein the fourth descriptive text is used to describe user input instructions for generating the mapping relationship between the corresponding entity categories of each entity based on the target entity and the target entity category.

[0013] Based on this scheme, the first model processes the target entity, target entity category, and fourth descriptive text to extract the relationship between them, thereby obtaining the mapping relationship between the target entity and the target entity category. In this way, by utilizing the deep modeling capability of the model in semantic relationships and combining it with the specific guidance provided by user instructions, the potential association between different entity categories can be accurately identified.

[0014] In one possible implementation, a graph database is constructed based on the first correspondence, the second correspondence, and the third correspondence, including: performing deduplication on the first correspondence, the second correspondence, and the third correspondence to obtain the deduplicated first correspondence, the second correspondence, and the third correspondence; and storing the deduplicated first correspondence, the second correspondence, and the third correspondence in the graph database in a target format.

[0015] Based on this scheme, after obtaining the first correspondence between entities, the second correspondence between entities and categories, and the third correspondence between categories, the first, second, and third correspondences are deduplicated. The deduplicated data is then used to construct a graph database. This deduplication effectively improves the cleanliness and consistency of the data, avoiding the interference of duplicate relationships on query performance and knowledge reasoning. At the same time, writing the mapping between entities, the attribution of entities to categories, and the association between categories into the graph database in a structured format ensures the comprehensiveness of the data.

[0016] Secondly, embodiments of this application also provide a query method based on a graph database. The method includes: obtaining a first input text input by a user; updating the first input text based on the first input text and a target relation set in the graph database to obtain a corresponding second input text; wherein the graph database is obtained using a graph database construction method; the target relation set is a set of semantic relations extracted from the graph database that satisfy preset relevance conditions with the first input text; and using the second input text as input to a first model, obtaining a target query result using the first model.

[0017] Based on this scheme, the first input text is supplemented by a graph database to obtain the second input text, and the final answer is obtained using the first model. In this way, by introducing a well-constructed graph database, missing or implicit semantic information in the first input text can be automatically identified and supplemented before the query, which can significantly improve the accuracy and completeness of the input query.

[0018] In one possible implementation, the first input text is updated based on the first input text and the target relation set in the graph database to obtain the corresponding second input text. This includes: searching for at least one entity corresponding to the first input text in the graph database based on the first input text; determining a first entity set from the at least one entity; determining a target relation set based on the first entity set and a first correspondence, a second correspondence, and a third correspondence in the graph database; wherein the first correspondence is used to characterize the mapping relationship between target entities, the second correspondence is used to characterize the mapping relationship between target entities and target entity categories, and the third correspondence is used to characterize the mapping relationship between target entity categories; and determining the second input text based on the first input text and the target relation set.

[0019] Based on this scheme, the first input text is updated based on the first correspondence and the first, second, and third correspondences in the graph database to obtain a more accurate and context-rich second input text, which can help to understand the user's query needs more accurately.

[0020] In one possible implementation, determining the target relation set based on the first entity set and the first, second, and third correspondences in the graph database includes: determining the second relation set based on the first entity set and the first, second, and third correspondences in the graph database; wherein the second relation set includes the relations between target entities, the relations between target entities and their corresponding entity categories, and the relations between entity categories; and determining the target relation set based on the second relation set and the first input text.

[0021] Based on this solution, the system first constructs a comprehensive second set of relationships using the first entity set and three types of relationships (between entities, between entities and categories, and between categories) in the graph database. Then, by combining this with filtering and optimization of the original input text, a target set of relationships that precisely matches the query intent is generated. In this way, based on the target set of relationships and combined with the specific needs of the user's first input text, it can more accurately determine which relationships are most relevant and useful for the current query, avoiding interference from irrelevant or redundant relationships. This significantly improves the semantic matching degree of the query and the accuracy of the results, achieving more intelligent and accurate knowledge retrieval and response.

[0022] Thirdly, embodiments of this application provide an apparatus for constructing a graph database. The apparatus includes: a first acquisition module configured to extract target entities from target raw data; wherein the target raw data is text-formatted data; a first determination module configured to classify the target entities and determine a first correspondence between the target entities and their categories; the first determination module is further configured to determine a second correspondence based on the first correspondence, contextual information of the target raw data, and a first descriptive text; wherein the second correspondence characterizes a mapping relationship between at least two target entities; the first descriptive text is a prompt message used to identify the relationship between target entities; the first determination module is further configured to determine a third correspondence based on the target entities and their categories; the third correspondence characterizes a mapping relationship between target entity categories; and a construction module further configured to construct a graph database based on the first, second, and third correspondences.

[0023] In one possible implementation, the first acquisition module is specifically configured to: acquire target raw data; use the target raw data as input to a natural language processing tool, and use the natural language processing tool to obtain at least one output entity; use the at least one output entity as input to a first model, and use the first model to obtain the target entity.

[0024] In one possible implementation, the first acquisition module is specifically configured to: acquire first raw data; the first raw data includes structured data and unstructured data in different formats; use the structured data, unstructured data in different formats, and second descriptive text as input to the first model, and use the first model to obtain target raw data; the second descriptive text is used to describe user input instructions for converting the data format of the first raw data into text format.

[0025] In one possible implementation, the first determining module is further configured to: take the target entity and the third descriptive text as input to the first model, and use the first model to obtain a first correspondence between the target entity and the target entity category; wherein the third descriptive text is used to describe the user input instruction to generate the corresponding entity category of each entity based on the target entity; or, take the target entity as input to the second model, and use the second model to obtain the first correspondence between the target entity and the target entity category.

[0026] In one possible implementation, the first determining module is specifically configured to: take the target entity, the target entity category, and the fourth descriptive text as input to the first model, and use the first model to obtain the third correspondence; wherein, the fourth descriptive text is used to describe the user input instruction to generate the mapping relationship between the corresponding entity categories of each entity based on the target entity and the target entity category.

[0027] In one possible implementation, the construction module is specifically configured to: perform deduplication operations on the first correspondence, the second correspondence, and the third correspondence to obtain the deduplicated first correspondence, the second correspondence, and the third correspondence; and store the deduplicated first correspondence, the second correspondence, and the third correspondence in the target format to the graph database.

[0028] Fourthly, embodiments of this application also provide a query device based on a graph database. The device includes: a second acquisition module configured to acquire first input text input by a user; an update module configured to update the first input text based on the first input text and a target relation set in the graph database to obtain a corresponding second input text; wherein the graph database is obtained using a graph database construction method; the target relation set is a set of semantic relations extracted from the graph database that have been filtered and satisfy preset relevance conditions with the first input text; and a second determination module configured to use the second input text as input to a first model and obtain a target query result using the first model.

[0029] In one possible implementation, the update module is specifically configured to: search for at least one entity corresponding to the first input text in the graph database based on the first input text; determine a target entity set from the at least one entity; determine a first relationship set based on the target entity set and a first, second, and third correspondence in the graph database; the first correspondence is used to characterize the mapping relationship between target entities, the second correspondence is used to characterize the mapping relationship between target entities and target entity categories, and the third correspondence is used to characterize the mapping relationship between target entity categories; and determine a second input text based on the first input text and the first relationship set.

[0030] In one possible implementation, the second determining module is specifically configured to: determine a second set of relationships based on the target entity set and the first, second, and third correspondences in the graph database; wherein the second set of relationships includes relationships between target entities, relationships between target entities and their corresponding entity categories, and relationships between entity categories; and determine a first set of relationships based on the second set of relationships and the first input text.

[0031] Fifthly, embodiments of this application also provide a computing device, including: a processor and a memory; the processor and the memory are coupled; the memory is used to store program instructions; the processor is used to execute the program instructions to perform the method as described in any one of the first and second aspects above.

[0032] In a sixth aspect, embodiments of this application provide a chip for performing the method as described in any of the first aspects above.

[0033] In a seventh aspect, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a computer, implement the method as described in either the first or second aspect.

[0034] Eighthly, embodiments of this application provide a program product including a computer program that, when executed by a processor, implements the method as described in either the first or second aspect. Attached Figure Description

[0035] Figure 1 This is a schematic diagram of the structure of a graph database provided in an embodiment of this application; Figure 2 This is a first flowchart illustrating a method for constructing a graph database according to an embodiment of this application; Figure 3 This is a second flowchart illustrating a method for constructing a graph database according to an embodiment of this application; Figure 4 This is a third flowchart illustrating a method for constructing a graph database provided in an embodiment of this application; Figure 5 This is a schematic diagram of the first process for obtaining target raw data provided in an embodiment of this application; Figure 6 This is a schematic diagram of a second process for obtaining target raw data provided in an embodiment of this application; Figure 7 This is a schematic diagram of a training method for a second model provided in an embodiment of this application; Figure 8 This is a schematic diagram of the first flowchart of a query method based on a graph database provided in an embodiment of this application; Figure 9 This is a second flowchart illustrating a query method based on a graph database provided in an embodiment of this application; Figure 10 This is a third flowchart illustrating a query method based on a graph database provided in an embodiment of this application; Figure 11 This is a schematic diagram of a graph database construction apparatus provided in an embodiment of this application; Figure 12 This is a schematic diagram of a graph database-based query device provided in an embodiment of this application; Figure 13 is a schematic diagram of a computing device provided in an embodiment of this application. Detailed Implementation

[0036] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. To facilitate a clear description of the technical solutions of the embodiments of this application, the use of terms such as "first," "second," etc., in the embodiments of this application is for illustrative purposes and to distinguish the objects being described. There is no particular order between them, nor does it indicate a specific limitation on the number of devices in the embodiments of this application, and they do not constitute any limitation on the embodiments of this application.

[0037] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of this application.

[0038] It should be noted that many specific details are set forth in the following description in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein. Therefore, the scope of protection of this application is not limited to the specific embodiments disclosed below.

[0039] The following explanations of the technical terms mentioned in the embodiments of this application are provided to facilitate understanding by those skilled in the art.

[0040] A graph database is a type of database specifically designed for storing and managing graph-structured data. Its core consists of nodes and edges. Nodes represent entities, while edges can have direction and attributes to describe the type and characteristics of relationships.

[0041] A large language model (LLM) is a large-scale pre-trained language model based on deep learning technology. It typically has billions or even hundreds of billions of parameters and can handle natural language understanding and generation tasks. In the embodiments of this application, the large model can be called the first model, which can be a neural network model. For ease of understanding, the first neural network model will be described below.

[0042] An entity is a thing or concept that has independent meaning, such as a "person", "place", or "organization".

[0043] Structured data refers to data with a clear, predefined data model that can be directly read, stored, retrieved, and analyzed by computers. It is typically characterized by a row-column format, fixed fields, explicit data types, and relationships.

[0044] Unstructured data refers to data types that lack a predefined data model or organizational structure and therefore cannot be directly parsed using rows, columns, or fixed fields. This type of data includes images, text files, emails, social media content, and audio and video files.

[0045] The embodiments of this application will now be described with reference to the accompanying drawings.

[0046] Graph databases, as a type of database system that uses graph structures to store and query data, can intuitively and flexibly describe complex relationships between entities.

[0047] Figure 1 This is a schematic diagram of the structure of a graph database provided in an embodiment of this application.

[0048] like Figure 1 As shown, in a graph database, data is represented in the form of nodes and edges. Nodes represent specific entities, such as individuals, locations, or items. Each node can carry detailed attribute information to describe its characteristics, such as a person's name, age, or the geographical coordinates of a location. Edges, on the other hand, represent relationships between entities, connecting not only different nodes but also containing additional information to describe the specific nature of the relationship, such as "located in" or "purchased." This graph structure design allows graph databases to intuitively and flexibly display complex relationships between entities, whether direct or indirect, connected through multiple steps.

[0049] For example, continue to combine Figure 1 As shown, we will use a graph database structure, assuming a social network as an example, for illustration. Assume the graph database contains three main entities: "Zhang San" (person), "Beijing" (location), and "Meeting M" (event), and the relationships between them: "Zhang San" lives in Beijing, and "Zhang San" attended Meeting M.

[0050] Before performing data operations using a graph database, it is necessary to first construct the appropriate database structure, that is, design a suitable data structure according to actual needs, including defining nodes and relationships, and preparing to import data into the graph database.

[0051] Based on this, embodiments of this application provide a method for constructing a graph database. Specifically, at least one target entity can be extracted from the original target data; the at least one target entity can be classified to determine the mapping relationship between the target entity and the target entity category; then, based on the context information of the target entity, the mapping relationship between the target entity and the target entity category, and the first descriptive text, the mapping relationship between the target entities can be determined; the target entity category corresponding to the target entity can be obtained; the mapping relationship between the target entity and the target entity category can be constructed; based on the target entity and the target entity category, the mapping relationship between the target entity categories can be determined; and based on the above mapping relationship, a graph database can be constructed.

[0052] In summary, by acquiring a three-tiered knowledge system that describes the direct relationships between entities, establishes the attribution relationships between entities and categories, and forms abstract relationships between categories, the completeness and data quality of graph database construction can be effectively improved through multi-level semantic associations.

[0053] The following section, with reference to the accompanying diagram, explains the specific implementation process of the graph database construction method.

[0054] Figure 2 This is the first flowchart illustrating a method for constructing a graph database provided in this application embodiment.

[0055] Figure 3 This is a second flowchart illustrating a method for constructing a graph database provided in an embodiment of this application.

[0056] like Figure 2 and Figure 3 As shown, the method for constructing a graph database includes the following steps: S1: Extract at least one target entity from the target raw data.

[0057] The target raw data is in text format.

[0058] Figure 4 This is a third flowchart illustrating a method for constructing a graph database provided in an embodiment of this application.

[0059] In one implementation, the combination continues. Figure 4 As shown, step S1 includes steps S11-S13.

[0060] S11: Obtain the target raw data.

[0061] Figure 5 This is a schematic diagram of the first process for obtaining target raw data provided in an embodiment of this application.

[0062] Figure 6 This is a schematic diagram of a second process for obtaining target raw data provided in an embodiment of this application.

[0063] In one example, such as Figure 5 and Figure 6 As shown, step S11 includes step S111.

[0064] S111: Obtain the first raw data.

[0065] The primary raw data includes structured data and / or unstructured data in various formats. This primary raw data may include PDF documents, HTML web pages, DOCX documents, etc. This type of data comes from a wide range of sources and is diverse in format, typically containing complex formatting tags, such as layout information in PDFs, tag codes in HTML, and comments and formatting instructions in DOCX.

[0066] The following explanation uses the first set of raw data, which includes PDF documents, HTML web pages, and DOCX documents, as an example.

[0067] For example, the first raw data includes PDF files, HTML web pages, and DOCX files. The PDF file contains not only the main text content but may also include charts, mathematical formulas, footnotes, and detailed typographical information. The HTML web page includes not only the main text content but also rich metadata and hyperlinks to other relevant resources. The DOCX file, in addition to the main text, may contain revision history, comments, tables, images, and other multimedia elements.

[0068] Continue as Figure 5 As shown, step S11 includes step S112.

[0069] S112: Preprocess the first raw data to obtain the target raw data.

[0070] There are various ways to obtain the original target data. It can be achieved through intelligent extraction using a first neural network model, or by using a parser, or by combining it with deep parsing techniques for preprocessing. The following will continue to discuss... Figure 4 Please provide a detailed explanation.

[0071] Example 1, continue to combine Figure 5 As shown, step S112 includes step S1121.

[0072] S1121: Using structured data, unstructured data in different formats, and second descriptive text as inputs to the first neural network model, the target raw data is obtained using the first neural network model.

[0073] The first neural network model is a large-scale pre-trained language model based on deep learning technology, which typically has billions or even hundreds of billions of parameters and can handle natural language understanding and generation tasks.

[0074] The second descriptive text describes a user input instruction to convert the data format of the first raw data into text format. For example, "Convert the data format of the above data into text format and output it."

[0075] For example, structured data, unstructured data in different formats, and a second descriptive text stating "convert the above data into text format and output it" are input into a first neural network model. This first neural network model, leveraging its semantic understanding capabilities, can accurately identify the user's conversion intent and generate unified, clearly structured plain text format data, i.e., the target original data. For instance, regarding the chart content in the first original data, the first neural network model intelligently parses it, converting its visual or structured information into a natural language description and embedding it in the output as text, thereby replacing the original non-text format data. This ensures that the generated target original data retains and reflects the complete semantic information of the original data to the greatest extent possible, i.e., target original data A. For example, target original data A: John studied at L University in 2022.

[0076] Example 2, continue to combine Figure 6 As shown, step S112 includes steps S1122-S1123.

[0077] S1122: Preprocess the first raw data.

[0078] Preprocessing refers to cleaning and structuring the first raw data, removing various formatting elements and non-semantic content, and retaining only readable and meaningful text data.

[0079] The following explanation uses the first set of raw data, which includes PDF documents, HTML web pages, and DOCX documents, as an example.

[0080] For example, efficient content extraction can be achieved by using dedicated parsers for different file formats. Specifically, for PDF documents, the "pdfplumber" parser can be used to accurately extract text data; for HTML web pages, the "BeautifulSoup" parser can be used to accurately extract text data; and for DOCX documents, the "python-docx" parser can be used to recognize and accurately extract text data, thereby obtaining preliminary text content.

[0081] Although the above preprocessing operations have achieved basic text extraction, in order to ensure that the generated target raw data meets the requirements for building a graph database in terms of semantic integrity and content accuracy, further in-depth analysis is still needed to improve data quality.

[0082] The following example, in conjunction with step S1123, provides further illustrative details.

[0083] S1123: Analyze and identify the preprocessed first raw data to obtain the target raw data.

[0084] After initial text extraction, the text data undergoes further deep cleaning and semantic optimization to obtain the target raw data. Specifically, regular expressions are used to accurately match and remove irrelevant symbols from the remaining initial text content. Simultaneously, word segmentation technology and natural language processing methods are combined to identify and remove redundant information from the initial text content, such as repeated headers and footers, footnote numbers, and reference markers—non-essential content. Finally, plain text data with a clear structure, complete semantics, and consistent format is generated, which is the target raw data A. For example, target raw data A: John studied at L University in 2022.

[0085] S12: Using the target raw data as input to a natural language processing tool, obtain at least one output entity using the natural language processing tool.

[0086] Natural language processing (NLP) tools refer to algorithmic components with text understanding capabilities. These tools may include pre-trained language models (such as BERT, RoBERTa, ERNIE, etc.), named entity recognition systems, rule engines, dependency parsers, or specialized information extraction frameworks. NLP tools can automatically identify entities with specific semantic types from target raw data.

[0087] For example, after the target raw data is input into a natural language processing tool, the tool uses steps such as lexical analysis, syntactic parsing, and semantic modeling to locate potential candidate entities in the text, and performs disambiguation and classification based on the context, ultimately outputting a structured list of entities. For instance, in the sentence "John studied at L University in 2022", the natural language processing tool can identify at least one of the following output entities: "John", "2022", "L University", "L", "University", "studying".

[0088] However, the aforementioned natural language processing tools may have issues with misidentification or omission. Therefore, the extracted output entities need further verification to ensure their accuracy and completeness. Further verification will be performed below in conjunction with step S13.

[0089] S13: Using at least one output entity as input to the first neural network model, at least one target entity is obtained using the first neural network model.

[0090] Continuing with the example above, the above "John", "2022", "L University", "L", "University", "Reading" are input into the first neural network model. Based on pre-trained language knowledge and task fine-tuning capabilities, the first neural network model determines whether each output entity truly exists and is semantically reasonable, thereby obtaining at least one target entity corresponding to the target original data, namely "John", "2022", "L University", "Reading".

[0091] S2: Classify at least one target entity and determine the first correspondence between the target entity and the target entity category.

[0092] The acquisition of the first correspondence between each target entity and its corresponding target entity category can continue to be based on the first neural network model described above, or it can be based on the entity category recognition model (second model). The above example is explained in detail below. In one implementation, it continues to combine... Figure 4 As shown, step S2 includes step S21.

[0093] S21: Using each target entity and the third descriptive text as input to the first neural network model, the first correspondence between the target entity and the target entity category is obtained using the first neural network model.

[0094] The third descriptive text describes the user input instruction to generate the corresponding entity category for each entity based on the target entity. For example, "Get the target entity category corresponding to the target entity and output it".

[0095] For example, at least one target entity, “John”, “2022”, “L University”, “reading”, and a third descriptive text “get the target entity category corresponding to the target entity and output it” are used as input to the first neural network model. Using the first neural network model, the first correspondence between the target entity and the target entity category is obtained, namely “John”-“person name”, “2022”-“time”, “L University”-“organization”, “reading”-“activity”.

[0096] In another implementation, the combination continues. Figure 4 As shown, step S2 includes step S22.

[0097] S22: Using the target entity as input to a pre-trained second neural network model, the first correspondence between the target entity and the target entity category is obtained using the second neural network model.

[0098] The pre-trained second neural network model refers to a neural network model trained on a large-scale dataset before use. To ensure the generalization ability of the second neural network model, it needs to be trained on a large amount of data. For example, the second neural network model can be an entity category recognition model, such as the T5 model or the RoBERTa model.

[0099] Figure 7 This is a schematic diagram of a training method for a second model provided in an embodiment of this application.

[0100] like Figure 7 As shown, the training method for the second neural network model includes the following steps: S701: Obtain the training set.

[0101] The training set includes at least one sample entity and the target entity category corresponding to each sample entity.

[0102] S702: Train the second neural network model by using at least one sample entity as input and at least one sample target entity category as output.

[0103] In one example, at least one sample entity is input into the original neural network model. The original neural network model outputs the predicted entity category corresponding to each sample entity. Furthermore, using a preset loss function, the loss value between the predicted entity category corresponding to each sample entity and the target entity category corresponding to each sample entity is calculated. Based on the loss value, the original neural network model is continuously adjusted. When the loss value is less than a preset threshold, it means that the initial neural network model has been trained and a trained second neural network model is obtained.

[0104] After the second neural network model is trained, each target entity and the third descriptive text are input into the second neural network model to obtain the first correspondence between the target entity and the target entity category.

[0105] It should be noted that, in the embodiments of this application, the first correspondence between the target entity and the target entity category can exist in the form of a table, namely, the "target entity-target entity category" table.

[0106] The following is an example illustration with reference to Table 1.

[0107] Table 1 ; It should be noted that the second model can be a neural network model, an algorithm model, or other models, and no specific limitation is made here. For ease of understanding, in this embodiment, the second model is described using a second neural network model as an example.

[0108] S3: Determine the second correspondence based on the context information of the target entity, the first correspondence, and the first description text.

[0109] In one implementation, the combination continues. Figure 3 As shown, step S3 includes step S31.

[0110] S31: Using the first correspondence, the context information of the target original data, and the first descriptive text as inputs to the first neural network model, the first correspondence is obtained using the first neural network model.

[0111] The first descriptive text is a user input instruction used to describe the mapping relationship between target entities; in other words, it is a prompt message used to identify the relationship between target entities. For example, "Get the mapping relationship between target entities and output it."

[0112] In one example, continue as follows Figure 4 As shown, step S31 includes steps S311-S312.

[0113] S311: Obtain context information for the target raw data.

[0114] Continuing with the example above, based on the target original data "John studied at L University in 2022", the contextual information obtained from the target original data could be: John has an educational background, that is, he was a student at L University in 2022, and it may imply that John's age is likely within the age range for receiving higher education, such as between 18 and 25 years old.

[0115] S312: Using the first correspondence of the target original data and the first descriptive text as input to the first neural network model, the second correspondence is obtained using the first neural network model.

[0116] Following the example above, the context information from Table 1, namely “John” - “person’s name”, “2022” - “time”, “L University” - “organization”, “reading” - “activity”, and “obtain the mapping relationship between target entities and output”, is input into the first neural network model to obtain the second correspondence.

[0117] The second correspondence is used to characterize the mapping relationship between at least two target entities.

[0118] It should be noted that obtaining the second correspondence can be based on the above steps S311-S312, or it can be done by directly using the target original data, the first correspondence, and the first descriptive text as input to the first neural network model, and using the first neural network model to obtain the second correspondence. There is no single limitation here.

[0119] Optionally, the above second correspondence can be constructed into a data table, namely the "target entity-target entity" table.

[0120] For example, the following description is provided with reference to Table 2.

[0121] Table 2 ; S4: Determine the third correspondence based on the target entity and the target entity category.

[0122] In one implementation, the combination continues. Figure 4 As shown, step S4 includes step S41.

[0123] S41: Using the target entity, target entity category, and fourth descriptive text as input to the first neural network model, the third correspondence is obtained using the first neural network model.

[0124] The fourth descriptive text describes the user input instruction to generate a mapping relationship between the target entity and its corresponding entity category based on the target entity and the target entity category. For example, "Get the mapping relationship between the target entity and the target entity category, and output it."

[0125] For example, the target entities “John”, “2022”, “L University”, and “reading”, the target entity categories “person”, “time”, “organization”, and “activity”, and the fourth descriptive text “obtain the mapping relationship between the target entities and the target entity categories and output it” are input into the first neural network model to obtain the third correspondence. The third correspondence is used to represent the mapping relationship between target entity categories. For example, “person” participates in “activity”, “activity” occurs at “time”, “activity” occurs at “organization”, “person” reads at “organization”, and “time” describes “activity”.

[0126] Optionally, the above third correspondence can be constructed into a data table, namely a table of "target entity category - target entity category".

[0127] For example, the following description is provided with reference to Table 3.

[0128] Table 3 ; S5: Construct a graph database based on the first, second, and third correspondences.

[0129] In one implementation, the combination continues. Figure 4 As shown, step S5 includes steps S51-52.

[0130] S51: Perform deduplication on the first correspondence, the second correspondence, and the third correspondence to obtain the deduplicated first correspondence, the second correspondence, and the third correspondence.

[0131] In one example, the first correspondence, the second correspondence, the third correspondence, and the fifth descriptive text are used as inputs to the first neural network model. The first neural network model is then used to obtain the deduplicated first correspondence, second correspondence, and third correspondence.

[0132] The fifth descriptive text describes the user input instruction to perform deduplication on the first, second, and third correspondences. For example, "Deduplicate the first, second, and third correspondences and output the result."

[0133] S52: Store the deduplicated first, second, and third correspondences in the target format to the graph database.

[0134] The target format can be JSON or other formats; no specific restrictions are imposed here.

[0135] In one example, the data format of the deduplicated first, second, and third correspondences is converted into a unified JSON format and imported into the graph database.

[0136] In summary, by acquiring a three-tiered knowledge system that describes the direct relationships between entities, establishes the attribution relationships between entities and categories, and forms abstract relationships between categories, the efficiency and data quality of graph database construction can be effectively improved through multi-level semantic associations.

[0137] After the graph database is constructed, it can be used to accurately answer users' natural language questions. Based on this, this application also provides a query method based on a graph database, which is described below in conjunction with... Figure 8 and Figure 9 Please provide a detailed explanation.

[0138] Figure 8 This is a schematic diagram of the first flowchart of a query method based on a graph database provided in this application embodiment.

[0139] Figure 9 This is a second flowchart illustrating a query method based on a graph database provided in an embodiment of this application.

[0140] like Figure 8 and Figure 9 As shown, the query method based on graph databases includes the following steps: S81: Get the first input text entered by the user.

[0141] For example, a user can enter a piece of natural language text, such as "find Zhang San's indirect friend".

[0142] S82: Based on the first input text and the target relation set in the graph database, update the first input text to obtain the corresponding second input text. Figure 10 This is a third flowchart illustrating a query method based on a graph database provided in an embodiment of this application.

[0143] In one implementation, such as Figure 10 As shown, step S82 includes steps S821-S823.

[0144] S821: Based on the first input text, search for at least one entity corresponding to the first input text in the graph database.

[0145] The graph database is obtained by the graph database construction method in the above embodiments.

[0146] In one implementation, firstly, keyword extraction or entity recognition is performed on the first input text to obtain at least one corresponding candidate entity.

[0147] In one example, natural language processing tools can be used to extract candidate entities. For instance, entity recognition can be performed on the first input text "find Zhang San's indirect friend" to obtain "Zhang San" and "entity".

[0148] Next, at least one entity is obtained from the graph database based on at least one candidate entity.

[0149] In one example, the similarity between each candidate entity and each node in the graph database is calculated.

[0150] Similarity can be calculated based on edit distance, cosine similarity, or other algorithms; no specific limitation is made here.

[0151] The similarity is calculated using formula (1) below:

[0152] in, It is a candidate entity. It is a physical entity. It is the minimum number of single-character edit operations required to convert s1 to s2. It is the length of the string.

[0153] For example, identify “Entity 1: Zhang San, Entity 1: Zhang Shan, and Entity 2: Friend” in the graph database.

[0154] S822: Determine a first set of entities from at least one entity.

[0155] Continuing with the example above, further filtering is performed from at least one entity to confirm the target entity set for query execution, namely "Entity 1: Zhang San, Entity 2: Friend".

[0156] S823: Determine the target set of relations based on the first entity set and the first, second, and third correspondences in the graph database.

[0157] The first correspondence is used to represent the mapping relationship between target entities, the second correspondence is used to represent the mapping relationship between target entities and target entity categories, and the third correspondence is used to represent the mapping relationship between target entity categories. The target relationship set is a set of semantic relationships that have been filtered and retained and that satisfy preset relevance conditions with the first input text.

[0158] It should be noted that a graph database is not a relational database with three tables, but a database composed of a graph structure with nodes, edges, labels, and attributes as its core.

[0159] In one example, continue combining Figure 10 As shown, S823 includes steps S8231-S8232.

[0160] S8231: Determine the initial set of relations based on the first entity set and the first, second, and third correspondences in the graph database.

[0161] The initial set of relationships includes at least one of the following: relationships between target entities, relationships between target entities and their corresponding entity categories, and relationships between entity categories.

[0162] For example, the first entity set, the graph database, and the first prompt word are used as inputs to the first neural network model, and the initial relation set is obtained using the first neural network model.

[0163] The first prompt word describes the task instruction for obtaining various semantic relationships related to the target entity. For example: "Based on the database structure and target entity shown in the figure below, please extract all possible related relationships, including direct relationships between entities, the relationship between an entity and its category, and potential semantic relationships between categories."

[0164] Continuing with the example above, assuming the target entity set is {“Zhang San”}, and the graph database contains nodes and edges such as people, friendships, companies, and positions, the first neural network model, upon receiving the prompt, combines the pattern information and instance data of the graph database to automatically identify the entity node corresponding to “Zhang San” and infer the multi-level relationships involved, such as the FRIEND_WITH relationship between “Zhang San” and “Li Si”, and the WORKS_AT relationship between “Zhang San” and “XXX Technology Company”; the entity’s affiliation relationship with its category, such as the instance_of(Person) corresponding to Zhang San:Person, etc.

[0165] S8232: Determine the target relation set based on the initial relation set and the first input text.

[0166] For example, the initial set of relations, the first input text, and the second prompt word are used as inputs to the first neural network model, and the target set of relations is obtained using the first neural network model.

[0167] The second prompt word describes the task instruction to filter the candidate relations that are most relevant to the user's query intent. For example: "Please analyze the following user question and select the key relations that best answer the question from the provided second relation set, retaining only relations with high semantic matching degree." The target relation set refers to the subset of relations in the initial relation set whose semantic matching degree is greater than a preset relation threshold after calculation by the first neural network model.

[0168] Continuing with the example above, the first neural network model uses semantic understanding to determine the implicit two-hop social relationship of "indirect friends," thus focusing on evaluating the transitive relationship related to "friends." The model calculates the matching score for each relationship: 0.96 for direct association with "friends," 0.88 for semantic similarity indicating possible acquaintance, and 0.4 for professional relationship indicating no connection. Based on a preset relationship threshold of 0.8, the model can further determine the target relationship set.

[0169] S824: Determine the second input text based on the first input text and the target relation set.

[0170] In one implementation, a first input text, an initial set of relations, and a third prompt word are used as inputs to a first neural network model, and the second input text is obtained using the first neural network model.

[0171] The third prompt word describes the task instruction to enrich the content and enhance the semantics of natural language query questions. For example, "Please expand and refine the original question by combining the following key relationships to make its semantics more complete and its structure clearer, making it suitable for graph database queries. Please retain the original intent and explicitly express the relational paths and entity types involved."

[0172] Continuing with the example above, the first input text "Find Zhang San's indirect friends," "Direct association with 'friends' is 0.96, semantically similar, indicating possible acquaintance is 0.88," and "Please expand and refine the original problem by combining the following key relationships to make its semantics more complete and its structure clearer, suitable for graph database queries. Please retain the original intent and explicitly express the related relationship paths and entity types." are input into the first neural network model to obtain the second input text "Find everyone connected to 'Zhang San' through the FRIEND_WITH relationship with a path length of 2."

[0173] S83: Using the second input text as input to the first model, the target query result is obtained using the first model.

[0174] The first model will be explained using the first neural network model as an example.

[0175] Continuing with the example above, the input to the first neural network model is "find all people who are connected to 'Zhang San' through the FRIEND_WITH relationship and whose path length is 2". Using the first neural network model, the target query results are obtained, namely "Li Si" and "Wang Er".

[0176] In summary, by introducing a well-constructed graph database, missing or implicit semantic information in the first input text can be automatically identified and supplemented before the query, i.e., the second input text. This can significantly improve the accuracy and completeness of the input query.

[0177] Corresponding to the aforementioned embodiments of the graph database construction method, this application also provides embodiments of the graph database construction apparatus.

[0178] It should be noted that the first model in this application can be the first neural network model in the example above, or it can be other models with the same function, such as machine learning models, without any specific limitation here.

[0179] Figure 11 This is a schematic diagram of a graph database construction device provided in an embodiment of this application.

[0180] like Figure 11 As shown, the graph database construction device 1100 includes: a first acquisition module 1101, a first determination module 1102, and a construction module 1103.

[0181] The first acquisition module 1101 is configured to: extract at least one target entity from the target raw data; wherein the target raw data is text format data; the first determination module 1102 is configured to: classify the at least one target entity and determine a first correspondence between the target entity and the target entity category; the first determination module 1102 is further configured to: determine a second correspondence based on the first correspondence, context information of the target raw data, and a first descriptive text; wherein the second correspondence is used to characterize the mapping relationship between at least two target entities; the first descriptive text is a prompt message used to identify the relationship between target entities; the first determination module 1102 is further configured to: determine a third correspondence based on the target entity and the target entity category; the third correspondence is used to characterize the mapping relationship between target entity categories; the construction module 1103 is further configured to: construct a graph database based on the first correspondence, the second correspondence, and the third correspondence.

[0182] In one possible implementation, the first acquisition module 1101 is specifically configured to: acquire target raw data; use the target raw data as input to a natural language processing tool, and use the natural language processing tool to obtain at least one output entity; use the at least one output entity as input to a first model, and use the first model to obtain at least one target entity.

[0183] In one possible implementation, the first acquisition module 1101 is specifically configured to: acquire first raw data; the first raw data includes structured data and unstructured data in different formats; use the structured data, unstructured data in different formats, and second descriptive text as input to the first model, and use the first model to obtain target raw data; the second descriptive text is used to describe user input instructions for converting the data format of the first raw data into text format.

[0184] In one possible implementation, the first acquisition module 1101 is further configured to: use the target entity and the third descriptive text as input to the first model, and use the first model to obtain a first correspondence between the target entity and the target entity category; wherein the third descriptive text is used to describe user input instructions for generating the corresponding entity category of each entity based on the target entity; or, use the target entity as input to the second model, and use the second model to obtain a first correspondence between the target entity and the target entity category.

[0185] In one possible implementation, the first determining module 1102 is specifically configured to: take the target entity, the target entity category, and the fourth descriptive text as input to the first model, and use the first model to obtain the third correspondence; wherein, the fourth descriptive text is used to describe the user input instruction to generate the mapping relationship between the corresponding entity categories of each entity based on the target entity and the target entity category.

[0186] In one possible implementation, the construction module 1103 is specifically configured to: perform deduplication operations on the first correspondence, the second correspondence, and the third correspondence to obtain the deduplicated first correspondence, the second correspondence, and the third correspondence; and store the deduplicated first correspondence, the second correspondence, and the third correspondence in the target format to the graph database.

[0187] Corresponding to the aforementioned embodiments of the graph database-based query method, this application also provides embodiments of the graph database-based query apparatus.

[0188] Figure 12 This is a schematic diagram of a graph database-based query device provided in an embodiment of this application.

[0189] like Figure 12 As shown, the graph database-based query device 1200 includes: a second acquisition module 1201, an update module 1202, and a second determination module 1203.

[0190] The second acquisition module 1201 is configured to: acquire the first input text input by the user; the update module 1202 is configured to: update the first input text based on the first input text and the target relation set in the graph database to obtain the corresponding second input text; wherein, the graph database is obtained using a graph database construction method; the target relation set is a set of semantic relations that are retained after filtering and that satisfy the preset relevance conditions with the first input text; the second determination module 1203 is configured to: use the second input text as the input of the first model and use the first model to obtain the target query result.

[0191] In one possible implementation, the update module 1202 is specifically configured to: search for at least one entity corresponding to the first input text in the graph database based on the first input text; determine a target entity set from the at least one entity; determine a first relationship set based on the target entity set and a first, second, and third correspondence in the graph database; the first correspondence is used to characterize the mapping relationship between target entities, the second correspondence is used to characterize the mapping relationship between target entities and target entity categories, and the third correspondence is used to characterize the mapping relationship between target entity categories; and determine a second input text based on the first input text and the first relationship set.

[0192] In one possible implementation, the second determining module 1203 is specifically configured to: determine a second relationship set based on the target entity set and the first, second, and third correspondences in the graph database; wherein the second relationship set includes the relationships between target entities, the relationships between target entities and their corresponding entity categories, and the relationships between entity categories; and determine a first relationship set based on the second relationship set and the first input text.

[0193] Figure 13 This is a schematic diagram of a computing device provided in an embodiment of this application.

[0194] like Figure 13 As shown, the computing device 1300 includes a processor 1301 and a memory 1302.

[0195] For example, the computing device 1300 may also include a communications interface 1303 and a communications bus 1304.

[0196] The processor 1301, memory 1302, and communication interface 1303 communicate with each other via communication bus 1104. The communication interface 1304 may include a transmitter and receiver for communicating with other devices or communication networks, and may be a wired interface (port), such as a fiber distributed data interface (FDDI) or a gigabit Ethernet interface (GE).

[0197] In some embodiments, the processor 1301 is used to execute program 1305, specifically performing the relevant steps in the above-described embodiments of the graph database construction and execution method. Specifically, program 1305 may include program code, which includes computer-executable instructions.

[0198] For example, processor 1301 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement some embodiments of this application. Computing device 1300 may include one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs. The CPU may be a single-core CPU or a multi-core CPU.

[0199] In some embodiments, memory 1302 is used to store program 1305. Memory 1302 may include high-speed random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device.

[0200] Specifically, program 1305 can be called by processor 1301 to cause computing device 1300 to perform inference task execution method operations.

[0201] Some embodiments of this application provide a computer-readable storage medium storing at least one executable instruction that, when executed on a computing device 1300, causes the computing device 1300 to perform the graph database construction method described in the above embodiments.

[0202] For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, a floppy disk, and an optical data storage device.

[0203] This application provides a chip system for use in a server. The chip system includes one or more interface circuits and one or more processors. The interface circuits and processors are interconnected via lines. The interface circuits are used to receive signals from the server's memory and send signals to the processors, the signals including computer instructions stored in the memory. When the server processor executes the computer instructions, the server performs various steps in the graph database construction method shown in the above-described method embodiments.

[0204] The beneficial effects that the readable storage medium provided in some embodiments of this application can achieve can be referred to the beneficial effects in the corresponding inference task execution method provided above, and will not be repeated here.

[0205] It should be noted that, in this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.

[0206] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0207] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).

[0208] For the purposes of this specification, "computer-readable medium" can mean any means that can contain, store, communicate, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0209] More specific examples of computer-readable media (a non-exhaustive list) include the following: electrical connections having one or more wires (electronic devices), portable computer disks (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM).

[0210] Furthermore, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory. It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof.

[0211] In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc. The embodiments described above are merely specific embodiments of this application and are not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made based on the technical solutions of this application should be included within the scope of protection of this application.

Claims

1. A method for constructing a graph database, characterized in that, The method comprises: extracting target entities from target raw data; wherein the target raw data is data in a text format; classifying the target entities to determine a first correspondence relationship between the target entities and target entity categories; determining a second correspondence relationship based on the first correspondence relationship, context information based on the target raw data, and a first description text; wherein the second correspondence relationship is used to represent a mapping relationship between at least two target entities; and the first description text is prompt information used to identify a relationship between the target entities; determining a third correspondence relationship based on the target entities and the target entity categories; wherein the third correspondence relationship is used to represent a mapping relationship between the target entity categories; constructing the graph database based on the first correspondence relationship, the second correspondence relationship, and the third correspondence relationship.

2. The method of claim 1, wherein, The target entities are extracted from the target raw data, which comprises: obtaining the target raw data; using the target raw data as an input of a natural language processing tool, and obtaining at least one output entity by using the natural language processing tool; using the at least one output entity as an input of a first model, and obtaining the target entities by using the first model.

3. The method of claim 2, wherein, Further comprising: obtaining first raw data; wherein the first raw data comprises structured data and / or unstructured data in different formats; using the structured data, the unstructured data in different formats, and a second description text as an input of a first model, and obtaining the target raw data by using the first model; wherein the second description text is used to describe a user input instruction for converting the data format of the first raw data into data in a text format.

4. The method according to any of claims 1 to 3, characterized in that, The target entities are classified to determine the first correspondence relationship between the target entities and the target entity categories, which comprises: using the target entities and a third description text as an input of a first model, and obtaining the first correspondence relationship between the target entities and the target entity categories by using the first model; wherein the third description text is used to describe a user input instruction for generating a corresponding entity category of each entity based on the target entities; or, using the target entities as an input of a second model, and obtaining the first correspondence relationship between the target entities and the target entity categories by using the second model.

5. The method according to any of claims 1 to 4, characterized in that, The third correspondence relationship is determined based on the target entities and the target entity categories, which comprises: using the target entities, the target entity categories, and a fourth description text as an input of the first model, and obtaining the third correspondence relationship by using the first model; wherein the fourth description text is used to describe a user input instruction for generating a mapping relationship between corresponding entity categories of each entity based on the target entities and the target entity categories.

6. The method according to any one of claims 1 to 5, characterized in that, The graph database is constructed based on the first correspondence relationship, the second correspondence relationship, and the third correspondence relationship, which comprises: performing a deduplication operation on the first correspondence relationship, the second correspondence relationship, and the third correspondence relationship to obtain deduplicated first correspondence relationship, second correspondence relationship, and third correspondence relationship. Store the deduplicated first correspondence relationship, the second correspondence relationship and the third correspondence relationship in a target format into the graph database. 7.A method for querying a graph database, characterized in that, The method comprises: obtaining first input text input by a user; updating the first input text based on the first input text and a target relationship set in a graph database to obtain corresponding second input text; wherein the graph database is obtained by the method for constructing a graph database according to any one of claims 1-6; the target relationship set is a set of semantic relationships that meet a preset correlation condition with the first input text and is extracted from the graph database; using the second input text as input of a first model, and obtaining a target query result by using the first model.

8. The method of claim 7, wherein, The updating the first input text based on the first input text and a target relationship set in a graph database to obtain corresponding second input text comprises: finding at least one entity corresponding to the first input text from the graph database based on the first input text; determining a first entity set from the at least one entity; determining a target relationship set based on the first entity set and a first correspondence relationship, a second correspondence relationship and a third correspondence relationship in the graph database; the first correspondence relationship is used to represent a mapping relationship between target entities, the second correspondence relationship is used to represent a mapping relationship between the target entities and target entity categories, and the third correspondence relationship is used to represent a mapping relationship between the target entity categories; determining the second input text based on the first input text and the target relationship set.

9. The method of claim 8, wherein, The determining a target relationship set based on the first entity set and a first correspondence relationship, a second correspondence relationship and a third correspondence relationship in the graph database comprises: determining an initial relationship set based on the first entity set and the first correspondence relationship, the second correspondence relationship and the third correspondence relationship in the graph database; wherein the initial relationship set comprises relationships between the target entities, relationships between target entities and entity categories corresponding to the target entities, and relationships between the entity categories; determining the target relationship set based on the initial relationship set and the first input text.

10. A computing device, comprising: The computing device comprises a memory and a processor; the memory and the processor are coupled; the memory is used to store computer program code, the computer program code comprises computer instructions, and when the processor is used to execute the computer instructions, the computing device executes the method for constructing a graph database according to any one of claims 1-6 and the query method based on the graph database according to any one of claims 7-9.