CN111523001A - Method, device, equipment and storage medium for storing data - Google Patents

Method, device, equipment and storage medium for storing data Download PDF

Info

Publication number
CN111523001A
CN111523001A CN202010325586.4A CN202010325586A CN111523001A CN 111523001 A CN111523001 A CN 111523001A CN 202010325586 A CN202010325586 A CN 202010325586A CN 111523001 A CN111523001 A CN 111523001A
Authority
CN
China
Prior art keywords
identification information
target
entity
type
fragment
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.)
Granted
Application number
CN202010325586.4A
Other languages
Chinese (zh)
Other versions
CN111523001B (en
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 CN202010325586.4A priority Critical patent/CN111523001B/en
Publication of CN111523001A publication Critical patent/CN111523001A/en
Application granted granted Critical
Publication of CN111523001B publication Critical patent/CN111523001B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing

Abstract

The embodiment of the application discloses a method, a device, equipment and a storage medium for storing data, and relates to the field of knowledge graphs. The specific implementation scheme is as follows: acquiring identification information of a target fragment storing a target entity; determining sequence identification information of a target entity according to a self-increment sequence mode; determining type identification information of the target entity according to the entity type of the target entity and a first preset corresponding relation between the type and the type identification information; generating internal identification information of the target entity according to the identification information, the sequence identification information and the type identification information of the target fragment; and storing the internal identification information into the target fragment. The method can generate unique internal identification information for each entity, and can quickly locate the segment where the entity is located according to rich information contained in the internal identification information, thereby improving the query efficiency of the graph database.

Description

Method, device, equipment and storage medium for storing data
Technical Field
Embodiments of the present application relate to the field of computer technologies, and further to the field of knowledge maps, and in particular, to a method, an apparatus, a device, and a storage medium for storing data.
Background
A graph database is a database that uses graph structures for semantic queries, typically to represent and store data using nodes and relationship information corresponding to the nodes.
When the data volume reaches a certain magnitude, the data storage performance and the data query performance are affected, and when the data volume increases to exceed the storage capacity of a single graph database, the graph database can be expanded to ensure the integrity of the data.
Disclosure of Invention
Embodiments of the present application propose a method, an apparatus, a device and a storage medium for storing data.
In a first aspect, an embodiment of the present application provides a method for storing data, the method including: acquiring identification information of a target fragment storing a target entity; determining sequence identification information of a target entity according to a self-increment sequence mode; determining type identification information of the target entity according to the entity type of the target entity and a first preset corresponding relation between the type and the type identification information; generating internal identification information of the target entity according to the identification information, the sequence identification information and the type identification information of the target fragment; and storing the internal identification information into the target fragment.
In a second aspect, an embodiment of the present application provides an apparatus for storing data, the apparatus including: a first obtaining unit configured to obtain identification information of a target fragment storing a target entity; a first determining unit configured to determine order identification information of a target entity in a self-increasing sequence manner; the second determining unit is configured to determine the type identification information of the target entity according to the entity type of the target entity and the first preset corresponding relation between the type and the type identification information; the generating unit is configured to generate internal identification information of the target entity according to the identification information, the sequence identification information and the type identification information of the target fragment; and the first storage unit is configured to store the internal identification information into the target fragment.
In a third aspect, an embodiment 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 method as described in any one of the implementations of the first aspect.
In a fourth aspect, embodiments of the present application provide a non-transitory computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method as described in any one of the implementations of the first aspect.
According to the technology of the application, the problem of how to generate unique internal identification information for each entity is solved/the fragment where the entity is located is quickly positioned according to rich information contained in the internal identification information, and the query efficiency of the graph database is improved.
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
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for storing data according to the present application;
FIG. 3 is a schematic diagram of an application scenario of a method for storing data according to the present application;
FIG. 4 is a flow diagram of yet another embodiment of a method for storing data according to the present application;
FIG. 5 is a schematic block diagram illustrating one embodiment of an apparatus for storing data according to the present application;
FIG. 6 is a schematic block diagram of an electronic device suitable for use in implementing 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.
Fig. 1 shows an exemplary architecture 100 to which the method for storing data or the apparatus for storing data of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 101, 102, 103 interact with a server 105 via a network 104 to receive or send messages or the like. Various communication client applications, such as information query software, database software, natural language processing software, search application, instant messaging tool, social platform application, browser application, etc., may be installed on the terminal devices 101, 102, 103.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices with display screens, including but not limited to smart phones, tablet computers, notebook computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server that provides support for the information query class application installed by the terminal apparatuses 101, 102, 103. The server 105 may automatically process the internal identification information to be queried of the entity to be queried, which is input by the terminal devices 101, 102, 103, and determine the entity to be queried.
It should be noted that the method for storing data provided in the embodiments of the present application may be executed by the terminal devices 101, 102, and 103, or may be executed by the server 105. Accordingly, the means for storing data may be provided in the terminal devices 101, 102, 103, or in the server 105. This is not limited in this application.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for storing data in accordance with the present application is shown. The graph database of the present embodiment may include a plurality of database shards (hereinafter referred to as shards). The method for storing data comprises the following steps:
step 201, obtaining the identification information of the target fragment storing the target entity.
In this embodiment, an executing subject (for example, the terminal device 101, 102, 103 or the server 105 shown in fig. 1) of the method for storing data may randomly allocate a target segment to a target entity, and determine identification information of the target segment storing the target entity. For example, if there are five segments in the graph database, the numerical identifiers 0, 1,2,3, and 4 may be used as the identification information of the five segments, respectively. Here, the target entity may be an external entity that needs to be stored to the graph database. The execution subject may obtain the target entity from the information query class application.
In some optional implementation manners of this implementation, the step 201 may be specifically implemented by the following steps: determining a target fragment for storing a target entity according to a preset corresponding relation, wherein the corresponding relation comprises the corresponding relation between attribute information of the entity and the fragment; and determining the identification information of the target fragment.
In this optional implementation manner, the execution subject may determine, according to the correspondence between the attribute information of the entity and the fragment, a target fragment storing the target entity and an identifier of the target fragment. For example, the execution subject may preset a correspondence relationship between the age attribute included in the entity attribute information and the slice. Specifically, entities with age groups of 0-10 may correspond to shard 0, and entities with age groups of 11-20 may correspond to shard 1. The execution subject may determine the target segment storing the target entity according to the age value in the attribute information of the target entity. Alternatively, the execution subject may preset a correspondence between a company market value included in the entity attribute information and the segment. Specifically, entities with a company market value range of 0-500 ten thousand may correspond to segment 0, and entities with a company market value range of 501-1000 ten thousand may correspond to segment 1. The execution main body can determine the target fragment for storing the target entity according to the company market value in the attribute information of the target entity. When the target entity is queried, the implementation mode can determine the entity attribute of the target entity according to the preset corresponding relation and the identification of the target fragment, and stores the entities in the same attribute range in the same fragment, so that the query efficiency is improved.
In some optional implementation manners of this implementation, the step 201 may be specifically implemented by the following steps: acquiring original identification information of a target entity; determining target fragments for storing the target entities based on the original identification information and the number of fragments included in the graph database; and determining the identification information of the target fragment.
In this optional implementation manner, the execution subject may first obtain original identification information of the target entity. And then determining the target fragments for storing the target entities and the identifiers of the target fragments according to the original identification information and the number of the fragments in the graph database. For example, the original identification information of the target entity may be a user identification, specifically, the user identification may be 1002, and then the user identification 1002 is divided by the number of the segments to obtain an integer quotient and a remainder. And taking the fragments with the identification information as the remainder as target fragments for storing the target entities. By the implementation mode, the entities can be uniformly distributed to the fragments for storage, and load balancing is realized.
Step 202, determining the sequence identification information of the target entity according to the mode of the self-increment sequence.
In this embodiment, the execution subject may determine the sequence identification information of the target entity in a self-increment sequence manner. The sequential identification information may be used to distinguish fixed-length unique identifications of the respective entities. Specifically, the execution body may sequentially assign sequential identification information to each entity in a self-increment sequence manner, with 0 or 1 as initial sequential identification information. The auto-increment sequence may be a set of monotonically increasing integers, such as 1,2,3, …, or 0,2,4, ….
Step 203, determining the type identification information of the target entity according to the entity type of the target entity and the first preset corresponding relation between the type and the type identification information.
In this embodiment, the execution main body first determines an entity type of the target entity, and then determines the type identifier information of the target entity according to a first preset corresponding relationship between a preset type and the type identifier information. For example, an entity of which entity type is a person may correspond to type identification information 1, and an entity of which entity type is a company may correspond to type identification information 2. The execution subject may determine type identification information of the target entity according to the entity type of the target entity.
And 204, generating internal identification information of the target entity according to the identification information, the sequence identification information and the type identification information of the target fragment.
In this embodiment, the execution main body may generate internal identification information of the target entity according to the identification information, the sequence identification information, and the type identification information of the target segment. Specifically, the internal identification information of the target entity may be formed from the front to the back in sequence as follows: 2 bytes represent identification information of the target fragment, 1 byte represents type identification information, and 5 bytes represent sequence identification information.
Step 205, storing the internal identification information into the target fragment.
In this embodiment, the executing entity may store the internal identification information generated in step 204 into the target fragment, and may maintain uniform and integrated identification information in the graph database, so as to facilitate subsequent query.
In some optional implementations of the present implementation, the method may further include the following steps not shown in fig. 2: determining a target coding mode according to the entity type of the target entity and a second preset corresponding relation between the type and the coding mode; encoding the attribute information of the target entity by using a target encoding mode; and storing the encoded attribute information into the target fragment.
In this alternative implementation, the execution subject may determine the entity type of the target entity first. And then, determining a target coding mode according to the entity type and a second preset corresponding relation between the type and the coding mode, coding the attribute information of the target entity by using the target coding mode, and storing the coded attribute information into the target fragment. Here, the encoding method may convert the attribute information in the natural language state into the attribute information in the machine language state, and store the converted attribute information. Specifically, the attribute information of different entity types includes different attribute categories. For example, the attribute information of the entity type person may include attribute values of attribute categories such as gender and age, and the attribute information of the entity type company may include attribute values of attribute categories such as company market value. The entity types are different, the attribute types included in the attribute information of the entity are different, and the coding modes corresponding to the attribute information are also different. And the execution main body correspondingly stores the target entity and the coded attribute information in the target fragment. By the implementation mode, the target coding mode can be determined according to the entity type of the target entity to code the attribute information of the target entity, and the coded attribute information is stored.
With continued reference to fig. 3, fig. 3 is a schematic illustration of an application scenario of a method for storing data according to the present application. In the application scenario of fig. 3, the execution subject may be a graph database server 301, the user operates in the information query class software installed in the terminal 302, and the graph database server 302 may store the target entities generated by the user during the operation. The graph database server 301 may first determine the identification information 303 of the target fragment storing the target entity, then determine the sequence identification information 304 of the target entity in a self-increment sequence manner, then determine the type identification information 305 of the target entity according to the entity type of the target entity and the first preset corresponding relationship between the type and the type identification information, and finally generate the internal identification information 306 of the target entity according to the identification information 303 of the target fragment, the sequence identification information 304, and the type identification information 305. The internal identification information 306 is stored in the target fragment.
According to the method provided by the embodiment of the disclosure, the sequence identification information of the target entity is determined by obtaining the identification information of the target fragment storing the target entity, the type identification information of the target entity is determined according to the entity type of the target entity and the first preset corresponding relation between the type and the type identification information, and finally the internal identification information of the target entity is generated according to the identification information, the sequence identification information and the type identification information of the target fragment.
With continued reference to FIG. 4, a flow 400 of yet another embodiment of a method for storing data in accordance with the present application is shown. The method for storing data comprises the following steps:
step 401, obtaining the identification information of the target fragment storing the target entity.
Step 402, determining the sequence identification information of the target entity according to the mode of the self-increment sequence.
Step 403, determining type identification information of the target entity according to the entity type of the target entity and the first preset corresponding relationship between the type and the type identification information.
Step 404, generating internal identification information of the target entity according to the identification information, the sequence identification information and the type identification information of the target fragment.
Step 405, storing the internal identification information into the target fragment.
The steps 401 to 405 are respectively consistent with the steps 201 to 205 in the foregoing embodiment, and the above description for the steps 201 to 205 is also applicable to the steps 401 to 405, which is not repeated herein.
Step 406, storing the internal identification information of the first entity associated with the target entity in the target fragment.
In this embodiment, the execution subject may store the internal identification information of the first entity associated with the entity in the target fragment. Here, the first entity may be an entity represented by a node in the graph database that is contiguous with the target entity. In an actual application scenario, a first entity associated with a target entity can be searched from the target fragments, and the first entity is determined from the fragment indicated by the identification information of the fragment included in the internal identification information of the first entity, so that the retrieval efficiency is improved.
Step 407, obtaining the internal identification information to be queried of the entity to be queried.
In this embodiment, the execution subject may obtain the internal identification information to be queried of the entity to be queried from the graph database.
And step 408, determining the identification information of the corresponding fragment to be queried according to the internal identification information to be queried.
In this embodiment, the execution main body may determine the identification information of the fragment to be queried according to the internal identification information to be queried and a preset composition structure of the internal identification information.
Step 409, determining an entity to be queried from the fragments indicated by the identification information of the fragment to be queried.
In this embodiment, the execution main body may determine the segment corresponding to the segment to be queried according to the identification information of the segment to be queried, and determine the entity to be queried according to the internal identification information to be queried of the target entity.
In some optional implementations of the present implementation, the method may further include the following steps not shown in fig. 4: determining a target decoding mode according to the entity type of the entity to be queried and a third preset corresponding relation between the type and the decoding mode; decoding the coded attribute information of the entity to be queried according to a target decoding mode; and outputting the decoded attribute information.
In this optional implementation manner, the execution main body may determine, according to the entity type of the entity to be queried or the type identification information included in the internal identification information of the entity to be queried, and a third preset corresponding relationship between the type and the decoding manner, the decoding manner corresponding to the entity type of the target entity. Here, the decoding method may convert the attribute information in the machine language state into the attribute information in the natural language state. The entity types are different, the attribute categories included in the attribute information of the entity are different, and the decoding modes corresponding to the attribute information are also different. The execution main body can output the entity to be inquired and the decoded attribute information.
The flowchart 400 of the apparatus for storing data in this embodiment adds an operation of storing the internal identification information of the first entity associated with the target entity into the target fragment, an operation of determining the entity to be queried, and an operation of decoding to obtain the attribute information of the entity to be queried. Therefore, the technical solution described in this embodiment can quickly determine the segment where the entity having the association relationship with the target entity is located according to the internal identification information of the entity having the association relationship with the target entity determined in the target segment. And the fragment and the decoding mode of the entity to be inquired can be determined according to the internal identification information to be inquired of the entity to be inquired, and the attribute information of the entity to be inquired and the entity to be inquired is output, so that the analysis efficiency of the attribute information is improved, and the retrieval efficiency is improved.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present application provides an embodiment of an apparatus for storing data, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 5, the apparatus 500 for storing data provided by the present embodiment includes a first obtaining unit 501, a first determining unit 502, a second determining unit 503, a generating unit 504, and a first storing unit 505. The first obtaining unit 501 is configured to obtain identification information of a target segment storing a target entity; a first determining unit 502 configured to determine order identification information of a target entity in a self-increasing sequence manner; a second determining unit 503, configured to determine type identification information of the target entity according to the entity type of the target entity and a first preset corresponding relationship between the type and the type identification information; a generating unit 504 configured to generate internal identification information of the target entity according to the identification information, the order identification information, and the type identification information of the target segment; a first storage unit 505 configured to store the internal identification information into the target fragment.
In the present embodiment, in the apparatus 500 for storing data: the detailed processing of the first obtaining unit 501, the first determining unit 502, the second determining unit 503, the generating unit 504, and the first storing unit 505 and the technical effects thereof can refer to the related descriptions of step 201, step 202, step 203, step 204, and step 205 in the corresponding embodiment of fig. 2, which are not repeated herein.
In some optional implementations of this embodiment, the first obtaining unit 501 is further configured to obtain the identification information of the target segment storing the target entity through the following modules: the first determining module is configured to determine a target fragment storing a target entity according to a preset corresponding relation, wherein the corresponding relation comprises a corresponding relation between attribute information of the entity and the fragment; and the second determination module is configured to determine the identification information of the target fragment.
In some optional implementations of this embodiment, the first obtaining unit 501 is further configured to obtain the identification information of the target segment storing the target entity through the following modules: an acquisition module configured to acquire original identification information of a target entity; a third determination module configured to determine a target segment storing the target entity based on the original identification information and the number of segments included in the graph database; and the fourth determination module is configured to determine the identification information of the target fragment.
In some optional implementations of this embodiment, the apparatus further includes: a third determining unit (not shown in the figure), configured to determine the target encoding manner according to the entity type of the target entity and a second preset corresponding relationship between the type and the encoding manner; an encoding unit (not shown in the figure) configured to encode the attribute information of the target entity by using a target encoding manner; and a second storage unit (not shown in the figure) configured to store the encoded attribute information into the target fragment.
In some optional implementations of this embodiment, the apparatus further includes: a third storage unit (not shown in the figure) configured to store the internal identification information of the first entity associated with the target entity into the target fragment.
In some optional implementations of this embodiment, the apparatus further includes: a second obtaining unit (not shown in the figure) configured to obtain internal identification information to be queried of the entity to be queried; the fourth determining unit is configured to determine the identification information of the corresponding fragment to be queried according to the internal identification information to be queried; and a fifth determining unit (not shown in the figure) configured to determine the entity to be queried from the segment indicated by the identification information of the segment to be queried.
In some optional implementations of this embodiment, the apparatus further includes: a sixth determining unit (not shown in the figure), configured to determine a target decoding manner according to the entity type of the entity to be queried and a third preset corresponding relationship between the type and the decoding manner; a decoding unit (not shown in the figure) configured to decode the encoded attribute information of the entity to be queried according to a target decoding manner; an output unit configured to output the decoded attribute information.
The apparatus provided by the above embodiment of the present application, acquires, by the first acquiring unit 501, the identification information of the target segment storing the target entity, then, according to the way of the self-increment sequence, the first determining unit 502 determines the sequence identification information of the target entity, the second determining unit 503 determines the type identification information of the target entity according to the entity type of the target entity and the first preset corresponding relation between the type and the type identification information, the generating unit 504 generates the internal identification information of the target entity according to the identification information, the sequence identification information and the type identification information of the target fragment, the first storing unit 505 stores the internal identification information into the target fragment, the device can generate unique internal identification information for each entity, and can quickly position the fragment where the entity is located according to rich information contained in the internal identification information, so that the query efficiency of the graph database is improved.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 6, is a block diagram of an electronic device for storing data according to an embodiment 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. 6, the electronic apparatus includes: one or more processors 601, memory 602, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 6, one processor 601 is taken as an example.
The memory 602 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the methods for storing data provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method for storing data provided herein.
The memory 602, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the method for storing data in the embodiment of the present application (for example, the first acquisition unit 501, the first determination unit 502, the second determination unit 503, the generation unit 504, and the first storage unit 505 shown in fig. 5). The processor 601 executes various functional applications of the server and data processing by executing non-transitory software programs, instructions, and modules stored in the memory 602, that is, implements the method for storing data in the above method embodiment.
The memory 602 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of an electronic device for storing data, and the like. Further, the memory 602 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 602 optionally includes memory located remotely from the processor 601, which may be connected to an electronic device for storing data via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the method for storing data may further include: an input device 603 and an output device 604. The processor 601, the memory 602, the input device 603 and the output device 604 may be connected by a bus or other means, and fig. 6 illustrates the connection by a bus as an example.
The input device 603 may receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic apparatus for storing data, such as an input device like a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointer, one or more mouse buttons, a track ball, a joystick, etc. The output devices 604 may include a display device, auxiliary lighting devices (e.g., LEDs), and tactile feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), 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.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
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: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
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.
According to the technical scheme of the embodiment of the application, the unique internal identification information can be generated for each entity, the fragment where the entity is located can be quickly positioned according to rich information contained in the internal identification information, and the query efficiency of the graph database is improved.
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 application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application 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 (16)

