A graph data query statement determination method, device, equipment and medium
By acquiring and judging the legality of graph data query information, and filtering and configuring graph data query statements from the local database, the problems of low efficiency and insufficient security in the existing technology are solved, and efficient and secure graph data query is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI PINKRYPTON INFORMATION TECH CO LTD
- Filing Date
- 2023-03-14
- Publication Date
- 2026-05-08
AI Technical Summary
In existing technologies, graph data query statements are inefficient, lack diversity in business needs, and lack security verification, making them unsuitable for a large number of business users.
By acquiring graph data query information and determining its legality, legal statements are selected from the local preset graph data query statement library, statement configuration information is acquired and configured, and the target graph data query statement is generated.
It improves the efficiency of graph data query statements, increases the diversity of business requirements, and performs security checks during saving to ensure the security of query statements.
Smart Images

Figure CN116204552B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for determining graph data query statements. Background Technology
[0002] Database query languages are purpose-specific programming languages, standard computer languages used to manage access to and process databases. Graph database query languages are computer languages specifically designed for graph databases; for example, Cypher, Gremlin, and DQL (Data Query Language Standard Syntax) can be used to manage graph data. Business personnel refer to staff within an organization who are responsible for specific economic activities, such as production, planning, sales, procurement, accounting, statistics, pricing, and advertising. Conversely, technical personnel refer to professionals who possess computer programming skills and can write computer code and statements. Currently, database query languages are written by professional technical personnel and stored on servers. Business personnel lack the ability to write database query languages and upload database query statements to servers. While some software and internet services allow business personnel to submit custom query statements, these statements are easily modified, lack security checks, and can only be used on a small scale within internal systems, not for a large number of business personnel.
[0003] As can be seen from the above, in the process of determining graph data query statements, how to improve the efficiency of determining graph data query statements, increase the diversity of business requirements, and improve the security of graph data query statements are problems that need to be solved in this field. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for determining graph data query statements, which can improve the efficiency of graph data query statement determination, increase the diversity of business requirements, and improve the security of graph data query statements. The specific solution is as follows:
[0005] Firstly, this application discloses a method for determining graph data query statements, including:
[0006] Obtain graph data query information and determine whether the graph data query information is valid;
[0007] If the graph data query information is valid, then graph data query statements are selected from the locally preset graph data query statement library based on the graph data query information;
[0008] Obtain statement query configuration information, determine the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configure the graph data query statement to be configured according to the statement query configuration information to obtain the target graph data query statement.
[0009] Optionally, obtaining graph data query information includes:
[0010] Obtain the graph data query information sent by the client, which contains a JSON-formatted string;
[0011] The graph data query information, which contains a JSON format string, is saved to a local preset database.
[0012] Optionally, determining whether the graph data query information is valid includes:
[0013] Based on the graph data query information, the target judgment rule is determined from all preset judgment rules;
[0014] The validity of the graph data query information is determined based on the target judgment rules.
[0015] Optionally, the step of filtering graph data query statements from a locally preset graph data query statement library based on the graph data query information includes:
[0016] Execute the local preset mapping program;
[0017] Using the mapping program and based on the graph data query information, the graph data query statement corresponding to the graph data query information is retrieved from the local graph data query statement library.
[0018] Optionally, the step of obtaining the query configuration information includes:
[0019] It facilitates the retrieval of configuration information by using a pre-defined information retrieval interface or Hypertext Transfer Protocol interface to obtain query statements.
[0020] The statement's unique identifier and configuration parameters are determined from the statement's query configuration information.
[0021] Optionally, the step of determining the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configuring the graph data query statement to be configured according to the statement query configuration information, includes:
[0022] Select the graph data query statements that correspond to the unique identifier of the statement from the graph data query statements and use them as the graph data query statements to be configured.
[0023] Configure the query statement for the graph data to be configured using the statement configuration parameters.
[0024] Optionally, after obtaining the target graph data query statement, the method further includes:
[0025] The data presentation method is determined based on business needs;
[0026] The data information containing the target graph data query statement will be presented to the client according to the data presentation method described above.
[0027] Secondly, this application discloses a graph data query statement determination device, comprising:
[0028] The judgment module is used to obtain graph data query information and determine whether the graph data query information is valid;
[0029] The query statement filtering module is used to filter out graph data query statements from a locally preset graph data query statement library based on the graph data query information if the graph data query information is valid.
[0030] The target graph data query statement determination module is used to obtain statement query configuration information, determine the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configure the graph data query statement to be configured according to the statement query configuration information to obtain the target graph data query statement.
[0031] Thirdly, this application discloses an electronic device, including:
[0032] Memory, used to store computer programs;
[0033] A processor is configured to execute the computer program to implement the aforementioned method for determining graph data query statements.
[0034] Fourthly, this application discloses a computer storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned disclosed graph data query statement determination method.
[0035] As can be seen, this application provides a method for determining graph data query statements, including obtaining graph data query information and determining whether the graph data query information is valid; if the graph data query information is valid, then filtering graph data query statements from a locally preset graph data query statement library based on the graph data query information; obtaining statement query configuration information, and determining the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configuring the graph data query statement to be configured according to the statement query configuration information to obtain the target graph data query statement. This application allows business personnel to create custom query statements, rather than customized query statements, to increase the diversity of business needs. Furthermore, the query views created by business personnel are stored on the backend server, and verification is performed during storage to ensure the security of the graph data query statements, thereby improving the efficiency of graph data query statement determination. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0037] Figure 1 This application discloses a flowchart of a method for determining graph data query statements.
[0038] Figure 2 This is an example diagram of a graph data query statement disclosed in this application;
[0039] Figure 3 This is an example diagram of a graph data query statement disclosed in this application;
[0040] Figure 4 This is an example diagram of a graph data query statement disclosed in this application;
[0041] Figure 5 This application discloses a flowchart of a method for determining graph data query statements.
[0042] Figure 6 This is an example diagram of a graph data query statement disclosed in this application;
[0043] Figure 7 This is an example diagram of a graph data query statement disclosed in this application;
[0044] Figure 8 This application discloses a specific flowchart of a method for determining graph data query statements.
[0045] Figure 9 This is a schematic diagram of the structure of a graph data query statement determination device disclosed in this application;
[0046] Figure 10 This application provides a structural diagram of an electronic device. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] Database query languages are purpose-specific programming languages, standard computer languages used to manage access to and process databases. Graph database query languages are computer languages specifically designed for graph databases; for example, Cypher, Gremlin, and DQL (Data Query Language Standard Syntax) can be used to manage graph data queries. Business personnel refer to staff within an organization who are responsible for specific economic activities, such as production, planning, sales, procurement, accounting, statistics, pricing, and advertising. Correspondingly, technical personnel refer to professionals who possess computer programming skills and can write computer code and statements. Currently, database query languages are written by professional technical personnel and stored on servers. Business personnel lack the ability to write database query languages and upload database query statements to servers. Currently, some software and internet services allow business personnel to submit custom query statements, but these queries are easily modified, lack security checks, and can only be used on a small scale within internal systems, not for a large number of business personnel. Therefore, in the process of determining graph data query statements, improving the efficiency of graph data query statement determination, increasing the diversity of business needs, and improving the security of graph data query statements are problems that need to be solved in this field.
[0049] See Figure 1 As shown in the figure, an embodiment of the present invention discloses a method for determining graph data query statements, which may specifically include:
[0050] Step S11: Obtain graph data query information and determine whether the graph data query information is valid.
[0051] In this embodiment, the graph data query information containing a JSON format string sent by the client is obtained, and then the graph data query information containing the JSON format string is saved to a locally preset database. Figure 2For example, this is a JSON-formatted string representing the data the user wants to query. If the business user wants propB to be a dynamic parameter, not a fixed one, they can add a $ sign before it, such as... Figure 3 As shown.
[0052] In this embodiment, business personnel send graph data query information to their local machine from the interactive page of an internet application. Some fields in the data query information are required, while others are optional. For example: business personnel permission identifier (used to detect business personnel permissions); entity type (the type of entity the business personnel want to query); edge (the edge attribute of the entity the business personnel are querying); associated edges (if the edge attribute of the entity the business personnel are querying is associated with other entities, the associated entities need to be found); filter (the business personnel can set a filter to filter out certain entities); paginator (the business personnel can set a paginator to find data on a specified number of pages); and placeholder parameters (the business personnel can set placeholder parameters, which are then replaced by actual parameters when executing the interface call).
[0053] In this embodiment, the specific steps for determining whether the graph data query information is valid are as follows: Based on the graph data query information, a target judgment rule is determined from all preset judgment rules, and the validity of the graph data query information is determined according to the target judgment rule. Specifically, the validity of the graph data query information is verified from the following aspects: Entities are valid: whether the entity of the interface exists and whether it has query permission; Edges are valid: whether the edge of the interface exists and whether it has query permission; Associated edges are valid: whether the edge of the interface exists and whether it has query permission, and whether the entity attached to the edge exists and whether it has query permission; Filters are valid: whether the filter of the interface is effectively set; Paginators are valid: whether the paginator of the interface is effectively set; Placeholder parameters: whether correct placeholder parameters exist.
[0054] Step S12: If the graph data query information is valid, then the graph data query statement is selected from the local preset graph data query statement library based on the graph data query information.
[0055] In this embodiment, if the graph data query information is valid, a local preset mapping program is executed, and then the mapping program is used to map and query the graph data query statement corresponding to the graph data query information from the local graph data query statement library based on the graph data query information.
[0056] In this embodiment, technicians pre-write a mapping program and run it on the server to map the data interface information created by business personnel into query statements, such as... Figure 4 As shown, such a mapping program can be called an adapter, which can convert interface data into graph data query statements that can be used by various graph databases.
[0057] Step S13: Obtain statement query configuration information, determine the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configure the graph data query statement to be configured according to the statement query configuration information to obtain the target graph data query statement.
[0058] In this embodiment, graph data query information is obtained, and its validity is determined. If the graph data query information is valid, graph data query statements are selected from a locally preset graph data query statement library based on the graph data query information. Statement query configuration information is obtained, and a graph data query statement to be configured is determined from the graph data query statements based on the statement query configuration information. The graph data query statement to be configured is then configured according to the statement query configuration information to obtain the target graph data query statement. This application allows business personnel to create custom query statements, rather than customized query statements, to increase the diversity of business needs. Furthermore, the query views created by business personnel are stored on the backend server, and verification is performed during storage to ensure the security of the graph data query statements, thereby improving the efficiency of graph data query statement determination.
[0059] See Figure 5 As shown in the figure, an embodiment of the present invention discloses a method for determining graph data query statements, which may specifically include:
[0060] Step S21: Obtain graph data query information and determine whether the graph data query information is valid.
[0061] Step S22: If the graph data query information is valid, then the graph data query statement is selected from the local preset graph data query statement library based on the graph data query information.
[0062] Step S23: Obtain statement query configuration information using a preset information acquisition interface or Hypertext Transfer Protocol interface; determine the statement unique identifier and statement configuration parameters from the statement query configuration information; select the graph data query statement corresponding to the statement unique identifier from the graph data query statements as the graph data query statement to be configured; configure the graph data query statement to be configured using the statement configuration parameters to obtain the target graph data query statement.
[0063] In this embodiment, business personnel create an information retrieval interface, in which they pass in a unique statement identifier and statement configuration parameters. Alternatively, business personnel can create an HTTP (Hypertext Transfer Protocol) interface through the application's interactive page, where the unique statement identifier, statement configuration parameters, and caller context information are determined from the statement query configuration information.
[0064] In this embodiment, the server selects the graph data query statement corresponding to the unique statement identifier from the graph data query statements based on the statement unique identifier and statement configuration parameters, and fills the graph data query statement to be configured with the statement configuration parameters, recording the context information of the caller. For example... Figure 6 As shown, the program running on the server will convert the data in the data interface into a database query statement, which can be converted into a DQL query statement. Step S24: Determine the data presentation method according to business requirements, and present the data information containing the target graph data query statement to the client according to the data presentation method.
[0065] In this embodiment, the above Figure 3 The data interface will be stored on the server and given a unique identifier, such as 1. Then, business users can create a query results view on the page through interaction, passing in the unique identifier—1—and setting the dynamic parameter $propB as the key. The passed parameters can be accessed through methods such as... Figure 7 The format in the document informs the server.
[0066] The specific process for this application is as follows: Figure 8 As shown, firstly, the graph data query information containing a JSON format string sent by the client is obtained; then, the graph data query information containing the JSON format string is saved to a local preset database; then, it is determined whether the graph data query information is valid; if the graph data query information is valid, graph data query statements are filtered from a local preset graph data query statement library based on the graph data query information; then, statement query configuration information is obtained, and based on the statement query configuration information, the graph data query statement to be configured is determined from the graph data query statements, and the graph data query statement to be configured is configured according to the statement query configuration information to obtain the target graph data query statement; finally, the data information containing the target graph data query statement is presented to the client according to the data presentation method.
[0067] In this embodiment, graph data query information is obtained, and its validity is determined. If the graph data query information is valid, graph data query statements are selected from a locally preset graph data query statement library based on the graph data query information. Statement query configuration information is obtained, and a graph data query statement to be configured is determined from the graph data query statements based on the statement query configuration information. The graph data query statement to be configured is then configured according to the statement query configuration information to obtain the target graph data query statement. This application allows business personnel to create custom query statements, rather than customized query statements, to increase the diversity of business needs. Furthermore, the query views created by business personnel are stored on the backend server, and verification is performed during storage to ensure the security of the graph data query statements, thereby improving the efficiency of graph data query statement determination.
[0068] See Figure 9 As shown, this embodiment of the invention discloses a graph data query statement determination device, which may specifically include:
[0069] The judgment module 11 is used to obtain graph data query information and determine whether the graph data query information is valid;
[0070] The query statement filtering module 12 is used to filter out graph data query statements from a locally preset graph data query statement library based on the graph data query information if the graph data query information is valid.
[0071] The target graph data query statement determination module 13 is used to obtain statement query configuration information, determine the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configure the graph data query statement to be configured according to the statement query configuration information to obtain the target graph data query statement.
[0072] In this embodiment, graph data query information is obtained, and its validity is determined. If the graph data query information is valid, graph data query statements are selected from a locally preset graph data query statement library based on the graph data query information. Statement query configuration information is obtained, and a graph data query statement to be configured is determined from the graph data query statements based on the statement query configuration information. The graph data query statement to be configured is then configured according to the statement query configuration information to obtain the target graph data query statement. This application allows business personnel to create custom query statements, rather than customized query statements, to increase the diversity of business needs. Furthermore, the query views created by business personnel are stored on the backend server, and verification is performed during storage to ensure the security of the graph data query statements, thereby improving the efficiency of graph data query statement determination.
[0073] In some specific embodiments, the determination module 11 may specifically include:
[0074] The query information acquisition module is used to acquire the graph data query information, which contains a JSON format string, sent by the client;
[0075] The query information saving module is used to save the graph data query information, which contains JSON format strings, to a local preset database.
[0076] In some specific embodiments, the determination module 11 may specifically include:
[0077] The target judgment rule determination module is used to determine the target judgment rule from all preset judgment rules based on the graph data query information;
[0078] The judgment module is used to determine whether the graph data query information is valid according to the target judgment rules.
[0079] In some specific embodiments, the query statement filtering module 12 may specifically include:
[0080] The mapping program execution module is used to execute locally preset mapping programs;
[0081] The query statement filtering module is used to use the mapping program and based on the graph data query information to map and query the graph data query statement corresponding to the graph data query information from the local graph data query statement library.
[0082] In some specific embodiments, the target graph data query statement determination module 13 may specifically include:
[0083] The configuration information acquisition module is used to retrieve configuration information by using a preset information acquisition interface or Hypertext Transfer Protocol interface.
[0084] The statement configuration parameter determination module is used to determine the statement unique identifier and statement configuration parameters from the statement query configuration information.
[0085] In some specific embodiments, the target graph data query statement determination module 13 may specifically include:
[0086] The module for determining the graph data query statement to be configured is used to filter out the graph data query statements that correspond to the unique identifier of the statement as the graph data query statements to be configured.
[0087] The configuration module is used to configure the query statement for the graph data to be configured using the statement configuration parameters.
[0088] In some specific embodiments, the target graph data query statement determination module 13 may specifically include:
[0089] The data presentation method determination module is used to determine the data presentation method based on business requirements;
[0090] The data presentation module is used to present data information containing the target graph data query statement to the client according to the data presentation method.
[0091] Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the graph data query statement determination method executed by the electronic device as disclosed in any of the foregoing embodiments.
[0092] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0093] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored on it include operating system 221, computer program 222 and data 223, etc., and the storage method can be temporary storage or permanent storage.
[0094] The operating system 221 manages and controls the various hardware devices on the electronic device 20 and the computer program 222 to enable the processor 21 to perform calculations and processing on the data 223 in the memory 22. The operating system 221 can be Windows, Unix, Linux, etc. The computer program 222, in addition to including a computer program capable of performing the graph data query statement determination method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data 223 may include data received by the graph data query statement determination device from external devices, and may also include data collected by its own input / output interface 25.
[0095] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0096] Furthermore, embodiments of this application also disclose a computer-readable storage medium storing a computer program. When the computer program is loaded and executed by a processor, it implements the steps of the graph data query statement determination method disclosed in any of the foregoing embodiments.
[0097] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0098] The foregoing has provided a detailed description of a method, apparatus, device, and storage medium for determining graph data query statements provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for determining a graph data query statement, characterized in that, include: Obtain graph data query information and determine whether the graph data query information is valid; If the graph data query information is valid, then graph data query statements are selected from the locally preset graph data query statement library based on the graph data query information; Obtain statement query configuration information, determine the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configure the graph data query statement to be configured according to the statement query configuration information to obtain the target graph data query statement; The validity checks include: entity validity checks, edge validity checks, associated edge validity checks, filter validity checks, pagination validity checks, and placeholder parameter validity checks. The process of obtaining statement query configuration information includes: obtaining statement query configuration information through a preset information acquisition interface or hypertext transfer protocol interface; and determining the statement unique identifier and statement configuration parameters from the statement query configuration information. The step of determining the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configuring the graph data query statement to be configured according to the statement query configuration information, includes: selecting the graph data query statement corresponding to the statement unique identifier from the graph data query statements as the graph data query statement to be configured; and configuring the graph data query statement to be configured using the statement configuration parameters.
2. The method for determining graph data query statements according to claim 1, characterized in that, The process of obtaining graph data query information includes: Obtain the graph data query information sent by the client, which contains a JSON-formatted string; The graph data query information, which contains a JSON format string, is saved to a local preset database.
3. The method for determining graph data query statements according to claim 1, characterized in that, The determination of whether the graph data query information is valid includes: Based on the graph data query information, the target judgment rule is determined from all preset judgment rules; The validity of the graph data query information is determined based on the target judgment rules.
4. The method for determining graph data query statements according to claim 1, characterized in that, The step of selecting graph data query statements from a locally preset graph data query statement library based on the graph data query information includes: Execute the local preset mapping program; Using the mapping program and based on the graph data query information, the graph data query statement corresponding to the graph data query information is retrieved from the local graph data query statement library.
5. The method for determining graph data query statements according to any one of claims 1 to 4, characterized in that, After obtaining the target graph data query statement, the process also includes: The data presentation method is determined based on business needs; The data information containing the target graph data query statement will be presented to the client according to the data presentation method described above.
6. A device for determining graph data query statements, characterized in that, include: The judgment module is used to obtain graph data query information and determine whether the graph data query information is valid; The query statement filtering module is used to filter out graph data query statements from a locally preset graph data query statement library based on the graph data query information if the graph data query information is valid. The target graph data query statement determination module is used to obtain statement query configuration information, determine the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configure the graph data query statement to be configured according to the statement query configuration information to obtain the target graph data query statement. The validity checks include: entity validity checks, edge validity checks, associated edge validity checks, filter validity checks, pagination validity checks, and placeholder parameter validity checks. The process of obtaining statement query configuration information includes: obtaining statement query configuration information through a preset information acquisition interface or hypertext transfer protocol interface; and determining the statement unique identifier and statement configuration parameters from the statement query configuration information. The step of determining the graph data query statement to be configured from the graph data query statements based on the statement query configuration information, and configuring the graph data query statement to be configured according to the statement query configuration information, includes: selecting the graph data query statement corresponding to the statement unique identifier from the graph data query statements as the graph data query statement to be configured; and configuring the graph data query statement to be configured using the statement configuration parameters.
7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the graph data query statement determination method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer program is executed by a processor, it implements the graph data query statement determination method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data query method and device based on configuration information
CN110019350A
Data query method and device
CN112163000A