Nothing Special   »   [go: up one dir, main page]

CN112528067A - Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment - Google Patents

Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment Download PDF

Info

Publication number
CN112528067A
CN112528067A CN202011550938.2A CN202011550938A CN112528067A CN 112528067 A CN112528067 A CN 112528067A CN 202011550938 A CN202011550938 A CN 202011550938A CN 112528067 A CN112528067 A CN 112528067A
Authority
CN
China
Prior art keywords
attribute
metadata
graph database
items
field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011550938.2A
Other languages
Chinese (zh)
Inventor
王益飞
汪洋
王宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202011550938.2A priority Critical patent/CN112528067A/en
Publication of CN112528067A publication Critical patent/CN112528067A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a storage method, a reading method, a device, equipment and a storage medium of a graph database, relating to the technical field of data processing, in particular to the fields of knowledge maps and big data. The specific implementation scheme is as follows: obtaining metadata to be stored in a graph database, determining attribute fields and corresponding attribute value fields according to content types recorded by the metadata, performing character extraction on the metadata according to the attribute fields to obtain attribute items, performing character extraction on the metadata according to the attribute value fields to obtain attribute values, and storing the attribute items and the attribute values. The method comprises the steps of extracting characters of different types of metadata according to corresponding attribute fields and attribute value fields, obtaining corresponding attribute items and attribute values, and then storing the attribute items and the attribute values.