1. A method for storing data, comprising:
acquiring identification information of a target fragment storing a target entity;
determining the sequence identification information of the target entity according to a self-increment sequence mode;
determining type identification information of the target entity according to the entity type of the target entity and a first preset corresponding relation between the type and the type identification information;
generating internal identification information of the target entity according to the identification information of the target fragment, the sequence identification information and the type identification information;
storing the internal identification information into the target fragment.
2. The method of claim 1, wherein the obtaining identification information of a target segment storing a target entity comprises:
determining a target fragment for storing the target entity according to a preset corresponding relation, wherein the corresponding relation comprises the corresponding relation between attribute information of the entity and the fragment;
and determining the identification information of the target fragment.
3. The method of claim 1, wherein the obtaining identification information of a target segment storing a target entity comprises:
acquiring original identification information of the target entity;
determining target fragments for storing the target entities based on the original identification information and the number of fragments included in a graph database;
and determining the identification information of the target fragment.
4. The method of claim 1, wherein the method further comprises:
determining a target coding mode according to the entity type of the target entity and a second preset corresponding relation between the type and the coding mode;
encoding the attribute information of the target entity by using the target encoding mode;
and storing the encoded attribute information into the target fragment.
5. The method of claim 1, wherein the method further comprises:
storing internal identification information of a first entity associated with the target entity into the target fragment.
6. The method of claim 5, wherein the method further comprises:
obtaining internal identification information to be queried of an entity to be queried;
determining the identification information of the corresponding fragment to be queried according to the internal identification information to be queried;
and determining the entity to be queried from the fragment indicated by the identification information of the fragment to be queried.
7. The method of claim 6, wherein the method further comprises:
determining a target decoding mode according to the entity type of the entity to be queried and a third preset corresponding relation between the type and the decoding mode;
decoding the coded attribute information of the entity to be queried according to the target decoding mode;
and outputting the decoded attribute information.
8. An apparatus for storing data, comprising:
a first obtaining unit configured to obtain identification information of a target fragment storing a target entity;
a first determining unit configured to determine order identification information of the target entity in a self-increasing sequence manner;
a second determining unit configured to determine type identification information of the target entity according to an entity type of the target entity and a first preset corresponding relationship between the type and the type identification information;
a generating unit configured to generate internal identification information of the target entity according to the identification information of the target fragment, the sequence identification information and the type identification information;
a first storage unit configured to store the internal identification information into the target tile.
9. The apparatus according to claim 8, wherein the first obtaining unit is further configured to obtain the identification information of the target segment storing the target entity by:
the first determining module is configured to determine a target fragment storing the target entity according to a preset corresponding relation, wherein the corresponding relation comprises a corresponding relation between attribute information of the entity and the fragment;
a second determining module configured to determine identification information of the target segment.
10. The apparatus according to claim 8, wherein the first obtaining unit is further configured to obtain the identification information of the target segment storing the target entity by:
an obtaining module configured to obtain original identification information of the target entity;
a third determination module configured to determine a target segment storing the target entity based on the original identification information and the number of segments included in a graph database;
a fourth determining module configured to determine the identification information of the target segment.
11. The apparatus of claim 8, wherein the apparatus further comprises:
the third determining unit is configured to determine a target coding mode according to the entity type of the target entity and a second preset corresponding relation between the type and the coding mode;
an encoding unit configured to encode the attribute information of the target entity using the target encoding manner;
a second storage unit configured to store the encoded attribute information into the target slice.
12. The apparatus of claim 8, wherein the apparatus further comprises:
a third storage unit configured to store internal identification information of the first entity associated with the target entity into the target fragment.
13. The apparatus of claim 12, wherein the apparatus further comprises:
the second acquisition unit is configured to acquire the internal identification information to be inquired of the entity to be inquired;
the fourth determining unit is configured to determine the identification information of the corresponding fragment to be queried according to the internal identification information to be queried;
a fifth determining unit, configured to determine the entity to be queried from the segment indicated by the identification information of the segment to be queried.
14. The apparatus of claim 13, wherein the apparatus further comprises:
a sixth determining unit, configured to determine a target decoding manner according to the entity type of the entity to be queried and a third preset corresponding relationship between the type and the decoding manner;
the decoding unit is configured to decode the encoded attribute information of the entity to be queried according to the target decoding mode;
an output unit configured to output the decoded attribute information.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-7.
CN202010325586.4A 2020-04-23 2020-04-23 Method, device, equipment and storage medium for storing data Active CN111523001B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010325586.4A CN111523001B (en) 2020-04-23 2020-04-23 Method, device, equipment and storage medium for storing data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010325586.4A CN111523001B (en) 2020-04-23 2020-04-23 Method, device, equipment and storage medium for storing data

Publications (2)

Publication Number Publication Date
CN111523001A true CN111523001A (en) 2020-08-11
CN111523001B CN111523001B (en) 2023-03-14

Family

ID=71904385

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010325586.4A Active CN111523001B (en) 2020-04-23 2020-04-23 Method, device, equipment and storage medium for storing data

Country Status (1)

Country Link
CN (1) CN111523001B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559631A (en) * 2020-12-15 2021-03-26 北京百度网讯科技有限公司 Data processing method and device of distributed graph database and electronic equipment
CN113408945A (en) * 2021-07-15 2021-09-17 广西中烟工业有限责任公司 Method and device for detecting purity of flue-cured tobacco, electronic equipment and storage medium
CN113434508A (en) * 2021-06-30 2021-09-24 北京百度网讯科技有限公司 Method and apparatus for storing information
CN114005544A (en) * 2021-11-12 2022-02-01 广东省实验动物监测所 Data management method and system for human disease animal model resources
CN114238929A (en) * 2021-12-20 2022-03-25 深圳市德仪电子科技有限公司 MCU chip with built-in operational amplifier and application thereof in frequency conversion system
CN116383454A (en) * 2023-04-10 2023-07-04 星环信息科技(上海)股份有限公司 Data query method of graph database, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1321277A (en) * 1999-08-31 2001-11-07 清水勋 Database system
EP3035595A1 (en) * 2014-12-17 2016-06-22 Alcatel Lucent Routable distributed database for managing a plurality of entities of a telecommunication network
US20190005071A1 (en) * 2017-06-29 2019-01-03 Microsoft Technology Licensing, Llc Optimized record placement in graph database
WO2019067024A1 (en) * 2017-09-29 2019-04-04 Oracle International Corporation Handling semi-structured and unstructured data in a sharded database environment
CN110737663A (en) * 2019-10-15 2020-01-31 腾讯科技(深圳)有限公司 data storage method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1321277A (en) * 1999-08-31 2001-11-07 清水勋 Database system
EP3035595A1 (en) * 2014-12-17 2016-06-22 Alcatel Lucent Routable distributed database for managing a plurality of entities of a telecommunication network
US20190005071A1 (en) * 2017-06-29 2019-01-03 Microsoft Technology Licensing, Llc Optimized record placement in graph database
WO2019067024A1 (en) * 2017-09-29 2019-04-04 Oracle International Corporation Handling semi-structured and unstructured data in a sharded database environment
CN110737663A (en) * 2019-10-15 2020-01-31 腾讯科技(深圳)有限公司 data storage method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
成雨蓉: "大规模图数据查询处理关键技术研究", 《中国博士学位论文全文数据库(电子期刊)》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559631A (en) * 2020-12-15 2021-03-26 北京百度网讯科技有限公司 Data processing method and device of distributed graph database and electronic equipment
CN112559631B (en) * 2020-12-15 2023-09-26 北京百度网讯科技有限公司 Data processing method and device of distributed graph database and electronic equipment
CN113434508A (en) * 2021-06-30 2021-09-24 北京百度网讯科技有限公司 Method and apparatus for storing information
CN113434508B (en) * 2021-06-30 2023-09-22 北京百度网讯科技有限公司 Method and apparatus for storing information
CN113408945A (en) * 2021-07-15 2021-09-17 广西中烟工业有限责任公司 Method and device for detecting purity of flue-cured tobacco, electronic equipment and storage medium
CN113408945B (en) * 2021-07-15 2023-03-24 广西中烟工业有限责任公司 Method and device for detecting purity of flue-cured tobacco, electronic equipment and storage medium
CN114005544A (en) * 2021-11-12 2022-02-01 广东省实验动物监测所 Data management method and system for human disease animal model resources
CN114238929A (en) * 2021-12-20 2022-03-25 深圳市德仪电子科技有限公司 MCU chip with built-in operational amplifier and application thereof in frequency conversion system
CN114238929B (en) * 2021-12-20 2022-09-13 深圳市德仪电子科技有限公司 MCU chip with built-in operational amplifier and application thereof in frequency conversion system
CN116383454A (en) * 2023-04-10 2023-07-04 星环信息科技(上海)股份有限公司 Data query method of graph database, electronic equipment and storage medium
CN116383454B (en) * 2023-04-10 2024-01-30 星环信息科技(上海)股份有限公司 Data query method of graph database, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111523001B (en) 2023-03-14

Similar Documents

Publication Publication Date Title
CN111523001B (en) Method, device, equipment and storage medium for storing data
CN111522967B (en) Knowledge graph construction method, device, equipment and storage medium
CN112015775A (en) Label data processing method, device, equipment and storage medium
US20210133217A1 (en) Method and apparatus for importing data into graph database, electronic device and medium
CN111259107B (en) Determinant text storage method and device and electronic equipment
CN110619002A (en) Data processing method, device and storage medium
CN110706147A (en) Image processing environment determination method and device, electronic equipment and storage medium
CN111523007A (en) User interest information determination method, device, equipment and storage medium
CN112115313A (en) Regular expression generation method, regular expression data extraction method, regular expression generation device, regular expression data extraction device, regular expression equipment and regular expression data extraction medium
CN108959294B (en) Method and device for accessing search engine
CN111177479A (en) Method and device for acquiring feature vectors of nodes in relational network graph
CN107643906B (en) Data processing method and device
CN112069137A (en) Method and device for generating information, electronic equipment and computer readable storage medium
CN111290714A (en) Data reading method and device
CN111666417A (en) Method and device for generating synonyms, electronic equipment and readable storage medium
CN113468529B (en) Data searching method and device
CN111680508B (en) Text processing method and device
CN111539225B (en) Searching method and device for semantic understanding framework structure
CN111723318B (en) Page data processing method, device, equipment and storage medium
CN111523000A (en) Method, device, equipment and storage medium for importing data
CN112598139A (en) Category coding method, category coding device, category coding apparatus, storage medium, and program product
CN111737404A (en) Data processing method, device, equipment and computer storage medium
CN112052347A (en) Image storage method and device and electronic equipment
CN112269789B (en) Method and device for storing data, and method and device for reading data
JP7293544B2 (en) Q&A system update processing method and device

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
GR01 Patent grant
GR01 Patent grant