Database management method, apparatus, device, and medium
Patent Information
- Application Number
- CN202311864444.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2043-12-29
AI Technical Summary
[0010] According to one or more embodiments of this disclosure, efficient management and fast retrieval of tables in a multi-level database are achieved by converting multiple tables in a multi-level database, the attributes of each table, and the relationships between the tables into multiple instance nodes in a graph database, the node attributes of the instance nodes, and multiple first edges between the instance nodes, converting the target table attributes into class nodes in the graph database, and constructing a second edge between the class nodes and the instance nodes corresponding to the table with the target table attributes.
Smart Images

Figure CN117827835B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computers, specifically to the field of database technology, and particularly to a database management method, database management device, electronic device, computer-readable storage medium, and computer program product. Background Technology
[0002] Multi-tiered databases are used to store, process, and manage massive amounts of big data to facilitate data analysis, statistics, and mining.
[0003] The methods described in this section are not necessarily methods that had been previously conceived or adopted. Unless otherwise specified, no method described in this section should be assumed to be prior art simply because it is included in this section. Similarly, unless otherwise specified, the issues mentioned in this section should not be considered to be accepted in any prior art. Summary of the Invention
[0004] This disclosure provides a database management method, a database management device, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of this disclosure, a database management method is provided, comprising: obtaining multiple tables in a multi-level database, at least one table attribute of each of the multiple tables, and relationships between the multiple tables; determining a target table attribute, and identifying at least one table among the multiple tables that has the target table attribute; and generating a graph database corresponding to the multi-level database, the graph database comprising: multiple instance nodes corresponding to the multiple tables, the node attribute of each instance node indicating at least one table attribute of the table corresponding to the instance node; multiple first edges between the multiple instance nodes, the edge attribute of each first edge indicating a relationship between two tables corresponding to two instance nodes connected by the first edge; a class node corresponding to the target table attribute, the node attribute of the class node indicating the target table attribute; and at least one second edge between the class node and at least one instance node corresponding to at least one table.
[0006] According to another aspect of this disclosure, a database management apparatus is provided, comprising: an acquisition unit configured to acquire multiple tables in a multi-level database, at least one table attribute of each of the multiple tables, and a relationship between the multiple tables; a first determination unit configured to determine a target table attribute and determine at least one table having the target table attribute among the multiple tables; and a generation unit configured to generate a graph database corresponding to the multi-level database, the graph database comprising: multiple instance nodes corresponding to the multiple tables, the node attributes of the instance nodes indicating at least one table attribute of the table corresponding to the instance node; multiple first edges between the multiple instance nodes, the edge attributes of the first edges indicating a relationship between two tables corresponding to two instance nodes connected by the first edge; a class node corresponding to the target table attribute, the node attributes of the class node indicating the target table attribute; and at least one second edge between the class node and at least one instance node corresponding to at least one table.
[0007] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods described above.
[0008] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the above-described method.
[0009] According to another aspect of this disclosure, a computer program product is provided, including a computer program, wherein the computer program implements the above-described method when executed by a processor.
[0010] According to one or more embodiments of this disclosure, efficient management and fast retrieval of tables in a multi-level database are achieved by converting multiple tables in a multi-level database, the attributes of each table, and the relationships between the tables into multiple instance nodes in a graph database, the node attributes of the instance nodes, and multiple first edges between the instance nodes, converting the target table attributes into class nodes in the graph database, and constructing a second edge between the class nodes and the instance nodes corresponding to the table with the target table attributes.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0013] Figure 1 A schematic diagram of an exemplary system in which the various methods described herein may be implemented according to embodiments of the present disclosure is shown;
[0014] Figure 2 A flowchart of a database management method according to an exemplary embodiment of the present disclosure is shown;
[0015] Figure 3 A flowchart illustrating the generation of a graph database corresponding to a multi-tiered database according to an exemplary embodiment of the present disclosure is shown;
[0016] Figure 4 A flowchart of a database management method according to an exemplary embodiment of the present disclosure is shown;
[0017] Figure 5 A flowchart of a database management method according to an exemplary embodiment of the present disclosure is shown;
[0018] Figure 6 A schematic diagram of a graph database according to an exemplary embodiment of the present disclosure is shown;
[0019] Figure 7 A structural block diagram of a database management apparatus according to exemplary embodiments of the present disclosure is shown; and
[0020] Figure 8 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation
[0021] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0022] In this disclosure, unless otherwise stated, the use of terms such as "first," "second," etc., to describe various elements is not intended to limit the positional, temporal, or importance relationships of these elements; such terms are merely used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of that element, while in other cases, based on the context, they may refer to different instances.
[0023] The terminology used in the description of the various examples described in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context explicitly indicates otherwise, an element may be one or more unless the number of elements is specifically limited. Furthermore, the term "and / or" as used in this disclosure covers any one of the listed items and all possible combinations thereof.
[0024] In related technologies, using relational databases for database management cannot effectively represent the relationships between different tables, making management and maintenance difficult and inconvenient for retrieval.
[0025] To address the aforementioned issues, this disclosure transforms multiple tables in a multi-tiered database, their respective attributes, and the relationships between them into multiple instance nodes in a graph database, the node attributes of these instance nodes, and multiple first edges between them. Furthermore, it transforms the target table attributes into class nodes in the graph database and constructs a second edge between the class nodes and the instance nodes corresponding to the tables with the target table attributes. This achieves efficient management and rapid retrieval of tables in a multi-tiered database.
[0026] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0027] Figure 1 A schematic diagram of an exemplary system 100 in which the various methods and apparatus described herein can be implemented according to embodiments of this disclosure is shown. Reference Figure 1 The system 100 includes one or more client devices 101, 102, 103, 104, 105 and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105 and 106 can be configured to execute one or more applications.
[0028] In embodiments of this disclosure, server 120 may run one or more services or software applications that enable the execution of database management methods.
[0029] In some embodiments, server 120 may also provide other services or software applications that may include non-virtual and virtual environments. In some embodiments, these services may be provided as web-based services or cloud services, such as to users of client devices 101, 102, 103, 104, 105 and / or 106 under a Software as a Service (SaaS) network.
[0030] exist Figure 1 In the configuration shown, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or combinations thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 can sequentially interact with server 120 using one or more client applications to utilize the services provided by these components. It should be understood that various different system configurations are possible and may differ from system 100. Therefore, Figure 1 This is an example of a system used to implement the various methods described herein, and is not intended to be limiting.
[0031] Users can use client devices 101, 102, 103, 104, 105, and / or 106 to generate various types of user data. The client devices can provide interfaces that enable users to interact with them. The client devices can also output information to users through these interfaces. Although... Figure 1 Only six client devices are described, but those skilled in the art will understand that this disclosure can support any number of client devices.
[0032] Client devices 101, 102, 103, 104, 105, and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptops), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors, or other sensing devices. These computer devices can run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as Google Chrome OS); or include various mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, and Android. Portable handheld devices may include cellular phones, smartphones, tablets, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Gaming systems may include various handheld gaming devices, internet-enabled gaming devices, etc. Client devices are capable of executing various applications, such as various internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.
[0033] Network 110 can be any type of network well known to those skilled in the art, and can use any of a variety of available protocols (including but not limited to TCP / IP, SNA, IPX, etc.) to support data communication. By way of example only, one or more networks 110 can be a local area network (LAN), an Ethernet-based network, a token ring network, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0034] Server 120 may include one or more general-purpose computers, special-purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that can be virtualized to maintain virtual storage devices for servers). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0035] The computing unit in server 120 can run one or more operating systems, including any of the aforementioned operating systems and any commercially available server operating system. Server 120 can also run any of a variety of additional server applications and / or middleware applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0036] In some implementations, server 120 may include one or more applications to analyze and merge data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.
[0037] In some implementations, server 120 can be a server for a distributed system or a server integrated with blockchain. Server 120 can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Server (VPS) services, such as high management difficulty and weak business scalability.
[0038] System 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. Databases 130 may reside in various locations. For example, a database used by server 120 may be local to server 120, or it may be located away from server 120 and may communicate with server 120 via a network-based or dedicated connection. Databases 130 may be of different types. In some embodiments, the database used by server 120 may be a database, such as a relational database. One or more of these databases may store, update, and retrieve data from and from the database in response to commands.
[0039] In some embodiments, one or more of the databases 130 may also be used by an application to store application data. The databases used by the application may be of different types, such as key-value stores, object stores, or regular stores supported by a file system.
[0040] Figure 1 The system 100 can be configured and operated in various ways to enable the application of the various methods and apparatus described in this disclosure.
[0041] According to one aspect of this disclosure, a database management method is provided. For example... Figure 2 As shown, the database management method includes: step S201, obtaining multiple tables in a multi-level database, at least one table attribute of each of the multiple tables, and the relationship between the multiple tables; step S202, determining a target table attribute, and determining at least one table with the target table attribute among the multiple tables; and step S203, generating a graph database corresponding to the multi-level database, the graph database including: multiple instance nodes corresponding to the multiple tables, the node attribute of the instance node indicating at least one table attribute of the table corresponding to the instance node; multiple first edges between the multiple instance nodes, the edge attribute of the first edge indicating the relationship between the two tables corresponding to the two instance nodes connected by the first edge; a class node corresponding to the target table attribute, the node attribute of the class node indicating the target table attribute; and at least one second edge between the class node and at least one instance node corresponding to at least one table.
[0042] Therefore, by converting multiple tables in a multi-level database, their respective attributes, and the relationships between them into multiple instance nodes in a graph database, the node attributes of the instance nodes, and multiple first edges between the instance nodes, and converting the target table attributes into class nodes in the graph database, and constructing a second edge between the class nodes and the instance nodes corresponding to the table with the target table attributes, efficient management and fast retrieval of tables in a multi-level database are achieved.
[0043] In some embodiments, the methods disclosed herein can be used to manage a data warehouse with a multi-tiered architecture. In one exemplary embodiment, a multi-tiered database may include the following levels:
[0044] (1) Data Operation Layer (ODS, Operational Data Store):
[0045] This layer typically contains recent, detailed business data. This data usually comes from various business systems, such as ERP and CRM. The purpose of ODS is to quickly provide the latest operational data for daily business queries and reporting.
[0046] (2) Dimension Data Layer (DIM):
[0047] This layer stores basic dimensional data, also known as dimension tables. These tables describe the business entities in the data warehouse (such as customers, products, time, etc.). Dimension tables typically contain descriptive information to support operations such as dimension slicing and data aggregation in data analysis.
[0048] Taking the automotive industry as an example, basic dimensional data can include: city code dimensional table, city level table, vehicle information fusion dimensional table, user characteristic dimensional table, dealer information dimensional table, vehicle model database information table, etc.
[0049] (3) Data Warehouse Detail (DWD):
[0050] This layer stores cleaned, transformed, and integrated data, either from the ODS layer or directly from the source system. Its primary function is to retain historical data, providing a detailed historical record for downstream analysis.
[0051] (4) Data Summary Layer (DWS):
[0052] This layer contains data that has been further summarized and aggregated. It is mostly based on business themes and builds related thematic profiles, often in the form of large wide tables.
[0053] (5) Data Application Layer (ADS, Application Data Service):
[0054] This layer is the final output layer of the data warehouse, typically containing data prepared for specific business applications or analytical purposes. Based on specific business needs, this layer extracts, performs logical operations and processing on the data from the aforementioned multiple data layers, generating data analysis reports directly accessible to the business side. This data has undergone meticulous processing and optimization, making it suitable for reporting, data mining, and business intelligence analysis.
[0055] According to some embodiments, multiple tables can belong to multiple levels in a multi-level database, and each of the multiple tables has at least one table attribute that includes the level to which the corresponding table belongs.
[0056] Therefore, by using the level of the table as a table attribute, the resulting graph database contains the level information of the tables, thus enabling the graph database to quickly obtain the level information of different tables.
[0057] According to some embodiments, at least one table attribute of each of the multiple tables may include the table header of the corresponding table.
[0058] Therefore, by using the table header as a table attribute, the resulting graph database contains the table header information, allowing for the rapid retrieval of header information from different tables using this graph database.
[0059] In some embodiments, table attributes may also include the table's business scenario, scope of application, user profile, product library, etc.
[0060] According to some embodiments, the relationship between multiple tables can include an upstream-downstream relationship between a first table and a second table, where the data in the downstream second table depends on the data in the upstream first table. In a multi-tiered database, a table in a downstream tier can be derived from a table in an upstream tier; such a relationship between two tables can be called an upstream-downstream relationship (lineage relationship). Other relationships may also exist between multiple tables, which are not limited here.
[0061] In some embodiments, in step S201, multiple tables, at least one attribute of each table, and relationships between the tables can be obtained from a relational database that stores table information of a multi-level database. It should be noted that relational databases struggle to maintain the topological structure of multiple tables, wasting considerable space storing topological relationships when storing information about multiple tables. Graph databases, on the other hand, can effectively store and display the topological structure between multiple tables, thus saving storage space.
[0062] In graph databases, in addition to generating instance nodes corresponding to multiple tables and multiple first edges describing the relationships between multiple tables, class nodes corresponding to the target table attributes can also be constructed, and a second edge can be constructed between the class nodes and at least one instance node corresponding to at least one table with the target table attributes, thereby enabling better retrieval and display of tables and their table attributes related to the target table attributes.
[0063] In some embodiments, the classes (node / table attributes), relations (edges), attributes, and instances (nodes / tables) constitute a four-tuple data model. This model, by increasing the number of tuples, provides a clearer hierarchical representation of concepts and terms in the ontology, offering advantages such as simplicity, ease of understanding, and intuitiveness. Furthermore, by altering the model's data structure, it comprehensively describes concepts and terms, as well as the relationships between them. A complete ontology includes the four elements described above: class (C), relation (R), attribute (At), and instance (Ao).
[0064] (1) Class (C): In addition to the general meaning of the concept, the names of tasks, actions and events in the metadata can also be represented as subject resources and object resources. For example, "data lineage" and "upstream and downstream dependencies of tasks" can be classified into one class.
[0065] (2) Relationship (R): A mapping method for defining concepts and attributes in an ontology, mainly referring to the constraint relationship between them. The domain consists of concepts in the concept set, while the value range can consist of concepts and data types such as numbers. The main relationships between domain ontology ontologies include subclass relations (subClassOf) and relations between instances and ontology terms (edf:type).
[0066] (3) Attributes (At): Describe the main characteristics of concepts in the domain ontology, mainly including two attributes: data attributes and object attributes. Data attributes refer to the association between objects and data type values, while object attributes refer to the association between objects.
[0067] (4) An instance (Ao) is a concrete instance of a class. For example, the APP daily active user table is an instance (table) of user behavior categories.
[0068] In some embodiments, step S202, determining the target table attribute, may include: determining at least one level among a plurality of levels as the target table attribute.
[0069] Therefore, by identifying at least one of multiple levels as the target table attribute, it becomes possible to quickly retrieve and query tables at a specific level using a graph database.
[0070] In one exemplary embodiment, one or more of the above-mentioned ODS, DIM, DWD, DWS, and ADS levels can be determined as target table attributes.
[0071] According to some embodiments, step S202, determining the target table attribute, may include: determining the target table attribute among the multiple table attributes based on the historical query frequency of multiple table attributes involved in multiple tables.
[0072] Therefore, by determining the target table attribute from multiple table attributes based on historical query frequency, and constructing class nodes and corresponding second sides in the graph database, users can quickly query tables and related information related to the target table attribute in the graph database.
[0073] In some embodiments, the multiple table attributes involved in multiple tables may include all table attributes of the multiple tables. Target table attributes determined based on historical query frequency may include, for example, specific business scenarios, hierarchical levels of multi-tiered databases, user profiles, product databases, etc.
[0074] In some embodiments, multiple target table attributes can be determined and multiple corresponding class nodes can be constructed, thereby facilitating the retrieval and query of tables and corresponding information related to multiple target table attributes.
[0075] In some embodiments, in step S203, a graph database corresponding to the multi-level database can be generated using information from multiple tables in the acquired multi-level database and the determined target attributes.
[0076] In some embodiments, the Resource Description Framework (RDF) can be used as the ontology description language. RDF is a framework developed for resource description using the Semantic Web. It is an ontology description language refined from the XML format and used to represent resource information. RDF can conveniently describe objects and the relationships between their attributes, enabling machine programs to freely exchange data over the network to achieve automated processing of network resources. Each basic structure in RDF data consists of a subject resource, a correspondence, and an object resource.
[0077] According to some embodiments, RDF data can be represented using a triple data structure. For example... Figure 3 As shown, step S203, generating a graph database corresponding to the multi-level database, includes: step S301, constructing multiple first triples based on the relationships between multiple tables, each of the multiple first triples including two tables with a relationship among the multiple tables, and including the relationship between the two tables; step S302, constructing at least one second triple based on the target table attribute and at least one table, each of the at least one second triple including the target table attribute and one table from the at least one table, and including the dependency relationship between the table and the target table attribute; and step S303, generating a graph database based on the multiple first triples and at least one second triple.
[0078] Therefore, by using the above method, the relationships between multiple tables and the attributes of the target table and the corresponding at least one table can be converted into multiple first triples and at least one second triple, which can then be used to quickly and accurately generate a graph database.
[0079] In some embodiments, ontology storage refers to the process of storing the constructed ontology on a suitable storage medium. A suitable storage scheme can improve the efficiency of ontology querying and management. Ontology retrieval refers to the process by which users obtain relevant knowledge using the ontology according to their needs. Different retrieval algorithms should be flexibly selected according to different storage media.
[0080] In some embodiments, Neo4j can be used as a graph database corresponding to a multi-tiered database. Neo4j is a non-relational graph database with good storage performance and query efficiency. This database uses a graph structure model as its basic storage unit, where nodes represent concepts and attributes in the ontology data, and edges between two nodes represent the correspondences within the ontology. Compared to relational databases, Neo4j's unique "node space" storage mode is more suitable for storing and displaying relationships between tables in multi-tiered databases. The Neo4j data model consists of three elements: nodes, attributes, and relationships (edges) between nodes. The advantages of this storage structure are its strong scalability and flexibility; node attributes can be added or deleted at any time in the graph network, effectively solving problems such as the storage of semi-structured and hashed data and memory waste. Furthermore, thanks to its unique data model, the Neo4j database can quickly query relevant information about nodes through methods such as depth-first traversal.
[0081] In some embodiments, the Neo4j database can be obtained by traversing RDF data.
[0082] According to some embodiments, such as Figure 4 As shown, the database management method may further include: step S404, in response to receiving a query request for a target table attribute, determining at least one table with the target table attribute using a graph database, including: step S4041, determining a class node corresponding to the target table attribute in the graph database; step S4042, determining at least one second edge connected to the class node; and step S4043, determining at least one table corresponding to at least one instance node connected to at least one second edge. It is understood that... Figure 4 The operations of steps S401-S403 can be referred to the above text. Figure 2 The descriptions of steps S201-S203 are omitted here.
[0083] Therefore, by using the above method, it is possible to quickly retrieve at least one table corresponding to the target table attribute and its corresponding information using the generated graph database.
[0084] According to some embodiments, such as Figure 5As shown, the database management method may further include: step S504, in response to determining that a target table among a plurality of tables has been updated, determining at least one downstream table of the target table using a graph database, including: step S5041, determining in the graph database at least one first edge indicating an upstream-downstream relationship and where the target table is located upstream; and step S5042, determining at least one downstream table corresponding to at least one instance node connected to at least one first edge; and step S505, processing the at least one downstream table based on the update to the target table. It is understood that... Figure 5 The operations of steps S501-S503 can be referred to the above text. Figure 2 The descriptions of steps S201-S203 are omitted here.
[0085] In a multi-tiered database, after data in an upstream table is modified, downstream tables that depend on that upstream table may also require processing. By generating a graph database corresponding to the multi-tiered database, when an upstream table in the multi-tiered database is modified, the graph database can be used to quickly find at least one downstream table that depends on that upstream table, thus enabling timely processing of these downstream tables.
[0086] In some embodiments, after generating the graph database, the graph database can be visualized, allowing users to intuitively see the topological structure of multiple tables in the multi-layered database and the relationships between the multiple tables. The database management method may further include: in response to detecting a user's click operation on an instance node, displaying relevant information about the instance node, such as the table corresponding to the instance node and at least one table attribute, a first edge and / or a second edge connecting the instance node, and the instance nodes and / or class nodes connected by the first edge and / or the second edge.
[0087] Figure 6 A schematic diagram of a graph database according to an embodiment of the present disclosure is shown. The graph database 600 includes three instance nodes 602, 604, and 606. Node 602 corresponds to a table in the ODS layer, node 604 corresponds to a table in the DIM layer, and node 606 corresponds to a table in the DWD layer. A first edge 610 indicating an upstream / downstream relationship (node 606 depends on node 602) exists between nodes 602 and 606, and a first edge 612 indicating an upstream / downstream relationship (node 606 depends on node 604) exists between nodes 604 and 606. Furthermore, the graph database 600 also includes a class node 608 corresponding to the DWD layer, and a second edge 614 indicating a dependency relationship between class node 608 and instance node 606.
[0088] According to another aspect of this disclosure, a database management apparatus is provided. For example... Figure 7As shown, the apparatus 700 includes: an acquisition unit 710 configured to acquire multiple tables in a multi-level database, at least one table attribute of each of the multiple tables, and relationships between the multiple tables; a first determination unit 720 configured to determine a target table attribute and determine at least one table with the target table attribute among the multiple tables; and a generation unit 730 configured to generate a graph database corresponding to the multi-level database, the graph database including: multiple instance nodes corresponding to the multiple tables, the node attributes of the instance nodes indicating at least one table attribute of the table corresponding to the instance node; multiple first edges between the multiple instance nodes, the edge attributes of the first edges indicating relationships between two tables corresponding to two instance nodes connected by the first edges; class nodes corresponding to the target table attribute, the node attributes of the class nodes indicating the target table attribute; and at least one second edge between the class node and at least one instance node corresponding to at least one table.
[0089] It is understandable that the operation of units 710-730 in device 700 can be referred to the above description. Figure 2 The descriptions of steps S201-S203 are not repeated here.
[0090] According to some embodiments, the apparatus 700 may further include (not shown in the figures): a second determining unit configured to, in response to receiving a query request for a target table attribute, determine at least one table having the target table attribute using a graph database, including: determining a class node corresponding to the target table attribute in the graph database; determining at least one second edge connected to the class node; and determining at least one table corresponding to at least one instance node connected to at least one second edge.
[0091] According to some embodiments, the first determining unit may include: a first determining subunit, configured to determine a target table attribute among multiple table attributes based on the historical query frequency of multiple table attributes involved in multiple tables.
[0092] According to some embodiments, multiple tables may belong to multiple levels in a multi-level database, and at least one table attribute of each of the multiple tables may include the level to which the corresponding table belongs. The first determining unit may include: a second determining subunit, configured to determine at least one level among the multiple levels as the target table attribute.
[0093] According to some embodiments, the relationship between multiple tables may include an upstream-downstream relationship between a first table and a second table, where the data in the downstream second table may depend on the data in the upstream first table.
[0094] According to some embodiments, the apparatus 700 may further include (not shown in the figures): a third determining unit configured to determine at least one downstream table of the target table using a graph database in response to determining that a target table among a plurality of tables has been updated, including: determining in the graph database at least one first edge indicating an upstream-downstream relationship and the target table being located upstream; and determining at least one downstream table corresponding to at least one instance node connected to at least one first edge; and a processing unit configured to process the at least one downstream table based on the update of the target table.
[0095] According to some embodiments, at least one table attribute of each of the multiple tables may include the table header of the corresponding table.
[0096] According to some embodiments, the generation unit may include: a first construction subunit configured to construct a plurality of first triples based on relationships between a plurality of tables, each of the plurality of first triples including two tables with a relationship among the plurality of tables, and including the relationship between the two tables; a second construction subunit configured to construct at least one second triplet based on a target table attribute and at least one table, each of the at least one second triplet including a target table attribute and one table from the at least one table, and including the dependency relationship between the table and the target table attribute; and a generation subunit configured to generate a graph database based on the plurality of first triples and at least one second triplet.
[0097] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0098] According to embodiments of this disclosure, an electronic device, a readable storage medium, and a computer program product are also provided.
[0099] refer to Figure 8 The present invention describes a structural block diagram of an electronic device 800 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0100] like Figure 8 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0101] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, output unit 807, storage unit 808, and communication unit 809. Input unit 806 can be any type of device capable of inputting information to electronic device 800. Input unit 806 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device, and can include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 807 can be any type of device capable of presenting information, and can include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 808 can include, but is not limited to, disk and optical disk. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and can include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth devices, 802.11 devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0102] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods, processes, and / or processes described above. For example, in some embodiments, these methods, processes, and / or processes may be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the methods, processes, and / or processes described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform these methods, processes, and / or processes by any other suitable means (e.g., by means of firmware).
[0103] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0104] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0105] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0106] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0107] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.
[0108] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the management difficulties and weak business scalability inherent in traditional physical hosts and VPS (Virtual Private Server) services. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0109] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0110] While embodiments or examples of this disclosure have been described with reference to the accompanying drawings, it should be understood that the methods, systems, and devices described above are merely exemplary embodiments or examples, and the scope of the invention is not limited by these embodiments or examples, but only by the granted claims and their equivalents. Various elements in the embodiments or examples may be omitted or replaced by their equivalents. Furthermore, the steps may be performed in a different order than that described in this disclosure. Further, various elements in the embodiments or examples may be combined in various ways. Importantly, as the technology evolves, many elements described herein can be replaced by equivalents that appear after this disclosure.
Claims
1. A database management method, comprising: Retrieve multiple tables from a multi-tiered database, at least one table attribute of each table, and the relationships between the tables; Determine the target table attributes, and identify at least one table among the plurality of tables that has the target table attributes; as well as Generate a graph database corresponding to the multi-layered database, the graph database comprising: Multiple instance nodes corresponding to the multiple tables, wherein the node attribute of the instance node indicates at least one table attribute of the table corresponding to the instance node; Multiple first edges between the plurality of instance nodes, wherein the edge attribute of the first edge indicates the relationship between the two tables corresponding to the two instance nodes connected by the first edge; The class node corresponding to the target table attribute, wherein the node attribute of the class node indicates the target table attribute; and At least one second side between the class node and at least one instance node corresponding to the at least one table.
2. The method according to claim 1, further comprising: In response to receiving a query request for the target table attribute, determining at least one table having the target table attribute using the graph database includes: Determine the class node corresponding to the target table attribute in the graph database; Determine at least one second edge connected to the class node; and Determine at least one table corresponding to at least one instance node connected to the at least one second edge.
3. The method according to claim 2, wherein, Determining the target table attributes includes: The target table attribute is determined from among the multiple table attributes based on the historical query frequency of the multiple table attributes involved in the multiple tables.
4. The method according to claim 1, wherein, The multiple tables belong to multiple levels in the multi-level database, and each of the multiple tables has at least one table attribute that includes the level to which the corresponding table belongs. The determination of target table attributes includes: At least one of the multiple levels is identified as the target table attribute.
5. The method according to claim 4, wherein, The relationships between the multiple tables include the upstream and downstream relationships between the first table and the second table, where the data in the downstream second table depends on the data in the upstream first table.
6. The method according to claim 5, further comprising: In response to determining that a target table among the plurality of tables has been updated, at least one downstream table of the target table is determined using the graph database, including: In the graph database, determine at least one first edge indicating the upstream-downstream relationship and where the target table is located upstream; and Determine the at least one downstream table corresponding to the at least one instance node connected to the at least one first edge; and Based on the update of the target table, the at least one downstream table is processed.
7. The method according to any one of claims 1-6, wherein, Each of the plurality of tables has at least one table attribute including the table header of the corresponding table.
8. The method according to any one of claims 1-6, wherein, Generating a graph database corresponding to the multi-layered database includes: Based on the relationships between the multiple tables, multiple first triplets are constructed. Each of the multiple first triplets includes two tables that have a relationship among the multiple tables, and includes the relationship between the two tables. Based on the target table attribute and the at least one table, at least one second triplet is constructed, each of the at least one second triplet including the target table attribute and one table from the at least one table, and including the dependency relationship between the table and the target table attribute; and The graph database is generated based on the plurality of first triples and the at least one second triple.
9. A database management device, comprising: The acquisition unit is configured to acquire multiple tables in a multi-level database, at least one table attribute of each of the multiple tables, and the relationship between the multiple tables. The first determining unit is configured to determine target table attributes and, among the plurality of tables, determine at least one table having the target table attributes; as well as The generation unit is configured to generate a graph database corresponding to the multi-layered database, the graph database comprising: Multiple instance nodes corresponding to the multiple tables, wherein the node attribute of the instance node indicates at least one table attribute of the table corresponding to the instance node; Multiple first edges between the plurality of instance nodes, wherein the edge attribute of the first edge indicates the relationship between the two tables corresponding to the two instance nodes connected by the first edge; The class node corresponding to the target table attribute, wherein the node attribute of the class node indicates the target table attribute; and At least one second side between the class node and at least one instance node corresponding to the at least one table.
10. The apparatus according to claim 9, further comprising: The second determining unit is configured to, in response to receiving a query request for the target table attribute, determine at least one table having the target table attribute using the graph database, including: Determine the class node corresponding to the target table attribute in the graph database; Determine at least one second edge connected to the class node; and Determine at least one table corresponding to at least one instance node connected to the at least one second edge.
11. The apparatus according to claim 10, wherein, The first determining unit includes: The first determining subunit is configured to determine the target table attribute from among the multiple table attributes based on the historical query frequency of multiple table attributes involved in the multiple tables.
12. The apparatus according to claim 9, wherein, The multiple tables belong to multiple levels in the multi-level database, and each of the multiple tables has at least one table attribute that includes the level to which the corresponding table belongs. The first determining unit includes: The second determining subunit is configured to determine at least one of the plurality of levels as the target table attribute.
13. The apparatus according to claim 12, wherein, The relationships between the multiple tables include the upstream and downstream relationships between the first table and the second table, where the data in the downstream second table depends on the data in the upstream first table.
14. The apparatus of claim 13, further comprising: The third determining unit is configured to, in response to determining that a target table among the plurality of tables has been updated, determine at least one downstream table of the target table using the graph database, including: In the graph database, determine at least one first edge indicating the upstream-downstream relationship and where the target table is located upstream; and Determine the at least one downstream table corresponding to the at least one instance node connected to the at least one first edge; and The processing unit is configured to process the at least one downstream table based on an update to the target table.
15. The apparatus according to any one of claims 9-14, wherein, Each of the plurality of tables has at least one table attribute including the table header of the corresponding table.
16. The apparatus according to any one of claims 9-14, wherein, The generation unit includes: The first construction subunit is configured to construct a plurality of first triples based on the relationships between the plurality of tables, each of the plurality of first triples including two tables that have a relationship among the plurality of tables, and including the relationship between the two tables; The second construction subunit is configured to construct at least one second triplet based on the target table attribute and the at least one table, each of the at least one second triplet including the target table attribute and one table from the at least one table, and including the dependency relationship between the table and the target table attribute; and The generation subunit is configured to generate the graph database based on the plurality of first triples and the at least one second triplet.
17. An electronic device comprising: At least one processor; as well as A memory that is communicatively connected to the at least one processor; in The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-8.
19. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the method of any one of claims 1-8.
Citation Information
Patent Citations
Knowledge graph construction method and system of power system
CN110727741A
Data processing method and device of graph database, electronic equipment and storage medium
CN113190718A