Data graph node query method, device, equipment and storage medium
By constructing bitmap templates and operations, the problem of slow query speed of data graph nodes is solved, and faster query speed is achieved.
Patent Information
- Application Number
- CN202310791952.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2043-06-29
AI Technical Summary
The existing data graph node query speed is slow because directly using node attributes for comparison results in a large amount of attribute data and a low query speed.
By constructing bitmap templates and bitmaps of node attributes and using bitmap operations for querying, the amount of data can be reduced and the query speed can be improved.
Improved the speed of querying data graph nodes, especially the query speed of insurance product graphs.
Smart Images

Figure CN116821130B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of data analysis technology and financial technology, and in particular to a node query method, device, electronic device and storage medium for a data graph. Background Art
[0002] In the field of finance and insurance, due to the complexity of data, in order to more clearly represent the relationship between data, the data is constructed into a data graph (such as constructing an insurance product graph based on insurance data such as insurance companies, insurance products, insurance liabilities, and insurance diseases). In order to query the data in the data graph (such as eligible insurance products), it is necessary to query the corresponding nodes in the data graph.
[0003] However, existing data graph node queries (such as querying eligible insurance product nodes in the insurance product graph) directly compare and filter the attributes of the node to be queried with the attributes of each node in the data graph. The attribute comparison is slow and the amount of attribute data is large, resulting in a low speed for data graph node queries. Summary of the Invention
[0004] The present invention provides a method, device, electronic device and storage medium for node query of a data graph, the main purpose of which is to improve the speed of node query of data graphs such as insurance product graphs.
[0005] Acquire attribute data of all node attributes of each node in the target data map, and perform deduplication aggregation on all attribute data of the same node attribute to obtain an attribute data set of each node attribute in the target data map;
[0006] Constructing a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute, to obtain a bitmap template of each node attribute;
[0007] Using the attribute data of each node attribute of the node, a bitmap template of the same node attribute is updated to obtain a node attribute bitmap of each node attribute in the node;
[0008] Performing bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain a node bitmap of the node;
[0009] Mapping the node bitmap to the index of the corresponding node in the target data map;
[0010] When receiving a node query condition including a query node attribute and query attribute data of the query node attribute, converting the node query condition into a bitmap based on the bitmap template to obtain a query bitmap;
[0011] Performing a bitmap operation on the query bitmap and each of the node bitmaps, and screening all node bitmaps according to the operation results to obtain a target node bitmap;
[0012] The target data graph is queried for a node indexed as the target node bitmap to obtain a target node.
[0013] Optionally, constructing a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute to obtain a bitmap template of each node attribute includes:
[0014] A bitmap with the same number of bits and a value of each bit being zero is constructed according to the number of attribute data in the attribute data set of the node attribute, to obtain a bitmap template of the node attribute.
[0015] Optionally, each bit in the bitmap template of the node attribute corresponds one-to-one to each attribute data in the attribute data set of the node attribute.
[0016] Optionally, converting the node query condition into a bitmap based on the bitmap template to obtain a query bitmap includes:
[0017] Combining the bitmap templates of all node attributes in the target data map into a new bitmap according to a preset node attribute order to obtain a template bitmap;
[0018] Determine the bit corresponding to the query attribute data in the bitmap template of the query node attribute as the query bit;
[0019] The query bitmap is obtained by replacing the value of the query bit in the template bitmap with 1.
[0020] Optionally, the updating of the bitmap template of the same node attribute by using the attribute data of each node attribute of the node to obtain the node attribute bitmap of each node attribute in the node includes:
[0021] According to the attribute data of each node attribute in the node, the value of the bit corresponding to the same attribute data in the bitmap template of the same node attribute is replaced with 1 to obtain a node attribute bitmap of each node attribute in the node.
[0022] Optionally, performing a bitmap operation on the query bitmap and each of the node bitmaps, and screening all node bitmaps according to the operation result to obtain a target node bitmap, includes:
[0023] Performing an AND operation on the query bitmap and each of the node bitmaps to obtain a query result bitmap corresponding to each of the node bitmaps;
[0024] Determine whether the values of all query bits in each query result bitmap are 1;
[0025] When the values of all query bits in the query result bitmap are 1, the query result bitmap is determined as the target query result bitmap;
[0026] The node bitmap corresponding to the target query result bitmap is determined as the target node bitmap.
[0027] Optionally, performing bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain the node bitmap of the node includes:
[0028] Combining the bitmap templates of all node attributes in the target data graph into a sequence according to a preset node attribute order to obtain a bitmap template sequence;
[0029] Using the node attribute bitmap of each node attribute contained in the node to replace the bitmap template of the same node attribute in the bitmap template sequence, to obtain a node bitmap sequence;
[0030] All bitmaps in the node bitmap sequence are combined into a new bitmap according to the order in the sequence to obtain the node bitmap.
[0031] In order to solve the above problems, the present invention further provides a node query device for a data graph, the device comprising:
[0032] A bitmap construction module is used to obtain the attribute data of all node attributes of each node in the target data map, and to deduplicate and aggregate all the attribute data of the same node attribute obtained to obtain an attribute data set of each node attribute in the target data map; to construct a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute, to obtain a bitmap template of each node attribute; to update the bitmap template of the same node attribute using the attribute data of each node attribute of the node, to obtain a node attribute bitmap of each node attribute in the node; to perform bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template, to obtain a node bitmap of the node;
[0033] An index mapping module, configured to map the node bitmap to an index of a corresponding node in the target data graph;
[0034] The node query module is used to, when receiving a node query condition including a query node attribute and query attribute data of the query node attribute, convert the node query condition into a bitmap based on the bitmap template to obtain a query bitmap; perform a bitmap operation on the query bitmap and each of the node bitmaps, and filter all node bitmaps according to the operation result to obtain a target node bitmap; and query the node indexed as the target node bitmap in the target data map to obtain a target node.
[0035] In order to solve the above problem, the present invention further provides an electronic device, comprising:
[0036] a memory storing at least one computer program; and
[0037] The processor executes the computer program stored in the memory to implement the node query method of the data graph described above.
[0038] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the node query method of the data graph described above.
[0039] The embodiment of the present invention maps the node bitmap to the index of the corresponding node in the target data graph; when a node query condition containing query node attributes and query attribute data of the query node attributes is received, the node query condition is converted into a bitmap based on the bitmap template to obtain a query bitmap; the query bitmap is subjected to a bitmap operation with each of the node bitmaps, and all node bitmaps are screened according to the operation result to obtain a target node bitmap; the node indexed as the target node bitmap in the target data graph is queried to obtain a target node. The attributes of the node are converted into a bitmap. Compared with the attributes, the bitmap has a smaller amount of data and the query execution speed is faster. At the same time, bitmap operations are used for querying. Compared with attribute comparison, bitmap operations are faster for querying, which improves the query speed. Then, the index is used for querying. Compared with direct attribute comparison, the speed of node query of data graphs such as insurance product graphs is further improved. Therefore, the node query method, device, electronic device and readable storage medium for data graphs proposed in the embodiment of the present invention improve the speed of node query of data graphs such as insurance product graphs. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of a flow chart of a node query method for a data graph provided by one embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a module of a node query device for a data graph provided by an embodiment of the present invention;
[0042] Figure 3 A schematic diagram of the internal structure of an electronic device for implementing a node query method for a data graph according to an embodiment of the present invention;
[0043] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0045] An embodiment of the present invention provides a method for querying nodes in a data graph. The execution subject of the node query method of the data graph includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the node query method of the data graph can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms.
[0046] Reference Figure 1 FIG2 is a flow chart of a method for querying nodes in a data graph according to an embodiment of the present invention. In the embodiment of the present invention, the method for querying nodes in a data graph includes the following steps:
[0047] S1. Acquire attribute data of all node attributes of each node in the target data map, and remove duplicates and aggregate all attribute data of the same node attribute to obtain an attribute data set of each node attribute in the target data map;
[0048] The target data graph in an embodiment of the present invention may be an insurance product graph, which includes different types of nodes, and the node data of each node is composed of node attributes and corresponding attribute data. For example, the target data graph is a knowledge graph that can be used to recommend disease insurance products that are suitable for user needs and risk preferences to users, and includes nodes of the following types: insurance company, insurance product, disease type, clause content, etc. For example, the attributes of the insurance company node may include company name, company address, company size, etc.; the attributes of the insurance product node may include product name, product price, insured amount, validity period, etc.; the attributes of the insurance liability node may include liability name, scope of liability, liability limit, etc.; the attributes of the insurance disease node may include disease name, disease definition, disease classification, etc.
[0049] Furthermore, in an embodiment of the present invention, in order to determine the attribute data corresponding to each node attribute in the target data map, the attribute data of all node attributes of each node in the target data map are obtained, and all the attribute data of the same node attribute obtained are deduplicated and aggregated to obtain the attribute data set of each node attribute in the target data map.
[0050] S2. Construct a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute, to obtain a bitmap template of each node attribute;
[0051] In order to better determine the dimension of the bitmap of each node attribute in the embodiment of the present invention, a bitmap of the same bit dimension is constructed according to the number of attribute data in the attribute data set of each node attribute to obtain a bitmap template of each node attribute.
[0052] In detail, the method of constructing a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute in the embodiment of the present invention to obtain a bitmap template of each node attribute includes:
[0053] A bitmap with the same number of bits and a value of zero for each bit is constructed according to the number of attribute data in the attribute data set of the node attribute, to obtain a bitmap template of the node attribute, wherein each bit in the bitmap template corresponds one-to-one to each attribute data in the attribute data set of the node attribute.
[0054] For example: the node attribute is the name of the insurance product. There are three attribute data in the attribute data set of this node attribute, namely A insurance, B insurance, and C insurance. Then the bitmap template corresponding to this node attribute is 000. The three bits in the bitmap template correspond to one attribute data respectively, such as the first bit corresponds to C insurance, the second bit corresponds to B insurance, and the first bit corresponds to A insurance.
[0055] S3. Using the attribute data of each node attribute of the node, the bitmap template of the same node attribute is updated to obtain a node attribute bitmap of each node attribute in the node;
[0056] In the embodiment of the present invention, the attribute data representation of the node is further confirmed by updating the bitmap template of the same node attribute using the attribute data of each node attribute of the node to obtain a node attribute bitmap of each node attribute in the node.
[0057] In detail, in an embodiment of the present invention, the bitmap template of the same node attribute is updated by using the attribute data of each node attribute of the node to obtain a node attribute bitmap of each node attribute in the node, including:
[0058] According to the attribute data of each node attribute in the node, the value of the bit corresponding to the same attribute data in the bitmap template of the same node attribute is replaced with 1 to obtain a node attribute bitmap of each node attribute in the node.
[0059] For example: the node is an insurance product node A, and has one node attribute, which is the product name. The corresponding attribute data is A insurance. The bitmap template corresponding to the node attribute of the product name is 000. The bit corresponding to A insurance in the bitmap template is the first bit. Therefore, the value of the first bit in the bitmap template 000 is replaced with 1, and the node attribute bitmap of the node attribute of the product name of the A insurance product node is 100.
[0060] S4. performing bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain a node bitmap of the node;
[0061] In order to represent each node with a bitmap in the embodiment of the present invention, a bitmap combination is performed based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain a node bitmap of the node.
[0062] In detail, the node attribute bitmap based on each node attribute in the node and the bitmap template are combined to obtain the node bitmap of the node in the embodiment of the present invention, including:
[0063] Combining the bitmap templates of all node attributes in the target data graph into a sequence according to a preset node attribute order to obtain a bitmap template sequence;
[0064] Using the node attribute bitmap of each node attribute contained in the node to replace the bitmap template of the same node attribute in the bitmap template sequence, to obtain a node bitmap sequence;
[0065] All bitmaps in the node bitmap sequence are combined into a new bitmap according to the order in the sequence to obtain the node bitmap.
[0066] For example: there are two node attributes in the target data graph, namely the insurance company name and the insurance product name. The bitmap template of the insurance company name is 000, and the bitmap template of the insurance product name is 0000. The node attribute order is insurance company name, insurance product name, then the bitmap template sequence is [000, 0000]; the node is insurance product node A, and has one node attribute, which is product name. The node attribute bitmap of the product name of insurance product node A is 0100; then the bitmap template of the insurance product name in the bitmap template sequence [000, 0000] is replaced with the node attribute bitmap of the product name of insurance product node A, and the node bitmap sequence of insurance product node A is [000, 0100]. All bitmaps in the node bitmap sequence of insurance product node A are combined into a new bitmap according to the order in the sequence to obtain the node bitmap of insurance product node A, which is 0000100.
[0067] S5, mapping the node bitmap to the index of the corresponding node in the target data map,
[0068] In order to facilitate the query of different nodes that meet the conditions in the target data map in the embodiment of the present invention, the node bitmap is mapped to the index stored in the corresponding node in the target data map.
[0069] Furthermore, in order to quickly query the corresponding node through the index, the embodiment of the present invention improves the speed of node query in the data graph.
[0070] S6. When a node query condition including a query node attribute and query attribute data of the query node attribute is received, converting the node query condition into a bitmap based on the bitmap template to obtain a query bitmap;
[0071] In the embodiment of the present invention, the node query condition includes a query node attribute and corresponding query attribute data. For example, the node query condition is an insurance product node with a validity period of 1 year, where the query node attribute is the validity period and the corresponding query attribute data is 1 year.
[0072] Furthermore, in an embodiment of the present invention, the node query condition is converted into a bitmap based on the bitmap template to obtain a query bitmap, including:
[0073] Combining the bitmap templates of all node attributes in the target data map into a new bitmap according to a preset node attribute order to obtain a template bitmap;
[0074] Determine the bit corresponding to the query attribute data in the bitmap template of the query node attribute as the query bit;
[0075] The query bitmap is obtained by replacing the value of the query bit in the template bitmap with 1.
[0076] For example: There are two node attributes in the target data map, namely insurance validity period and insurance product name. The bitmap template of insurance product name is 0000, and the bitmap template of insurance validity period is 000. The order of node attributes is insurance product name and insurance validity period, so the corresponding template bitmap is 0000000 (the first four bits are the bitmap template of insurance product name, and the last three bits are the bitmap template of insurance validity period). The query node attribute is insurance validity period, and the query attribute data corresponding to the query node attribute is 1 year. The second bit in the bitmap template of the query attribute data corresponding to the insurance validity period is the query bit, that is, the sixth bit in the template bitmap is the query bit. Replace the value of the query bit in the template bitmap with 1, and the query bitmap is 0000010.
[0077] S7, performing a bitmap operation on the query bitmap and each of the node bitmaps, and screening all node bitmaps according to the operation results to obtain a target node bitmap;
[0078] In order to quickly find the node data to be queried in the embodiment of the present invention, it is necessary to first determine the index of the node data to be queried. Therefore, the query bitmap is subjected to a bitmap operation with each of the node bitmaps, and all node bitmaps are screened according to the operation results to obtain the target node bitmap.
[0079] In detail, in the embodiment of the present invention, bitmap operations are performed on the query bitmap and each of the node bitmaps, and all node bitmaps are screened according to the operation results to obtain a target node bitmap, including:
[0080] Performing an AND operation on the query bitmap and each of the node bitmaps to obtain a query result bitmap corresponding to each of the node bitmaps;
[0081] Determine whether the values of all query bits in each query result bitmap are 1;
[0082] When the values of all query bits in the query result bitmap are 1, determining the query result bitmap as the target query result bitmap;
[0083] The node bitmap corresponding to the target query result bitmap is determined as the target node bitmap.
[0084] In another embodiment of the present invention, bitmap operations are performed on the query bitmap and each of the node bitmaps, and all node bitmaps are screened according to the operation results to obtain a target node bitmap, including:
[0085] Performing an OR operation on the query bitmap and each of the node bitmaps to obtain a query result bitmap corresponding to each of the node bitmaps;
[0086] Determine whether the values of all query bits in each query result bitmap are 0;
[0087] If all query bit values in the query result bitmap are 0, the query result bitmap is determined as the target query result bitmap;
[0088] The node bitmap corresponding to the target query result bitmap is determined as the target node bitmap.
[0089] S8. Query the target data graph for a node indexed as the target node bitmap to obtain a target node.
[0090] In the embodiment of the present invention, the target node is obtained by querying the target data graph for a node indexed as the target node bitmap.
[0091] In an embodiment of the present invention, by quickly querying a node, further inquiries can be made on other data corresponding to the node, such as: the node data of the node, the relationship with other nodes connected to the node, and the nodes with which the node has a preset connection relationship. For example, S5 can also obtain the connection nodes and corresponding node relationships of each node in the target data map, obtain the target node connection information of each node, and map the node bitmap to an index of the corresponding target node connection information. The node connection information of nodes that meet the conditions can also be quickly queried. The query method is the same as the node query method and will not be repeated here.
[0092] like Figure 2 , which is a functional module diagram of a node query device for a data map of the present invention.
[0093] The data graph node query device 100 described in the present invention can be installed in an electronic device. Depending on the functionality implemented, the data graph node query device can include a bitmap construction module 101, a sound index mapping module 102, and a node query module 103. A module, also referred to as a unit, is a series of computer program segments that can be executed by an electronic device processor and perform a fixed function, and is stored in the electronic device's memory.
[0094] In this embodiment, the functions of each module / unit are as follows:
[0095] The bitmap construction module 101 is used to obtain the attribute data of all node attributes of each node in the target data map, and deduplicate and summarize all the attribute data of the same node attribute to obtain the attribute data set of each node attribute in the target data map; construct a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute to obtain a bitmap template of each node attribute; update the bitmap template of the same node attribute using the attribute data of each node attribute of the node to obtain a node attribute bitmap of each node attribute in the node; perform bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain a node bitmap of the node;
[0096] The index mapping module 102 is used to map the node bitmap to the index of the corresponding node in the target data map;
[0097] The node query module 103 is used to, when receiving a node query condition including a query node attribute and query attribute data of the query node attribute, convert the node query condition into a bitmap based on the bitmap template to obtain a query bitmap; perform a bitmap operation on the query bitmap and each of the node bitmaps, and filter all node bitmaps according to the operation result to obtain a target node bitmap; and query the node indexed as the target node bitmap in the target data map to obtain a target node.
[0098] In detail, each module in the node query device 100 of the data graph in the embodiment of the present invention adopts the same method as above when in use. Figure 1 The node query method of the data graph described in the preceding text is the same technical means and can produce the same technical effects, so I will not go into details here.
[0099] like Figure 3 , which is a schematic diagram of the structure of an electronic device for implementing a node query method of a data graph according to the present invention.
[0100] The electronic device may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a node query program for a data graph.
[0101] The memory 11 includes at least one type of readable storage medium, including a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, etc. equipped on the electronic device. Furthermore, the memory 11 may include both an internal storage unit of the electronic device and an external storage device. The memory 11 can be used not only to store application software and various types of data installed in the electronic device, such as the code of a node query program of a data graph, but also to temporarily store data that has been output or is about to be output.
[0102] In some embodiments, the processor 10 may be comprised of an integrated circuit, such as a single packaged integrated circuit or a plurality of packaged integrated circuits with the same or different functions, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control core (control unit) of the electronic device, connecting the various components of the entire electronic device using various interfaces and circuits. It executes or runs programs or modules stored in the memory 11 (such as a node query program for a data graph) and accesses data stored in the memory 11 to perform various functions of the electronic device and process data.
[0103] The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This bus can be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is configured to enable communication between the memory 11 and at least one processor 10. For ease of illustration, the figure uses only a single thick line, but this does not indicate that there is only one bus or only one type of bus.
[0104] Figure 3 Only the electronic device with components is shown, and it can be understood by those skilled in the art that Figure 3The structure shown does not limit the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0105] For example, although not shown, the electronic device may further include a power source (e.g., a battery) to power various components. Preferably, the power source may be logically connected to the at least one processor 10 via a power management device, thereby enabling functions such as charge management, discharge management, and power consumption management via the power management device. The power source may further include any of one or more DC or AC power sources, a recharging device, a power failure classification circuit, a power converter or inverter, a power status indicator, and the like. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, and the like, which are not further detailed here.
[0106] Optionally, the communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
[0107] Optionally, the communication interface 13 may further include a user interface, which may be a display or an input unit (such as a keyboard). Optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display may also be appropriately referred to as a display screen or display unit, and is used to display information processed in the electronic device and to display a visual user interface.
[0108] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0109] The node query program of the data graph stored in the memory 11 of the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:
[0110] Acquire attribute data of all node attributes of each node in the target data map, and perform deduplication aggregation on all attribute data of the same node attribute to obtain an attribute data set of each node attribute in the target data map;
[0111] Constructing a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute, to obtain a bitmap template of each node attribute;
[0112] Using the attribute data of each node attribute of the node, a bitmap template of the same node attribute is updated to obtain a node attribute bitmap of each node attribute in the node;
[0113] Performing bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain a node bitmap of the node;
[0114] Mapping the node bitmap to the index of the corresponding node in the target data map;
[0115] When receiving a node query condition including a query node attribute and query attribute data of the query node attribute, converting the node query condition into a bitmap based on the bitmap template to obtain a query bitmap;
[0116] Performing a bitmap operation on the query bitmap and each of the node bitmaps, and screening all node bitmaps according to the operation results to obtain a target node bitmap;
[0117] The target data graph is queried for a node indexed as the target node bitmap to obtain a target node.
[0118] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0119] Furthermore, if the module / unit integrated into the electronic device is implemented as a software functional unit and sold or used as a standalone product, it may be stored on a computer-readable storage medium. The computer-readable medium may be non-volatile or volatile. The computer-readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0120] An embodiment of the present invention may further provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor of an electronic device, the computer program may implement:
[0121] Acquire attribute data of all node attributes of each node in the target data map, and perform deduplication aggregation on all attribute data of the same node attribute to obtain an attribute data set of each node attribute in the target data map;
[0122] Constructing a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute, to obtain a bitmap template of each node attribute;
[0123] Using the attribute data of each node attribute of the node, a bitmap template of the same node attribute is updated to obtain a node attribute bitmap of each node attribute in the node;
[0124] Performing bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain a node bitmap of the node;
[0125] Mapping the node bitmap to the index of the corresponding node in the target data map;
[0126] When receiving a node query condition including a query node attribute and query attribute data of the query node attribute, converting the node query condition into a bitmap based on the bitmap template to obtain a query bitmap;
[0127] Performing a bitmap operation on the query bitmap and each of the node bitmaps, and screening all node bitmaps according to the operation results to obtain a target node bitmap;
[0128] The target data graph is queried for a node indexed as the target node bitmap to obtain a target node.
[0129] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0130] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and other division methods may be used in actual implementation.
[0131] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of the solution of this embodiment according to actual needs.
[0132] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0133] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional modules.
[0134] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0135] Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims rather than the foregoing description, and all changes that come within the meaning and range of equivalents of the claims are intended to be embraced therein. Any reference to a figure in a claim should not be construed as limiting the claim to which it relates.
[0136] Blockchain, as used in this article, refers to a novel application model for computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each block contains information about a batch of online transactions, used to verify the validity of this information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.
[0137] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. Second-order terms are used to indicate names and do not imply any particular order.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A node query method for a data graph, characterized in that: The method comprises: Acquire attribute data of all node attributes of each node in the target data map, and perform deduplication aggregation on all attribute data of the same node attribute to obtain an attribute data set of each node attribute in the target data map; Constructing a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute, to obtain a bitmap template of each node attribute; Using the attribute data of each node attribute of the node, a bitmap template of the same node attribute is updated to obtain a node attribute bitmap of each node attribute in the node; Performing bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain a node bitmap of the node; Mapping the node bitmap to the index of the corresponding node in the target data map; When receiving a node query condition including a query node attribute and query attribute data of the query node attribute, converting the node query condition into a bitmap based on the bitmap template to obtain a query bitmap; Performing a bitmap operation on the query bitmap and each of the node bitmaps, and screening all node bitmaps according to the operation results to obtain a target node bitmap; Querying the target data graph for a node indexed as the target node bitmap to obtain a target node; Among them, the bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain the node bitmap of the node includes: combining the bitmap templates of all node attributes in the target data map into a sequence according to a preset node attribute order to obtain a bitmap template sequence; using the node attribute bitmap of each node attribute contained in the node to replace the bitmap template of the same node attribute in the bitmap template sequence to obtain a node bitmap sequence; combining all bitmaps in the node bitmap sequence into a new bitmap according to the order in the sequence to obtain the node bitmap.
2. The node query method of the data graph according to claim 1, characterized in that: The step of constructing a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute to obtain a bitmap template of each node attribute includes: A bitmap with the same number of bits and a value of each bit being zero is constructed according to the number of attribute data in the attribute data set of the node attribute, to obtain a bitmap template of the node attribute.
3. The node query method of the data graph according to claim 1, characterized in that: Each bit in the bitmap template of the node attribute corresponds one-to-one to each attribute data in the attribute data set of the node attribute.
4. The node query method of the data graph according to claim 3, characterized in that: The step of converting the node query condition into a bitmap based on the bitmap template to obtain a query bitmap includes: Combining the bitmap templates of all node attributes in the target data map into a new bitmap according to a preset node attribute order to obtain a template bitmap; Determine the bit corresponding to the query attribute data in the bitmap template of the query node attribute as the query bit; The query bitmap is obtained by replacing the value of the query bit in the template bitmap with 1.
5. The node query method of the data graph as claimed in claim 3, characterized in that: The updating of the bitmap template of the same node attribute by using the attribute data of each node attribute of the node to obtain the node attribute bitmap of each node attribute in the node includes: According to the attribute data of each node attribute in the node, the value of the bit corresponding to the same attribute data in the bitmap template of the same node attribute is replaced with 1 to obtain a node attribute bitmap of each node attribute in the node.
6. The node query method of the data graph according to claim 4, characterized in that: The step of performing a bitmap operation on the query bitmap and each of the node bitmaps, and screening all the node bitmaps according to the operation results to obtain a target node bitmap, includes: Performing an AND operation on the query bitmap and each of the node bitmaps to obtain a query result bitmap corresponding to each of the node bitmaps; Determine whether the values of all query bits in each query result bitmap are 1; When the values of all query bits in the query result bitmap are 1, the query result bitmap is determined as the target query result bitmap; The node bitmap corresponding to the target query result bitmap is determined as the target node bitmap.
7. A node query device for a data graph, characterized in that: include: A bitmap construction module is used to obtain the attribute data of all node attributes of each node in the target data map, and to deduplicate and aggregate all the attribute data of the same node attribute to obtain an attribute data set of each node attribute in the target data map; to construct a bitmap of the same bit dimension according to the number of attribute data in the attribute data set of each node attribute, to obtain a bitmap template for each node attribute; Using the attribute data of each node attribute of the node, a bitmap template of the same node attribute is updated to obtain a node attribute bitmap of each node attribute in the node; Performing bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain a node bitmap of the node; An index mapping module, configured to map the node bitmap to an index of a corresponding node in the target data graph; a node query module configured to, upon receiving a node query condition comprising a query node attribute and query attribute data of the query node attribute, convert the node query condition into a bitmap based on the bitmap template to obtain a query bitmap; Performing a bitmap operation on the query bitmap and each of the node bitmaps, and screening all node bitmaps according to the operation results to obtain a target node bitmap; Querying the target data graph for a node indexed as the target node bitmap to obtain a target node; Among them, the bitmap combination based on the node attribute bitmap of each node attribute in the node and the bitmap template to obtain the node bitmap of the node includes: combining the bitmap templates of all node attributes in the target data map into a sequence according to a preset node attribute order to obtain a bitmap template sequence; using the node attribute bitmap of each node attribute contained in the node to replace the bitmap template of the same node attribute in the bitmap template sequence to obtain a node bitmap sequence; combining all bitmaps in the node bitmap sequence into a new bitmap according to the order in the sequence to obtain the node bitmap.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; In which, the memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the node query method of the data graph as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the node query method of the data graph as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Character string storage method, matching method, electronic equipment and readable storage medium
CN109857740A
Data query method, system and equipment based on bitmap storage and medium
CN116010420A