Description

Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment
Technical Field
The application discloses a storage method, a reading method, a device and equipment of a graph database, and relates to the technical field of data processing, in particular to the technical field of knowledge maps and big data.
Background
With the rapid development of the industries such as social contact, e-commerce, finance, retail, internet of things and the like, a huge and complex relationship network is organized in the real society, and the traditional database is difficult to process relationship operation. The relationship between data needing to be processed in the big data industry increases in a geometric progression along with the data volume, and a database and a graph database which support massive complex data relational operation are urgently needed.
In a distributed graph database, in addition to stored graph data, state information of the cluster itself, meta information of the database, and the like are contained. The prior art often directly stores meta information in a certain format in a distributed component such as zookeeper or etcd.
Disclosure of Invention
The application provides a storage method, a reading method, a device, equipment and a storage medium of a graph database.
An embodiment of a first aspect of the present application provides a method for storing a graph database, including:
acquiring metadata to be stored in a graph database;
determining an attribute field and a corresponding attribute value field according to the content type recorded by the metadata;
performing character extraction on the metadata according to the attribute field to obtain an attribute item, and performing character extraction on the metadata according to the attribute value field to obtain an attribute value;
and storing the attribute items and the attribute values.
As a first possible implementation manner of the embodiment of the present application, the storing the attribute items and the attribute values includes:
determining a corresponding target storage space according to the content type;
storing the attribute items and the attribute values as key-value pairs within the target storage space.
As a second possible implementation manner of the embodiment of the present application, the storing, in the target storage space, the attribute item and the attribute value as a key-value pair includes:
and calling a distributed storage component according to the target storage space so as to store the attribute items and the attribute values in the target storage space in a key value pair mode.
As a third possible implementation manner of the embodiment of the present application, the performing character extraction on the metadata according to the attribute field to obtain an attribute item includes:
querying characters matched with the attribute fields in the metadata as attribute item elements;
and generating the attribute item according to the attribute item element.
As a fourth possible implementation manner of the embodiment of the present application, the generating the attribute item according to the attribute item element includes:
and combining the attribute item element with the setting element associated with the attribute field to obtain the attribute item.
As a fifth possible implementation manner of the embodiment of the present application, the performing character extraction on the metadata according to the attribute value field to obtain an attribute value includes:
and querying characters matched with the attribute value field in the metadata to serve as the attribute value.
An embodiment of a second aspect of the present application provides a method for reading a graph database, including:
reading the stored attribute items and the corresponding attribute values;
inquiring attribute fields and corresponding attribute value fields according to the content types recorded by the attribute items and the corresponding attribute values;
and determining metadata in the graph database according to the characters matched with the attribute fields in the attribute items and the characters matched with the attribute value fields in the attribute values.
As a first possible implementation manner of the embodiment of the present application, the method further includes:
and determining the content type according to a target storage space for storing the attribute items and the corresponding attribute values.
An embodiment of a third aspect of the present application provides a storage apparatus for a graph database, including:
the acquisition module is used for acquiring metadata to be stored in a graph database;
the determining module is used for determining an attribute field and a corresponding attribute value field according to the content type recorded by the metadata;
the extraction module is used for carrying out character extraction on the metadata according to the attribute field to obtain an attribute item, and carrying out character extraction on the metadata according to the attribute value field to obtain an attribute value;
and the storage module is used for storing the attribute items and the attribute values.
An embodiment of a fourth aspect of the present application provides a reading apparatus for a graph database, including:
the reading module is used for reading the stored attribute items and the corresponding attribute values;
the query module is used for querying the attribute field and the corresponding attribute value field according to the content type recorded by the attribute item and the corresponding attribute value;
and the first determining module is used for determining metadata in the graph database according to the characters matched with the attribute fields in the attribute items and the characters matched with the attribute value fields in the attribute values.
An embodiment of a fifth aspect of the present application provides an electronic device, including:
at least one processor; and
a memory communicatively coupled 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 storing method of the first aspect embodiment or the reading method of the second aspect embodiment.
An embodiment of a sixth aspect of the present application provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the storage method of the embodiment of the first aspect or the reading method of the embodiment of the second aspect.
An embodiment of the seventh aspect of the present application provides a computer program product, which includes a computer program, and the computer program, when executed by a processor, implements the storage method described in the embodiment of the first aspect or the reading method described in the embodiment of the second aspect.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present application, nor do they limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a schematic flow chart illustrating a method for storing a graph database according to an embodiment of the present application;
FIG. 2 is a schematic flow chart diagram illustrating another method for storing a graph database according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for generating property items according to an embodiment of the present application;
FIG. 4 is a schematic flowchart of a method for reading a graph database according to an embodiment of the present application;
FIG. 5 is a schematic flow chart illustrating another method for reading a graph database according to an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating an exemplary storage device for a graph database according to the present application;
FIG. 7 is a schematic diagram of a reading apparatus for a graph database according to an embodiment of the present application;
FIG. 8 shows a schematic block diagram of an example electronic device 800 that may be used to implement embodiments of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
A storage method, a reading method, an apparatus, a device, a storage medium, and a program product of a graph database according to embodiments of the present application are described below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a method for storing a graph database according to an embodiment of the present application.
The embodiment of the present application exemplifies that the storage method of the graph database is configured in the storage device of the graph database, and the storage device of the graph database can be applied to any electronic equipment, so that the electronic equipment can execute the storage function of the graph database.
The electronic device may be a Personal Computer (PC), a cloud device, a mobile device, and the like, and the mobile device may be a hardware device having various operating systems, such as a mobile phone, a tablet Computer, a Personal digital assistant, a wearable device, and an in-vehicle device.
As shown in fig. 1, the method for storing a graph database may include the steps of:
step 101, obtaining metadata to be stored in a graph database.
The graph database does not refer to a database for storing pictures, but stores and queries data in a data structure of a graph.
Graph databases refer to the direct, natural and easy modeling of relationships that use graphs (or nets) to express the real world. For example, if a person likes to watch a movie, an edge can be established to connect the person and the movie, the edge is called a "like" edge, meanwhile, the person can have other edges, such as a "friend" edge, a "classmate" edge, and the like, and the movie can also have other edges, such as a "director" edge, and the like, so that a natural relationship network is constructed.
Metadata, also called intermediate data and relay data, is data describing data, mainly information describing data attributes, and is used to support functions such as indicating storage locations, history data, resource search, file recording, and the like.
In the embodiment of the application, when data in the graph database is stored, metadata to be stored in the graph database can be acquired first to store the metadata.
Step 102, determining an attribute field and a corresponding attribute value field according to the content type recorded by the metadata.
It will be appreciated that the structure of the metadata to be stored in the graph database is not fixed, and that the structure of different types of metadata may not be the same. For example, the content types described by the metadata can be divided into: graph database meta information, cluster member information, and cluster data distribution information, among others.
The graph database meta information includes Schema information, Config information, Data _ count, and Data _ replenisher of the graph database. The Schema information is descriptive information about attribute definitions of different types of nodes and edges in the graph. Such as how many attributes each type contains, what name each attribute is, what data type each attribute is, etc. Config information is configuration description information about the database itself. Such as the memory version or the disk version. Data _ count refers to the number of partitions of the database in the cluster. Data _ replenisher refers to the number of copies of the database in the cluster.
The cluster member information refers to information of members in the cluster, such as ports, addresses, loads, and the like. Specifically, 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 may be included.
The cluster data distribution information refers to the distribution of cluster data on different devices, for example, a graph database includes several segments, several backups for each segment, at which node each backup is stored, and the like. For example, if a graph database a contains 5 shards with 3 copies per shard, then for each shard his replication team members will contain 3 nodes, each node storing a backup.
In the embodiment of the application, after metadata to be stored in a graph database is acquired, the content type recorded by the metadata is determined, and then the attribute field and the corresponding attribute value field are determined according to the content type recorded by the metadata.
And 103, performing character extraction on the metadata according to the attribute field to obtain an attribute item, and performing character extraction on the metadata according to the attribute value field to obtain an attribute value.
In the embodiment of the application, after the attribute field and the corresponding attribute value field are determined according to the content type recorded by 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.
As a possible implementation manner, a character extraction function may be adopted to perform character extraction on the metadata according to the attribute field to obtain an attribute item, and perform character extraction on the metadata according to the attribute value field to obtain an attribute value.
As another possible implementation, characters matching the attribute field may be queried in the metadata to obtain the attribute item. Characters matching the attribute value field can also be queried in the metadata, and the characters matching the attribute value field are taken as the attribute value. Thus, the accuracy of attribute item and attribute value acquisition is improved.
And 104, storing the attribute items and the attribute values.
In the embodiment of the application, different types of metadata are divided into different storage spaces, and the different storage spaces are independent from each other. After the corresponding storage space is determined according to the content type recorded by the metadata, and after the character extraction is performed on the metadata 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.
According to the method for storing the graph database, after metadata to be stored in the graph database is obtained, the attribute field and the corresponding attribute value field are determined according to the content type recorded by the metadata, character extraction is performed on the metadata according to the attribute field to obtain the attribute item, character extraction is performed on the metadata according to the attribute value field to obtain the attribute value, and the attribute item and the attribute value are stored. The method comprises the steps of extracting characters of different types of metadata according to corresponding attribute fields and attribute value fields, obtaining corresponding attribute items and attribute values, and then storing the attribute items and the attribute values.
When the metadata to be stored in the graph database is actually stored, different types of metadata correspond to different storage spaces, so that the corresponding storage spaces can be determined according to the content types of the metadata, and the attribute items and the attribute values can be stored in the storage spaces. Referring to fig. 2 for details, fig. 2 is a schematic flowchart of another method for storing a graph database according to an embodiment of the present application.
As shown in fig. 2, the method for storing a graph database may include the steps of:
step 201, obtaining metadata to be stored in a graph database.
Step 202, determining an attribute field and a corresponding attribute value field according to the content type recorded by the metadata.
And 203, performing character extraction on the metadata according to the attribute field to obtain an attribute item, and performing character extraction on the metadata according to the attribute value field to obtain an attribute value.
It should be noted that, for the implementation process of step 201 to step 203, reference may be made to the implementation process of step 101 to step 103 in the foregoing embodiment, which is not described herein again.
And step 204, determining a corresponding target storage space according to the content type.
The target storage space is a storage space corresponding to the content type described in the metadata.
It is understood that metadata of different content types are divided into different storage spaces, and the different storage spaces are independent of each other. After the metadata to be stored in the graph database is obtained, the corresponding target storage space can be determined according to the content type recorded by the metadata.
As an example, assuming that metadata belongs to cluster member information, a corresponding target storage space may be determined as a, metadata belongs to cluster data separation information, and a corresponding target storage space may be determined as B.
Step 205, storing the attribute items and the attribute values as key value pairs in the target storage space.
In the embodiment of the application, after the attribute items and the attribute values of the metadata are determined, the attribute items and the attribute values can be stored in the target storage space in a Key-Value Key Value pair mode. Therefore, the corresponding attribute value can be quickly inquired through the attribute item.
As a possible implementation manner, after the corresponding target storage space is determined according to the content type to which the metadata belongs, the distributed storage component may be called according to the target storage space, so as to store the attribute items and the attribute values in the target storage space in a key value pair manner.
Distributed storage is a data storage technology, which uses disk space on each machine in an enterprise through a network, and forms a virtual storage device with these distributed storage resources, and data is stored in various corners of the enterprise in a distributed manner.
Since the general distributed storage components provide at least a storage function of key-value pairs or key-value-class pairs, the distributed storage components can be called to store attribute items and attribute values in the form of key-value pairs in the target storage space.
According to the method for storing the graph database, after metadata to be stored in the graph database is obtained, according to content types recorded by the metadata, attribute fields and corresponding attribute value fields are determined, character extraction is performed on the metadata according to the attribute fields to obtain attribute items, character extraction is performed on the metadata according to the attribute value fields to obtain attribute values, corresponding target storage spaces are determined according to the content types, and the attribute items and the attribute values are stored as key value pairs in the target storage spaces. Therefore, the attribute items and the attribute values corresponding to the metadata are stored in the corresponding target storage spaces in a key-value pair mode, so that different types of metadata are stored in the corresponding storage spaces, and the storage of the metadata of different content types is supported.
In the above embodiment, a technical solution of obtaining a corresponding attribute item by querying a character matched with an attribute field in metadata is mentioned, which is described in detail below with reference to fig. 3, where fig. 3 is a flowchart illustrating a method for generating an attribute item according to an embodiment of the present application.
As shown in fig. 3, the method may include the steps of:
step 301, querying characters matched with the attribute field in the metadata as attribute item elements.
In the embodiment of the present application, after the attribute field is determined according to the content type described in the metadata, a character matched with the attribute field may be queried in the metadata, and the queried character is used as an attribute item element.
Step 302, generating attribute items according to the attribute item elements.
In the embodiment of the application, after the character matched with the attribute field is inquired in the metadata, the character is combined with the setting element associated with the attribute field to obtain the attribute item. Therefore, the attribute item is obtained by combining the attribute item element and the setting element associated with the attribute field, and the generation efficiency and accuracy of the attribute item are improved.
In the embodiment of the application, characters matched with the attribute field are inquired in the metadata to serve as attribute item elements, so that the attribute items are generated according to the attribute item elements, and characters matched with the attribute value field are inquired in the metadata to serve as attribute values. Therefore, different types of metadata can be abstracted into attribute items and attribute values, and the metadata is stored on the bottom layer in the mode of the attribute items and the attribute values, so that different types of data storage are supported.
In the above embodiment, after the attribute items and the corresponding attribute values are extracted from the metadata to be stored in the graph database and stored, when the graph database storage metadata is read, the stored attribute items and the corresponding attribute values need to be read to determine the metadata in the graph database. The above process is described in detail with reference to fig. 4, and fig. 4 is a flowchart illustrating a method for reading a map database according to an embodiment of the present application.
As shown in fig. 4, the reading method of the map database may include the following steps:
step 401, reading the stored attribute items and the corresponding attribute values.
It is understood that the metadata in the graph database is stored in the form of attribute items and corresponding attribute values, and when reading the metadata in the graph data, the attribute items and corresponding attribute values stored in the storage space are preferably read.
Because the attribute items and the attribute values are stored in the form of key value pairs, after the attribute items are read, the corresponding attribute values can be read.
As a possible implementation manner, the attribute item may be obtained by performing character extraction on the metadata. For example, a character matching the attribute field is queried in the metadata as an attribute item element, and the attribute item element is combined with a setting element associated with the attribute field to obtain an attribute item.
The attribute value may be a character that matches the attribute value field that is queried in the metadata.
Step 402, according to the content type recorded by the attribute item and the corresponding attribute value, inquiring the attribute field and the corresponding attribute value field.
In the embodiment of the 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 obtained through query according to the content types recorded by the attribute items and the corresponding attribute values.
It is understood that, when the content types described by the attribute items and the corresponding attribute values are different, the attribute items and the corresponding attribute values correspond to different attribute fields and attribute value fields. Therefore, the attribute field and the corresponding attribute value field can be inquired and obtained based on the content type described by the attribute item and the corresponding attribute value.
Step 403, determining metadata in the graph database according to the characters matched with the attribute fields in the attribute items and according to the characters matched with the attribute value fields in the attribute values.
Since the attribute items are obtained by extracting characters from the metadata according to the attribute fields, and the attribute values are obtained by extracting characters from the metadata according to the attribute value fields, the metadata in the graph database can be determined according to the characters matched with the attribute fields in the attribute items and the characters matched with the attribute value fields in the attribute values.
According to the reading method of the graph database, after the stored attribute items and the corresponding attribute values are read, the attribute fields and the corresponding attribute value fields are inquired according to the content types recorded by the attribute items and the corresponding attribute values, and the metadata in the graph database is determined according to the characters matched with the attribute value fields in the attribute items and the characters matched with the attribute value fields in the attribute values. Therefore, corresponding metadata can be read according to the attribute items and the corresponding attribute values stored in the graph database.
Since the metadata of different content types are stored in different data storage spaces, in the application, the content type can be determined according to the target storage space for storing the attribute items and the corresponding attribute values, so that the attribute fields and the corresponding attribute value fields can be obtained according to content type query. Referring to fig. 5, fig. 5 is a schematic flowchart of another method for reading a map database according to an embodiment of the present application.
As shown in fig. 5, the method for reading a graph database may include the steps of:
step 501, reading the stored attribute items and the corresponding attribute values.
In the embodiment of the present application, the implementation process of step 501 may refer to the implementation process of step 401 in the foregoing embodiment, and is not described herein again.
Step 502, determining the content type according to the target storage space storing the attribute items and the corresponding attribute values.
Since metadata of different content types are stored in different data storage spaces, after the stored attribute items and corresponding attribute values are read from the map database, the content types can be determined according to the target storage space in which the attribute items and corresponding attribute values are stored.
As an example, when the metadata belongs to the cluster member information, the corresponding target storage space is a, the metadata belongs to the cluster data separation information, and the corresponding target storage space is B. When the target storage space for storing the attribute items and the corresponding attribute values is determined to be B, the content type of the metadata may be determined to be the cluster data separation information.
Step 503, querying the attribute field and the corresponding attribute value field according to the content type described by the attribute item and the corresponding attribute value.
Step 504, determining 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.
In the embodiment of the present application, the implementation processes of step 503 and step 504 may refer to the implementation processes of step 402 and step 403 in the foregoing embodiment, and are not described herein again.
In order to implement the above embodiments, the present application proposes a storage device of a graph database.
FIG. 6 is a schematic structural diagram of a storage device for a graph database according to an embodiment of the present application.
As shown in fig. 6, 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.
The obtaining module 610 is configured to obtain metadata to be stored in a graph database.
The determining module 620 is configured to determine the attribute field and the corresponding attribute value field according to the content type described in the metadata.
The extracting module 630 is configured to perform character extraction on the metadata according to the attribute field to obtain an attribute item, and perform character extraction on the metadata according to the attribute value field to obtain an attribute value.
And the storage module 640 is used for storing the attribute items and the attribute values.
As a possible scenario, the storage module 640 may further include:
the determining unit is used for determining a corresponding target storage space according to the content type;
and the storage unit is used for storing the attribute items and the attribute values as key value pairs in the target storage space.
As another possible scenario, the storage unit may be further configured to: and calling the distributed storage component according to the target storage space so as to store the attribute items and the attribute values in the target storage space in a key value pair mode.
As another possible case, the extracting module 630 may include:
the query unit is used for querying characters matched with the attribute fields in the metadata as attribute item elements;
and the generating unit is used for generating the attribute item according to the attribute item element.
As another possible case, the generating unit may be further configured to: and combining the attribute item element with the setting element associated with the attribute field to obtain the attribute item.
As another possible scenario, the extracting module 630 may further be configured to:
and querying characters matched with the attribute value field in the metadata as the attribute value.
It should be noted that the foregoing explanation of the embodiment of the method for storing a graph database is also applicable to the storage device of the graph database, and is not repeated herein.
According to the storage device of the graph database, after metadata to be stored in the graph database is obtained, attribute fields and corresponding attribute value fields are determined according to content types recorded by the metadata, character extraction is performed on the metadata according to the attribute fields to obtain attribute items, character extraction is performed on the metadata according to the attribute value fields to obtain attribute values, and the attribute items and the attribute values are stored. The method comprises the steps of extracting characters of different types of metadata according to corresponding attribute fields and attribute value fields, obtaining corresponding attribute items and attribute values, and then storing the attribute items and the attribute values.
In order to implement the above embodiments, the present application proposes a reading device of a graph database.
FIG. 7 is a schematic structural diagram of an apparatus for reading a graph database according to an embodiment of the present application.
As shown in fig. 7, the reading apparatus 700 of the graph database may include: a reading module 710, a querying module 720, and a first determining module 730.
The reading module 710 is configured to read the stored attribute items and the corresponding attribute values;
and the query module 720 is configured 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 determining module 730, configured to determine metadata in the graph database according to the characters in the attribute items that match the attribute fields and according to the characters in the attribute values that match the attribute value fields.
As a possible case, the reading apparatus 700 of the graph database may further include:
and the second determining module is used for determining the content type according to the target storage space for storing the attribute items and the corresponding attribute values.
It should be noted that the explanation of the embodiment of the method for reading a graph database is also applicable to the reading device of the graph database, and is not repeated herein.
According to the reading device of the graph database, after the stored attribute items and the corresponding attribute values are read, the attribute fields and the corresponding attribute value fields are inquired according to the content types recorded by the attribute items and the corresponding attribute values, and the metadata in the graph database is determined according to the characters matched with the attribute value fields in the attribute items and the characters matched with the attribute value fields in the attribute values. Therefore, corresponding metadata can be read according to the attribute items and the corresponding attribute values stored in the graph database.
In order to achieve the above embodiments, the present application proposes an electronic device including:
at least one processor; and
a memory communicatively coupled 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 storing method of the above embodiments or the reading method of the above embodiments.
In order to achieve the above embodiments, the present application proposes a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the storage method described in the above embodiments or the reading method described in the above embodiments.
In order to implement the above embodiments, the present application proposes a computer program product comprising a computer program which, when executed by a processor, implements the storing method described in the above embodiments, or the reading method described in the above embodiments.
There is also provided, in accordance with an embodiment of the present application, an electronic device, a readable storage medium, and a computer program product.
FIG. 8 shows a schematic block diagram of an example electronic device 800 that may be used to implement embodiments of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may 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 meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 8, the device 800 includes a computing unit 801 that can perform various appropriate actions and processes in accordance with a computer program stored in a ROM (Read-Only Memory) 802 or a computer program loaded from a storage unit 808 into a RAM (Random Access Memory) 803. In the RAM803, various programs and data required for the operation of the device 800 can also be stored. The calculation unit 801, the ROM 802, and the RAM803 are connected to each other by a bus 804. An I/O (Input/Output) interface 805 is also connected to the bus 804.
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, or the like; an output unit 807 such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, optical disk, or the like; and a communication unit 809 such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Computing unit 801 may be a variety of general 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 CPU (Central Processing Unit), a GPU (graphics Processing Unit), various dedicated AI (Artificial Intelligence) computing chips, various computing Units running machine learning model algorithms, a DSP (Digital Signal Processor), and any suitable Processor, controller, microcontroller, and the like. The calculation unit 801 executes the respective methods and processes described above, such as a storage method of a map database, or a reading method of a map database. For example, in some embodiments, the storage method of a graph database, or the reading method of a graph database, may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and/or installed onto device 800 via ROM 802 and/or communications unit 809. When the computer program is loaded into the RAM803 and executed by the computing unit 801, one or more steps of the above-described method of storing a map database, or method of reading a map database, may be executed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the storing method of the graph database, or the reading method of the graph database, in any other suitable way (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be realized in digital electronic circuitry, Integrated circuitry, FPGAs (Field Programmable Gate arrays), ASICs (Application-Specific Integrated circuits), ASSPs (Application Specific Standard products), SOCs (System On Chip, System On a Chip), CPLDs (Complex Programmable Logic devices), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present application may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this application, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The 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, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or flash Memory, an optical fiber, a CD-ROM (Compact Disc Read-Only-Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here 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 a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a 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 may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can 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), internet, and blockchain Network.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS").
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (19)

1. A method of storing a graph database, comprising:
acquiring metadata to be stored in a graph database;
determining an attribute field and a corresponding attribute value field according to the content type recorded by the metadata;
performing character extraction on the metadata according to the attribute field to obtain an attribute item, and performing character extraction on the metadata according to the attribute value field to obtain an attribute value;
and storing the attribute items and the attribute values.
2. The storage method of claim 1, wherein the storing the attribute items and the attribute values comprises:
determining a corresponding target storage space according to the content type;
storing the attribute items and the attribute values as key-value pairs within the target storage space.
3. The storage method of claim 2, wherein said storing, within the target storage space, the attribute items and the attribute values as key-value pairs comprises:
and calling a distributed storage component according to the target storage space so as to store the attribute items and the attribute values in the target storage space in a key value pair mode.
4. The storage method according to any one of claims 1 to 3, wherein the extracting the characters of the metadata according to the attribute field to obtain an attribute item comprises:
querying characters matched with the attribute fields in the metadata as attribute item elements;
and generating the attribute item according to the attribute item element.
5. The storage method of claim 4, wherein said generating the attribute item according to the attribute item element comprises:
and combining the attribute item element with the setting element associated with the attribute field to obtain the attribute item.
6. The storage method according to any one of claims 1 to 3, wherein the character extracting the metadata according to the attribute value field to obtain an attribute value comprises:
and querying characters matched with the attribute value field in the metadata to serve as the attribute value.
7. A method of reading a graph database, comprising:
reading the stored attribute items and the corresponding attribute values;
inquiring attribute fields and corresponding attribute value fields according to the content types recorded by the attribute items and the corresponding attribute values;
and determining metadata in the graph database according to the characters matched with the attribute fields in the attribute items and the characters matched with the attribute value fields in the attribute values.
8. The reading method according to claim 7, wherein the method further comprises:
and determining the content type according to a target storage space for storing the attribute items and the corresponding attribute values.
9. A storage device for a graph database, comprising:
the acquisition module is used for acquiring metadata to be stored in a graph database;
the determining module is used for determining an attribute field and a corresponding attribute value field according to the content type recorded by the metadata;
the extraction module is used for carrying out character extraction on the metadata according to the attribute field to obtain an attribute item, and carrying out character extraction on the metadata according to the attribute value field to obtain an attribute value;
and the storage module is used for storing the attribute items and the attribute values.
10. The storage device of claim 9, wherein the storage module comprises:
the determining unit is used for determining a corresponding target storage space according to the content type;
and the storage unit is used for storing the attribute items and the attribute values as key value pairs in the target storage space.
11. The storage device of claim 10, wherein the storage unit is further configured to:
and calling a distributed storage component according to the target storage space so as to store the attribute items and the attribute values in the target storage space in a key value pair mode.
12. The storage device of any of claims 9-11, wherein the extraction module comprises:
the query unit is used for querying characters matched with the attribute fields in the metadata to serve as attribute item elements;
and the generating unit is used for generating the attribute item according to the attribute item element.
13. The storage device of claim 12, wherein the generating unit is further configured to:
and combining the attribute item element with the setting element associated with the attribute field to obtain the attribute item.
14. The storage device of any of claims 9-11, wherein the extraction module is further configured to:
and querying characters matched with the attribute value field in the metadata to serve as the attribute value.
15. A reading apparatus of a graph database, comprising:
the reading module is used for reading the stored attribute items and the corresponding attribute values;
the query module is used for querying the attribute field and the corresponding attribute value field according to the content type recorded by the attribute item and the corresponding attribute value;
and the first determining module is used for determining metadata in the graph database according to the characters matched with the attribute fields in the attribute items and the characters matched with the attribute value fields in the attribute values.
16. The reading apparatus of claim 15, wherein the apparatus further comprises:
and the second determining module is used for determining the content type according to the target storage space for storing the attribute items and the corresponding attribute values.
17. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled 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 storing method of any one of claims 1-6 or the reading method of claim 7 or 8.
18. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the storage method of any one of claims 1 to 6, or the reading method of claim 7 or 8.
19. A computer program product comprising a computer program which, when executed by a processor, implements the storage method of any one of claims 1-6 or the reading method of claim 7 or 8.
CN202011550938.2A 2020-12-24 2020-12-24 Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment Pending CN112528067A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011550938.2A CN112528067A (en) 2020-12-24 2020-12-24 Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011550938.2A CN112528067A (en) 2020-12-24 2020-12-24 Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment

Publications (1)

Publication Number Publication Date
CN112528067A true CN112528067A (en) 2021-03-19

Family

ID=74976214

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011550938.2A Pending CN112528067A (en) 2020-12-24 2020-12-24 Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment

Country Status (1)

Country Link
CN (1) CN112528067A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377775A (en) * 2021-06-21 2021-09-10 特赞(上海)信息科技有限公司 Information processing method and device
CN113468833A (en) * 2021-06-11 2021-10-01 山东英信计算机技术有限公司 Method, device, equipment and medium for marking component attributes in schematic diagram
CN115203488A (en) * 2022-09-15 2022-10-18 国网智能电网研究院有限公司 Graph database management method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106484832A (en) * 2016-09-30 2017-03-08 福州瑞芯微电子股份有限公司 Assume the method and system of project set
CN106951430A (en) * 2016-12-28 2017-07-14 金蝶软件(中国)有限公司 Account table querying method and device
CN110442571A (en) * 2019-06-28 2019-11-12 卓尔智联(武汉)研究院有限公司 A kind of data processing method, device and computer storage medium
CN111104418A (en) * 2019-12-23 2020-05-05 北京百度网讯科技有限公司 Text description processing method and device and electronic equipment
CN112015806A (en) * 2019-05-30 2020-12-01 中国移动通信集团浙江有限公司 Method and device for storing data by block chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106484832A (en) * 2016-09-30 2017-03-08 福州瑞芯微电子股份有限公司 Assume the method and system of project set
CN106951430A (en) * 2016-12-28 2017-07-14 金蝶软件(中国)有限公司 Account table querying method and device
CN112015806A (en) * 2019-05-30 2020-12-01 中国移动通信集团浙江有限公司 Method and device for storing data by block chain
CN110442571A (en) * 2019-06-28 2019-11-12 卓尔智联(武汉)研究院有限公司 A kind of data processing method, device and computer storage medium
CN111104418A (en) * 2019-12-23 2020-05-05 北京百度网讯科技有限公司 Text description processing method and device and electronic equipment

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113468833A (en) * 2021-06-11 2021-10-01 山东英信计算机技术有限公司 Method, device, equipment and medium for marking component attributes in schematic diagram
CN113468833B (en) * 2021-06-11 2024-02-09 山东英信计算机技术有限公司 Method, device, equipment and medium for marking attribute of component in schematic diagram
CN113377775A (en) * 2021-06-21 2021-09-10 特赞(上海)信息科技有限公司 Information processing method and device
CN113377775B (en) * 2021-06-21 2024-02-02 特赞(上海)信息科技有限公司 Information processing method and device
CN115203488A (en) * 2022-09-15 2022-10-18 国网智能电网研究院有限公司 Graph database management method and device and electronic equipment
CN115203488B (en) * 2022-09-15 2022-12-06 国网智能电网研究院有限公司 Graph database management method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN110543586B (en) Multi-user identity fusion method, device, equipment and storage medium
CN112269789B (en) Method and device for storing data, and method and device for reading data
CN112528067A (en) Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment
CN111046237B (en) User behavior data processing method and device, electronic equipment and readable medium
CN111512303A (en) Hierarchical graphics data structure
CN115145587A (en) Product parameter checking method and device, electronic equipment and storage medium
CN114064925A (en) Knowledge graph construction method, data query method, device, equipment and medium
CN116955856A (en) Information display method, device, electronic equipment and storage medium
CN116597443A (en) Material tag processing method and device, electronic equipment and medium
CN112887426B (en) Information stream pushing method and device, electronic equipment and storage medium
CN116028517A (en) Fusion database system and electronic equipment
CN115905322A (en) Service processing method and device, electronic equipment and storage medium
CN115408547A (en) Dictionary tree construction method, device, equipment and storage medium
CN114969444A (en) Data processing method and device, electronic equipment and storage medium
CN114817223A (en) Service data extraction method and device, electronic equipment and storage medium
CN114897666A (en) Graph data storage, access, processing method, training method, device and medium
CN113377402A (en) Multi-version concurrent storage method and device
CN113434508B (en) Method and apparatus for storing information
CN113515504B (en) Data management method, device, electronic equipment and storage medium
CN114579573B (en) Information retrieval method, information retrieval device, electronic equipment and storage medium
CN118503224A (en) Object data storage processing method and device, electronic equipment and storage medium
CN118132550A (en) Structured large field data query method and device and electronic equipment
CN116303258A (en) Method and device for constructing hash index of distributed storage system
CN117520368A (en) Query statement determination method, device, equipment, medium and product
CN115033823A (en) Method, apparatus, device, medium and product for processing data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination