Storage method, reading method, device and equipment of graph database
By extracting and storing the attribute items and attribute values of metadata in the graph database, key-value pairs are formed, the performance bottlenecks of traditional databases when processing complex data relationships are solved, efficient metadata storage and query are realized, and massive data is improved Processing capability.
Patent Information
- Application Number
- CN202011550938.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-24
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2040-12-24
AI Technical Summary
The prior art is difficult to effectively handle massive complex data relationship operations. Traditional databases show performance bottlenecks when processing complex relationships, especially in distributed environments, the storage and management efficiency of meta information is low.
By obtaining metadata in the graph database, determining attribute fields and attribute value fields, performing character extraction to generate attribute items and attribute values, and storing them as key-value pairs, supporting flexible storage of different types of metadata in the target storage space , uses distributed storage components for storage and query.
It improves the storage and query efficiency of graph database metadata, supports different types of storage components to meet cost, performance and availability requirements, and improves the processing capability of complex data relationship operations.
Smart Images

Figure CN112528067B_ABST
Abstract
Description
Technical Field
[0001] The present application discloses a storage method, a reading method, a device and equipment for a graph database, which relates to the field of data processing technology, and specifically to the field of knowledge graphs and big data technology. Background Art
[0002] With the rapid development of social networking, e-commerce, finance, retail, the Internet of Things and other industries, the real world has woven a huge and complex network of relationships, and traditional databases are difficult to handle relational operations. The relationship between the data that the big data industry needs to process grows exponentially with the amount of data, and there is an urgent need for a database that supports massive and complex data relational operations. Graph databases came into being.
[0003] In a distributed graph database, in addition to the stored graph data, it also contains the status information of the cluster itself, the metadata of the database, etc. The existing technology often directly stores the metadata in a certain format in distributed components such as zookeeper or etcd. Summary of the invention
[0004] The present application provides a storage method, a reading method, an apparatus, a device and a storage medium for a graph database.
[0005] The first aspect of the present application provides a method for storing a graph database, including:
[0006] Get the metadata to be stored in the graph database;
[0007] Determine an attribute field and a corresponding attribute value field according to the content type recorded in the metadata;
[0008] Extracting characters from the metadata according to the attribute field to obtain an attribute item, and extracting characters from the metadata according to the attribute value field to obtain an attribute value;
[0009] The attribute items and the attribute values are stored.
[0010] As a first possible implementation manner of the embodiment of the present application, storing the attribute item and the attribute value includes:
[0011] Determining a corresponding target storage space according to the content type;
[0012] In the target storage space, the attribute item and the attribute value are stored as a key-value pair.
[0013] As a second possible implementation manner of the embodiment of the present application, storing the attribute item and the attribute value as a key-value pair in the target storage space includes:
[0014] According to the target storage space, a distributed storage component is called to store the attribute item and the attribute value in the target storage space in the form of a key-value pair.
[0015] As a third possible implementation manner of the embodiment of the present application, extracting characters from the metadata according to the attribute field to obtain attribute items includes:
[0016] Searching the metadata for characters matching the attribute field as attribute item elements;
[0017] The attribute item is generated according to the attribute item element.
[0018] As a fourth possible implementation manner of the embodiment of the present application, generating the attribute item according to the attribute item element includes:
[0019] The attribute item element is combined with the setting element associated with the attribute field to obtain the attribute item.
[0020] As a fifth possible implementation manner of the embodiment of the present application, extracting characters from the metadata according to the attribute value field to obtain the attribute value includes:
[0021] The metadata is searched for characters matching the attribute value field as the attribute value.
[0022] The second aspect of the present application provides a method for reading a graph database, including:
[0023] Read the stored attribute items and corresponding attribute values;
[0024] According to the content type recorded by the attribute item and the corresponding attribute value, query the attribute field and the corresponding attribute value field;
[0025] The metadata in the graph database is determined based on the characters in the attribute item that match the attribute field, and based on the characters in the attribute value that match the attribute value field.
[0026] As a first possible implementation manner of the embodiment of the present application, the method further includes:
[0027] The content type is determined according to a target storage space storing the attribute items and corresponding attribute values.
[0028] The third aspect of the present application provides a storage device for a graph database, including:
[0029] The acquisition module is used to obtain the metadata to be stored in the graph database;
[0030] A determination module, used to determine an attribute field and a corresponding attribute value field according to the content type recorded in the metadata;
[0031] An extraction module, used for extracting characters from the metadata according to the attribute field to obtain attribute items, and extracting characters from the metadata according to the attribute value field to obtain attribute values;
[0032] A storage module is used to store the attribute items and the attribute values.
[0033] The fourth aspect of the present application provides a device for reading a graph database, including:
[0034] A reading module is used to read the stored attribute items and corresponding attribute values;
[0035] A query module, used to query the attribute field and the corresponding attribute value field according to the content type recorded by the attribute item and the corresponding attribute value;
[0036] The first determination module is used to determine the metadata in the graph database according to the characters in the attribute item that match the attribute field and according to the characters in the attribute value that match the attribute value field.
[0037] A fifth aspect of the present application provides an electronic device, including:
[0038] at least one processor; and
[0039] a memory communicatively connected to the at least one processor; wherein,
[0040] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the storage method described in the first aspect embodiment, or the reading method described in the second aspect embodiment.
[0041] The sixth aspect embodiment of the present application proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the storage method described in the first aspect embodiment, or the reading method described in the second aspect embodiment.
[0042] The seventh aspect embodiment of the present application proposes a computer program product, including a computer program, which, when executed by a processor, implements the storage method described in the first aspect embodiment, or the reading method described in the second aspect embodiment.
[0043] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0045] Figure 1 A schematic diagram of a flow chart of a method for storing a graph database provided in an embodiment of the present application;
[0046] Figure 2 A schematic diagram of a flow chart of another method for storing a graph database provided in an embodiment of the present application;
[0047] Figure 3 A flowchart of a method for generating attribute items provided in an embodiment of the present application;
[0048] Figure 4 A schematic diagram of a flow chart of a method for reading a graph database provided in an embodiment of the present application;
[0049] Figure 5 A schematic diagram of a flow chart of another method for reading a graph database provided in an embodiment of the present application;
[0050] Figure 6 A schematic diagram of the structure of a storage device for a graph database provided in an embodiment of the present application;
[0051] Figure 7 A schematic diagram of the structure of a graph database reading device provided in an embodiment of the present application;
[0052] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present application is shown. DETAILED DESCRIPTION
[0053] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0054] The following describes the storage method, reading method, device, equipment, storage medium and program product of the graph database of the embodiments of the present application with reference to the accompanying drawings.
[0055] Figure 1A flowchart of a method for storing a graph database provided in an embodiment of the present application.
[0056] The embodiment of the present application takes the storage method of the graph database being configured in the storage device of the graph database as an example. The storage device of the graph database can be applied to any electronic device so that the electronic device can perform the storage function of the graph database.
[0057] Among them, the electronic device may be a personal computer (PC), a cloud device, a mobile device, etc. The mobile device may be, for example, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a car device, and other hardware devices with various operating systems.
[0058] like Figure 1 As shown, the storage method of the graph database may include the following steps:
[0059] Step 101, obtain metadata to be stored in the graph database.
[0060] Among them, the graph database does not refer to a database that stores images, but a database that stores and queries data in a graph data structure.
[0061] Graph databases use graphs (or networks) to express real-world relationships in a direct, natural, and easy-to-model way. For example, if someone likes a certain movie, you can create an edge connecting this person and the movie. This edge is called the "like" edge. At the same time, this person can also have other edges, such as the "friend" edge, the "classmate" edge, etc. Similarly, this movie can also have other edges, such as the "director" edge, the "starring" edge, etc., thus building a natural network of relationships.
[0062] Metadata, also known as intermediary data or relay data, is data that describes data. It is mainly information that describes the attributes of data and is used to support functions such as indicating storage location, historical data, resource search, and file records.
[0063] In an embodiment of the present application, when storing data in a graph database, metadata to be stored in the graph database may be first acquired to store the metadata.
[0064] Step 102: Determine the attribute field and the corresponding attribute value field according to the content type recorded in the metadata.
[0065] It is understandable that the structure of metadata to be stored in a graph database is not fixed, and the structures of different types of metadata may be different. For example, the content types recorded in metadata can be divided into: graph database metadata, cluster member information, cluster data distribution information, etc.
[0066] The graph database meta information includes the graph database's Schema information, Config information, Data_coun, and Data_replicator. Schema information is descriptive information about the attribute definitions of different types of nodes and edges in the graph. For example, how many attributes each type contains, what is the name of each attribute, what data type each attribute is, etc. Config information is configuration description information about the database itself. For example, whether it is a memory version or a disk version, etc. Data_count refers to the number of shards of the database in the cluster. Data_replicator refers to the number of copies of the database in the cluster.
[0067] Cluster member information refers to the information of members in the cluster, such as port, address, load, etc. Specifically, it can include the current CPU (Central Processing Unit / Processor) load of the node, the current memory usage of the node, the IP (IP Address) address of the node on the network, and the service port of the node on the network.
[0068] Cluster data distribution information refers to the distribution of cluster data on different devices, such as how many shards the graph database contains, how many backups each shard has, on which node each backup is stored, etc. For example, a graph database A contains 5 shards, each shard has 3 replicas, then for each shard, its replication group members will contain 3 nodes, and each node will store a backup.
[0069] In an embodiment of the present application, after the metadata to be stored in the graph database is acquired, the content type recorded in the metadata is determined, and then, based on the content type recorded in the metadata, the attribute field and the corresponding attribute value field are determined.
[0070] Step 103: extract characters from the metadata according to the attribute field to obtain attribute items, and extract characters from the metadata according to the attribute value field to obtain attribute values.
[0071] In an embodiment of the present application, after determining the attribute field and the corresponding attribute value field according to the content type recorded in the metadata, the metadata can be subjected to character extraction according to the attribute field to obtain the attribute item, and the metadata can be subjected to character extraction according to the attribute value field to obtain the attribute value.
[0072] As a possible implementation manner, a character extraction function may be used to extract characters from metadata according to an attribute field to obtain an attribute item, and a character extraction function may be used to extract characters from metadata according to an attribute value field to obtain an attribute value.
[0073] As another possible implementation, the metadata may be queried for characters matching the attribute field to obtain the attribute item. The metadata may also be queried for characters matching the attribute value field, and the characters matching the attribute value field are used as the attribute value. Thus, the accuracy of obtaining the attribute item and the attribute value is improved.
[0074] Step 104: store the attribute items and attribute values.
[0075] In the embodiment of the present application, different types of metadata are divided into different storage spaces, and the different storage spaces are independent of each other. After determining the corresponding storage space according to the content type recorded in the metadata, and after extracting the metadata characters according to the attribute field and the attribute value field to obtain the attribute item and the corresponding attribute value, the attribute item and the attribute value can be stored in the storage space.
[0076] The storage method of the graph database of the embodiment of the present application, after obtaining the metadata to be stored in the graph database, determines the attribute field and the corresponding attribute value field according to the content type recorded in the metadata, extracts characters from the metadata according to the attribute field to obtain the attribute item, extracts characters from the metadata according to the attribute value field to obtain the attribute value, and stores the attribute item and the attribute value. This method extracts characters from different types of metadata according to the corresponding attribute field and attribute value field, obtains the corresponding attribute item and attribute value, and then stores them. This storage method supports different types of storage components, and can flexibly select the underlying storage in different application scenarios to meet different cost, performance, and availability requirements.
[0077] When storing metadata to be stored in a graph database, different types of metadata correspond to different storage spaces. Therefore, the corresponding storage space can be determined according to the content type of the metadata to store the attribute items and attribute values in the storage space. Figure 2 Provide detailed introduction, Figure 2 A flowchart of another graph database storage method provided in an embodiment of the present application.
[0078] like Figure 2 As shown, the storage method of the graph database may include the following steps:
[0079] Step 201, obtain metadata to be stored in the graph database.
[0080] Step 202: Determine the attribute field and the corresponding attribute value field according to the content type recorded in the metadata.
[0081] Step 203: extract characters from the metadata according to the attribute field to obtain attribute items, and extract characters from the metadata according to the attribute value field to obtain attribute values.
[0082] It should be noted that the implementation process of the above steps 201 to 203 can refer to the implementation process of steps 101 to 103 in the above embodiment, which will not be repeated here.
[0083] Step 204: Determine the corresponding target storage space according to the content type.
[0084] The target storage space refers to the storage space corresponding to the content type recorded in the metadata.
[0085] It is understandable that metadata of different content types are divided into different storage spaces, and different storage spaces are independent of each other. After obtaining the metadata to be stored in the graph database, the corresponding target storage space can be determined according to the content type recorded in the metadata.
[0086] As an example, assuming that the metadata belongs to cluster member information, it can be determined that the corresponding target storage space is A, and the metadata belongs to cluster data separation information, it can be determined that the corresponding target storage space is B.
[0087] Step 205: Store the attribute item and the attribute value as a key-value pair in the target storage space.
[0088] In the embodiment of the present application, after determining the attribute items and attribute values of the metadata, the attribute items and attribute values can be stored in the target storage space in the form of Key-Value pairs, so that the corresponding attribute values can be quickly queried through the attribute items.
[0089] As a possible implementation method, after determining the corresponding target storage space according to the content type to which the metadata belongs, the distributed storage component can be called according to the target storage space to store the attribute items and attribute values in the target storage space in the form of key-value pairs.
[0090] Among them, distributed storage is a data storage technology that uses the disk space on each machine in the enterprise through the network, and these scattered storage resources form a virtual storage device, and the data is stored in various corners of the enterprise.
[0091] Since common distributed storage components at least provide a key-value pair or a key-value pair-like storage function, the distributed storage component can be called to store the attribute items and attribute values in the target storage space in the form of key-value pairs.
[0092] The storage method of the graph database of the embodiment of the present application, after acquiring the metadata to be stored in the graph database, determines the attribute field and the corresponding attribute value field according to the content type recorded in the metadata, extracts the metadata characters according to the attribute field to obtain the attribute item, extracts the metadata characters according to the attribute value field to obtain the attribute value, determines the corresponding target storage space according to the content type, and stores the attribute item and the attribute value as a key-value pair in the target storage space. Thus, the attribute item and the attribute value corresponding to the metadata are stored in the corresponding target storage space in the form of key-value pairs, thereby realizing the storage of different types of metadata in the corresponding storage space to support the storage of metadata of different content types.
[0093] In the above embodiment, it has been mentioned that the technical solution of obtaining the corresponding attribute item by searching the metadata for characters matching the attribute field is as follows. Figure 3 Provide detailed introduction, Figure 3 A flowchart of a method for generating attribute items provided in an embodiment of the present application.
[0094] like Figure 3 As shown, the method may include the following steps:
[0095] Step 301: Search metadata for characters that match the attribute field as attribute item elements.
[0096] In the embodiment of the present application, after determining the attribute field according to the content type recorded in the metadata, the metadata may be searched for characters matching the attribute field, and the searched characters may be used as attribute item elements.
[0097] Step 302: Generate attribute items according to attribute item elements.
[0098] In the embodiment of the present application, after the character matching the attribute field is queried in the metadata, the character is combined with the setting element associated with the attribute field to obtain the attribute item. Thus, the attribute item is obtained by combining the attribute item element with the setting element associated with the attribute field, thereby improving the generation efficiency and accuracy of the attribute item.
[0099] In the embodiment of the present application, characters matching the attribute field are queried in the metadata as attribute item elements, and attribute items are generated according to the attribute item elements. Characters matching the attribute value field are queried in the metadata as attribute values. Thus, different types of metadata can be abstracted into attribute items and attribute values, and metadata can be stored at the bottom layer in the form of attribute items and attribute values, thereby supporting different types of data storage.
[0100] In the above embodiment, after extracting the attribute items and the corresponding attribute values from the metadata to be stored in the graph database and storing them, when reading the metadata stored in the graph database, it is necessary to read the stored attribute items and the corresponding attribute values to determine the metadata in the graph database. Figure 4 The above process is introduced in detail. Figure 4 A flowchart of a method for reading a graph database provided in an embodiment of the present application.
[0101] like Figure 4 As shown, the method for reading the graph database may include the following steps:
[0102] Step 401, read the stored attribute items and corresponding attribute values.
[0103] It is understandable that the metadata in the graph database is stored in the form of attribute items and corresponding attribute values. When reading the metadata in the graph data, the attribute items and corresponding attribute values stored in the storage space are read first.
[0104] Since the attribute items and attribute values are stored in the form of key-value pairs, after reading the attribute items, the corresponding attribute values can be read.
[0105] As a possible implementation, the attribute item can be obtained by extracting characters from the metadata. For example, characters matching the attribute field are searched in the metadata as attribute item elements, and the attribute item elements are combined with setting elements associated with the attribute field to obtain the attribute item.
[0106] The attribute value can be a character that matches the attribute value field found in the metadata.
[0107] Step 402: query the attribute field and the corresponding attribute value field according to the content type recorded by the attribute item and the corresponding attribute value.
[0108] In the embodiment of the present application, after the attribute items and the corresponding attribute values stored in the storage space are read, the attribute fields and the corresponding attribute value fields can be queried according to the content types recorded in the attribute items and the corresponding attribute values.
[0109] It is understandable that when the content types recorded by the attribute items and the corresponding attribute values are different, they correspond to different attribute fields and attribute value fields. Therefore, the attribute fields and the corresponding attribute value fields can be queried based on the content types recorded by the attribute items and the corresponding attribute values.
[0110] Step 403, determining metadata in the graph database based on characters in the attribute item that match the attribute field, and based on characters in the attribute value that match the attribute value field.
[0111] Since the attribute items are obtained by extracting characters from the metadata based on the attribute fields, and the attribute values are obtained by extracting characters from the metadata based on the attribute value fields, the metadata in the graph database can be determined based on the characters in the attribute items that match the attribute fields, and based on the characters in the attribute values that match the attribute value fields.
[0112] The reading method of the graph database of the embodiment of the present application, after reading the stored attribute items and the corresponding attribute values, queries the attribute fields and the corresponding attribute value fields according to the content types recorded in the attribute items and the corresponding attribute values, and determines the metadata in the graph database according to the characters in the attribute items that match the attribute value fields, and according to the characters in the attribute values that match the attribute value fields. Thus, the corresponding metadata can be read according to the attribute items and the corresponding attribute values stored in the graph database.
[0113] Since metadata of different content types are stored in different data storage spaces, in this application, the content type can be determined based on the target storage space storing the attribute items and the corresponding attribute values, so as to obtain the attribute fields and the corresponding attribute value fields based on the content type query. Figure 5 Provide detailed introduction, Figure 5 A flowchart of another method for reading a graph database provided in an embodiment of the present application.
[0114] like Figure 5 As shown, the method for reading the graph database may include the following steps:
[0115] Step 501, read the stored attribute items and corresponding attribute values.
[0116] In the embodiment of the present application, the implementation process of step 501 can refer to the implementation process of step 401 in the above embodiment, which will not be repeated here.
[0117] Step 502: Determine the content type according to the target storage space storing the attribute items and the corresponding attribute values.
[0118] Since metadata of different content types are stored in different data storage spaces, after reading the stored attribute items and corresponding attribute values in the graph database, the content type can be determined according to the target storage space where the attribute items and corresponding attribute values are stored.
[0119] As an example, assuming that the metadata belongs to cluster member information, the corresponding target storage space is A, and the metadata belongs to cluster data separation information, the corresponding target storage space is B. When the target storage space for storing attribute items and corresponding attribute values is determined to be B, the content type of the metadata can be determined to be cluster data separation information.
[0120] Step 503: query the attribute field and the corresponding attribute value field according to the content type recorded by the attribute item and the corresponding attribute value.
[0121] Step 504, determining metadata in the graph database based on characters in the attribute item that match the attribute value field, and based on characters in the attribute value that match the attribute value field.
[0122] In the embodiment of the present application, the implementation process of step 503 and step 504 can refer to the implementation process of step 402 and step 403 in the above embodiment, which will not be repeated here.
[0123] In order to implement the above embodiments, the present application proposes a storage device for a graph database.
[0124] Figure 6 A schematic diagram of the structure of a storage device for a graph database provided in an embodiment of the present application.
[0125] like Figure 6 As shown, the storage device 600 of the graph database may include: an acquisition module 610, a determination module 620, an extraction module 630 and a storage module 640.
[0126] Among them, the acquisition module 610 is used to obtain metadata to be stored in the graph database.
[0127] The determination module 620 is used to determine the attribute field and the corresponding attribute value field according to the content type recorded in the metadata.
[0128] The extraction module 630 is used to extract characters from the metadata according to the attribute field to obtain attribute items, and to extract characters from the metadata according to the attribute value field to obtain attribute values.
[0129] The storage module 640 is used to store attribute items and attribute values.
[0130] As a possible scenario, the storage module 640 may further include:
[0131] A determination unit, configured to determine a corresponding target storage space according to the content type;
[0132] The storage unit is used to store the attribute item and the attribute value as a key-value pair in the target storage space.
[0133] As another possible situation, the storage unit may also be used to: call the distributed storage component according to the target storage space to store the attribute items and attribute values in the target storage space in the form of key-value pairs.
[0134] As another possible case, the extraction module 630 may include:
[0135] A query unit, used to query the metadata for characters matching the attribute field as an attribute item element;
[0136] The generating unit is used to generate the attribute item according to the attribute item element.
[0137] As another possible situation, the generating unit may also be used to: combine the attribute item element with the setting element associated with the attribute field to obtain the attribute item.
[0138] As another possible situation, the extraction module 630 may also be used to:
[0139] Search the metadata for characters that match the attribute value field and use them as the attribute value.
[0140] It should be noted that the above explanation of the embodiment of the storage method of the graph database is also applicable to the storage device of the graph database, and will not be repeated here.
[0141] The storage device of the graph database of the embodiment of the present application, after obtaining the metadata to be stored in the graph database, determines the attribute field and the corresponding attribute value field according to the content type recorded in the metadata, extracts characters from the metadata according to the attribute field to obtain attribute items, extracts characters from the metadata according to the attribute value field to obtain attribute values, and stores the attribute items and attribute values. This method extracts characters from different types of metadata according to the corresponding attribute fields and attribute value fields, obtains the corresponding attribute items and attribute values, and stores them. This storage method supports different types of storage components, and can flexibly select underlying storage in different application scenarios to meet different cost, performance, and availability requirements.
[0142] In order to implement the above embodiment, the present application proposes a reading device for a graph database.
[0143] Figure 7 A schematic diagram of the structure of a graph database reading device provided in an embodiment of the present application.
[0144] like Figure 7 As shown, the graph database reading device 700 may include: a reading module 710, a query module 720 and a first determination module 730.
[0145] The reading module 710 is used to read the stored attribute items and corresponding attribute values;
[0146] The query module 720 is used to query the attribute field and the corresponding attribute value field according to the content type recorded by the attribute item and the corresponding attribute value.
[0147] The first determination module 730 is used to determine metadata in the graph database according to characters in the attribute item that match the attribute field and characters in the attribute value that match the attribute value field.
[0148] As a possible situation, the graph database reading device 700 may further include:
[0149] The second determination module is used to determine the content type according to the target storage space storing the attribute items and the corresponding attribute values.
[0150] It should be noted that the above explanation of the embodiment of the method for reading a graph database is also applicable to the device for reading the graph database, and will not be repeated here.
[0151] The reading device of the graph database of the embodiment of the present application, after reading the stored attribute items and the corresponding attribute values, queries the attribute field and the corresponding attribute value field according to the content type recorded in the attribute items and the corresponding attribute values, and determines the metadata in the graph database according to the characters in the attribute items that match the attribute value fields, and according to the characters in the attribute values that match the attribute value fields. Thus, the corresponding metadata can be read according to the attribute items and the corresponding attribute values stored in the graph database.
[0152] In order to implement the above embodiment, the present application proposes an electronic device, including:
[0153] at least one processor; and
[0154] a memory communicatively connected to the at least one processor; wherein,
[0155] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the storage method described in the above embodiment, or the reading method described in the above embodiment.
[0156] In order to implement the above embodiments, the present application proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the storage method described in the above embodiments, or the reading method described in the above embodiments.
[0157] In order to implement the above embodiments, the present application proposes a computer program product, including a computer program, which implements the storage method described in the above embodiments when executed by a processor, or the reading method described in the above embodiments.
[0158] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.
[0159] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, 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 processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0160] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 802 or a computer program loaded from a storage unit 808 to a RAM (Random Access Memory) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An I / O (Input / Output) interface 805 is also connected to the bus 804.
[0161] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0162] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units that run machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as a storage method of a graph database, or a reading method of a graph database. For example, in some embodiments, a storage method of a graph database, or a reading method of a graph database may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the 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 graph database storage method or the graph database reading method described above may be executed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the graph database storage method or the graph database reading method in any other appropriate manner (e.g., by means of firmware).
[0163] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0164] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0165] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0166] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 acoustic input, voice input, or tactile input).
[0167] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0168] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short).
[0169] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0170] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A storage method for a graph database, comprising: Get the metadata to be stored in the graph database; Determine an attribute field and a corresponding attribute value field according to the content type recorded in the metadata; Extracting characters from the metadata according to the attribute field to obtain an attribute item, and extracting characters from the metadata according to the attribute value field to obtain an attribute value, wherein characters matching the attribute value field are searched in the metadata as the attribute value; Storing the attribute items and the attribute values; The storing of the attribute items and the attribute values includes: Determine a corresponding target storage space according to the content type, wherein the target storage space refers to a storage space corresponding to the content type recorded in the metadata, metadata of different content types are divided into different storage spaces, and different storage spaces are independent of each other; In the target storage space, storing the attribute item and the attribute value as a key-value pair; The step of extracting characters from the metadata according to the attribute field to obtain attribute items includes: Searching the metadata for characters matching the attribute field as attribute item elements; The attribute item is generated according to the attribute item element.
2. The storage method according to claim 1, wherein: The step of storing the attribute item and the attribute value as a key-value pair in the target storage space includes: According to the target storage space, a distributed storage component is called to store the attribute item and the attribute value in the target storage space in the form of a key-value pair.
3. The storage method according to claim 1, wherein: Generating the attribute item according to the attribute item element includes: The attribute item element is combined with the setting element associated with the attribute field to obtain the attribute item.
4. A method for reading a graph database, comprising: Read the stored attribute items and corresponding attribute values; According to the content type recorded by the attribute item and the corresponding attribute value, query the attribute field and the corresponding attribute value field; Determining metadata in the graph database according to characters in the attribute item that match the attribute field, and according to characters in the attribute value that match the attribute value field; The content type is determined based on a target storage space that stores the attribute items and corresponding attribute values, wherein the target storage space refers to a storage space corresponding to the content type recorded in the metadata, and metadata of different content types are divided into different storage spaces, and different storage spaces are independent of each other.
5. A storage device for a graph database, comprising: The acquisition module is used to obtain the metadata to be stored in the graph database; A determination module, used to determine an attribute field and a corresponding attribute value field according to the content type recorded in the metadata; An extraction module, configured to extract characters from the metadata according to the attribute field to obtain attribute items, and to extract characters from the metadata according to the attribute value field to obtain attribute values, wherein characters matching the attribute value field are searched in the metadata as the attribute values; A storage module, used for storing the attribute items and the attribute values; Wherein, the storage module includes: a determination unit, configured to determine a corresponding target storage space according to the content type, wherein the target storage space refers to a storage space corresponding to the content type recorded in the metadata, metadata of different content types are divided into different storage spaces, and different storage spaces are independent of each other; A storage unit, used for storing the attribute item and the attribute value as a key-value pair in the target storage space; Wherein, the extraction module includes: A query unit, used to query the metadata for characters matching the attribute field as attribute item elements; A generating unit, configured to generate the attribute item according to the attribute item element; Wherein, the extraction module is also used for: The metadata is searched for characters matching the attribute value field as the attribute value.
6. The storage device according to claim 5, wherein: The storage unit is further used for: According to the target storage space, a distributed storage component is called to store the attribute item and the attribute value in the target storage space in the form of a key-value pair.
7. The storage device according to claim 5, wherein: The generating unit is further used for: The attribute item element is combined with the setting element associated with the attribute field to obtain the attribute item.
8. A device for reading a graph database, comprising: A reading module is used to read the stored attribute items and corresponding attribute values; A query module, used to query the attribute field and the corresponding attribute value field according to the content type recorded by the attribute item and the corresponding attribute value; A first determination module, configured to determine metadata in the graph database according to characters in the attribute item that match the attribute field, and characters in the attribute value that match the attribute value field; Wherein, the device further comprises: The second determination module is used to determine the content type according to the target storage space storing the attribute items and the corresponding attribute values, wherein the target storage space refers to the storage space corresponding to the content type recorded in the metadata, and the metadata of different content types are divided into different storage spaces, and the different storage spaces are independent of each other.
9. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the storage method described in any one of claims 1 to 3, or the reading method described in claim 4.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the storage method according to any one of claims 1 to 3, or the reading method according to claim 4.
11. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the storage method according to any one of claims 1 to 3, or the reading method according to claim 4.
Citation Information
Patent Citations
Method and system for presenting item set
CN106484832A
Account query method and apparatus
CN106951430A
Data processing method and device and computer storage medium
CN110442571A
Text description processing method and device and electronic equipment
CN111104418A
Determinant text storage method and device and electronic equipment
CN111259107A