Query instruction execution method and device for financial risk control graph database suitable for bilingual syntax, equipment and medium

By integrating Cypher and GQL syntax rules into a unified processing method, the semantic discrepancies and high maintenance costs associated with dual syntax support in financial risk control operations have been resolved. This has enabled automatic differentiation and unified parsing of multi-syntax queries, improving the versatility and stability of query parsing.

CN123030786APending Publication Date: 2026-11-03SICHUAN SHUTIANMENGTU DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611403562.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-10
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

In financial risk control operations, how can we simultaneously support both Cypher and GQL syntax requirements while avoiding semantic discrepancies and excessively high maintenance costs for the parsing process?

Method used

By integrating the syntax rules of Cypher and GQL, and adopting a unified approach to word segmentation, syntax matching, and abstract syntax tree construction, we can achieve unified processing of query commands, avoiding information loss and repetitive parsing logic caused by syntax translation.

Benefits of technology

It achieves compatibility with both Cypher and GQL syntax within the same processing chain, reducing maintenance costs, improving the universality and stability of query parsing, and avoiding semantic bias and parsing failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123030786A_ABST
    Figure CN123030786A_ABST
Patent Text Reader

Abstract

The application discloses a query instruction execution method and device of a financial risk control graph database suitable for a bilingual grammar, equipment and a medium, relates to the technical field of graph database query, and comprises the following steps: performing word segmentation on a query text after the financial risk control graph database receives a risk control business query instruction; the grammar type of the query text is a first grammar type or a second grammar type; the word segmentation result is matched according to a shunting path matching rule in a preset grammar matching rule; the preset grammar matching rule is a unified rule obtained by integrating grammar rules corresponding to the respective grammar types; based on the target shunting path matched with the target grammar type represented by the matching result and the word segmentation result, the word segmentation result is shunted to a target area preconfigured with a grammar rule corresponding to the target grammar type; the grammar structure of the word segmentation result is recognized by using the grammar rule on the target area; and the word segmentation result is converted into an abstract syntax tree according to the recognition result, so as to execute the risk control business query instruction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of graph database query technology, and in particular to a query instruction execution method, apparatus, device, and medium applicable to bigrammatical financial risk control graph databases. Background Technology

[0002] In the field of financial risk control graph database queries, the two most common graph query languages ​​are Cypher (declarative graph query language) and GQL (Graph Query Language). Cypher was introduced earlier and has a larger market user base, while GQL is the official international standard in the graph query field and the latest international standard. Currently, financial risk control graph databases often need to serve both types of users simultaneously: existing Cypher users and new users who wish to adopt standard GQL. Taking the enterprise graph construction practice of a securities company as an example, the institution initially built enterprise graphs and industry chain graphs based on the industry-standard Cypher syntax, stored them in a graph database, and accumulated a large number of Cypher statements in its financial risk control business. Subsequently, due to various needs, the institution migrated its graph platform to a new graph database product. During the migration, the original view query service and dedicated resource service still relied on existing Cypher statements, and some business code could be directly reused; at the same time, newly built related modules required the use of standard GQL syntax. Therefore, the same set of graph data and the same financial risk control query entry point had to simultaneously receive both types of statements. If the system rewrites one syntax into another before execution, it is easy to lose semantic details such as type constraints, schema definitions, sessions, and filtering in GQL, resulting in a deviation between the investigation results and the original statement intent. If a separate parsing and tree-building link is maintained for each of the two syntaxes, the same shareholder penetration query cannot reuse subsequent optimization and execution capabilities under the two writing methods, and the maintenance cost rises rapidly with the increase of financial risk control business rules.

[0003] In summary, how to avoid semantic discrepancies and excessively high maintenance costs of parsing links caused by dual-syntax support when financial risk control business has dual-syntax requirements is an urgent problem that needs to be solved. Summary of the Invention

[0004] In view of this, the purpose of this invention is to provide a query instruction execution method, apparatus, device, and medium suitable for bi-syntax financial risk control graph databases, which can avoid the semantic discrepancies and excessively high maintenance costs of parsing links caused by bi-syntax support when financial risk control business has bi-syntax requirements. The specific solution is as follows: Firstly, this application provides a query instruction execution method applicable to a bilingual financial risk control graph database, including: After receiving a risk control business query instruction from the financial risk control graph database, the risk control business query text corresponding to the risk control business query instruction is segmented into words to obtain the corresponding segmentation results; the syntax type of the risk control business query text is either the first syntax type or the second syntax type. The word segmentation results are subjected to grammatical matching according to the flow path matching rules in the preset grammatical matching rules to obtain the corresponding matching results; the preset grammatical matching rules are unified grammatical matching rules obtained by integrating the grammatical rules corresponding to the first grammatical type and the second grammatical type respectively. Based on the target routing path that matches the target grammar type of the word segmentation result as represented by the matching result, the word segmentation result is routed to a target region that is pre-configured with grammar rules corresponding to the target grammar type; wherein, the target routing path includes a first routing path and a second routing path, the first routing path is a routing path corresponding to a first grammar type, and the second routing path is a routing path corresponding to a second grammar type; Using the grammar rules on the target region that correspond to the target grammar type, the grammar structure of each lexical unit in the obtained word segmentation result is identified to obtain the corresponding identification result; The word segmentation results are converted into an abstract syntax tree based on the recognition results, so that the risk control business query instruction can be executed on the financial risk control graph database based on the abstract syntax tree.

[0005] Optionally, the step of performing word segmentation on the risk control business query text corresponding to the risk control business query instruction to obtain the corresponding word segmentation results includes: The risk control business query text corresponding to the risk control business query instruction is segmented using preset lexical rules to obtain the corresponding segmentation results; The preset lexical rules are lexical rules obtained by adding the keyword and terminal symbol rules corresponding to the second grammar type to the lexical units of the first grammar type.

[0006] Optionally, the step of performing grammatical matching on the word segmentation results according to the traffic path matching rules in the preset grammatical matching rules to obtain the corresponding matching results includes: Based on the traffic splitting path matching rules in the preset syntax matching rules, the target syntax type corresponding to the word segmentation result is determined, and the target traffic splitting path matching the target syntax type is determined; The traffic splitting path matching rule is used to determine the first traffic splitting path that matches the first syntax type and to determine the second traffic splitting path that matches the second syntax type.

[0007] Optionally, the step of using the grammatical rules corresponding to the target grammatical type on the target region to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result includes: Using the management-type statement rules and query-type statement rules on the target region that correspond to the target syntax type, the grammatical structure of each lexical unit in the obtained word segmentation result is identified; The management statement rules include a first management statement rule and a second management statement rule. The first management statement rule is a management statement rule corresponding to the first syntax type, and the second management statement rule is a management statement rule corresponding to the second syntax type. The query statement rules include a first query statement rule and a second query statement rule. The first query statement rule is a query statement rule corresponding to the first syntax type, and the second query statement rule is a query statement rule corresponding to the second syntax type.

[0008] Optionally, the step of using management-type statement rules and query-type statement rules corresponding to the target syntax type on the target region to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result includes: If the target syntax type is the first syntax type, then the first management class statement rule and the first query class statement rule corresponding to the first syntax type on the target region are used to identify the syntax structure of each lexical unit in the obtained word segmentation result. If the target syntax type is the second syntax type, then the second management statement rule and the second query statement rule corresponding to the second syntax type on the target region are used to identify the syntax structure of each lexical unit in the obtained word segmentation result; The second management statement rule is stored in the preset syntax matching rules by incorporating it into the management statement rule block corresponding to the second syntax type, and coexists with the first management statement rule and the first query statement rule. The management statement rule block is determined based on the syntax specification of the second syntax type. The second query statement rule is stored in the preset syntax matching rules by extending the first query statement rule. The extension method of the first query statement rule is to add a query statement matching branch for the declarative primitive of the second syntax type in the first query statement rule.

[0009] Optionally, the step of using the grammatical rules corresponding to the target grammatical type on the target region to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result further includes: The grammatical structure of each lexical unit in the obtained word segmentation results is identified using common query class statement rules; The common query statement rules are stored in the preset syntax matching rules by incorporating the target syntax component pairs into the same query statement rule; the target syntax component pairs are composed of the first syntax component in the syntax rule corresponding to the first syntax type and the second syntax component in the syntax rule corresponding to the second syntax type; the semantic functions of the first syntax component and the second syntax component satisfy the preset similarity condition, and their syntax forms are different from each other.

[0010] Optionally, converting the word segmentation result into an abstract syntax tree based on the recognition result includes: Based on the recognition results, generate corresponding abstract syntax tree nodes for each lexical unit in the word segmentation results; Organize the abstract syntax tree nodes into an abstract syntax tree; The abstract syntax tree representation structure of the first syntax type is consistent with the abstract syntax tree representation structure of the second syntax type.

[0011] Secondly, this application provides a query instruction execution device suitable for a bilingual financial risk control graph database, comprising: The word segmentation module is used to segment the risk control business query text corresponding to the risk control business query instruction after receiving the risk control business query instruction from the financial risk control graph database, so as to obtain the corresponding word segmentation result; the syntax type of the risk control business query text is either the first syntax type or the second syntax type. The syntax matching module is used to perform syntax matching on the word segmentation results according to the flow path matching rules in the preset syntax matching rules to obtain the corresponding matching results; the preset syntax matching rules are unified syntax matching rules obtained by integrating the syntax rules corresponding to the first syntax type and the second syntax type respectively. The result splitting module is used to split the word segmentation result into a target region with pre-configured grammar rules corresponding to the target grammar type based on the target splitting path represented by the matching result and the target splitting path that matches the target grammar type of the word segmentation result; wherein, the target splitting path includes a first splitting path and a second splitting path, the first splitting path is a splitting path corresponding to a first grammar type, and the second splitting path is a splitting path corresponding to a second grammar type; The structure recognition module is used to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result by using the grammatical rules on the target region that correspond to the target grammatical type, and to obtain the corresponding recognition result; The result conversion module is used to convert the word segmentation result into an abstract syntax tree based on the recognition result, so as to execute the risk control business query instruction for the financial risk control graph database based on the abstract syntax tree.

[0012] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor is configured to execute the computer program to implement the aforementioned query instruction execution method applicable to a bi-syntax financial risk control graph database.

[0013] Fourthly, this application provides a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned query instruction execution method applicable to a bisyntax financial risk control graph database.

[0014] In this application, after the financial risk control graph database receives a risk control business query instruction, the risk control business query text corresponding to the instruction is segmented into words to obtain corresponding segmentation results. The syntax type of the risk control business query text is either a first syntax type or a second syntax type. The segmentation results are then matched according to the traffic distribution path matching rules in the preset syntax matching rules to obtain corresponding matching results. The preset syntax matching rules are unified syntax matching rules obtained by integrating the syntax rules corresponding to the first syntax type and the second syntax type. Based on the target traffic distribution path that matches the target syntax type of the segmentation results as represented by the matching results, the... The word segmentation results are routed to target regions pre-configured with grammar rules corresponding to the target grammar type; wherein, the target route includes a first route and a second route, the first route being a route corresponding to a first grammar type, and the second route being a route corresponding to a second grammar type; using the grammar rules corresponding to the target grammar type on the target region, the grammatical structure of each lexical unit in the obtained word segmentation results is identified to obtain corresponding identification results; based on the identification results, the word segmentation results are converted into an abstract syntax tree so that the risk control business query instruction can be executed on the financial risk control graph database based on the abstract syntax tree. As can be seen from the above, after receiving a risk control business query instruction from the financial risk control graph database, this application performs word segmentation on the corresponding risk control business query text to obtain word segmentation results. The risk control business query text may belong to a first grammar type or a second grammar type. Using the traffic distribution path matching rule in the preset grammar matching rule that integrates the grammar rules corresponding to the first grammar type and the second grammar type, the word segmentation results are grammatically matched. According to the target traffic distribution path obtained by matching, the word segmentation results are distributed to the target area carrying the corresponding grammar rule. The grammar rules that are adapted to the target grammar type in the target area are called to perform grammar structure recognition of the lexical unit to obtain recognition results. According to the recognition results, the word segmentation results are transformed into an abstract syntax tree. Based on the generated abstract syntax tree, the risk control business query instruction is executed on the financial risk control graph database.In this way, through the process described above in this application, the grammar rules corresponding to the first and second grammar types are integrated into the preset grammar matching rules, which can simultaneously accommodate query texts of two different grammar types without maintaining independent parsing logic for different grammars, thus reducing the development and maintenance overhead of the parsing module; based on the traffic splitting path matching rules, the grammar type is determined and routed to the corresponding target region. The path splitting can be automatically completed according to the query grammar characteristics, achieving automatic differentiation between the two types of grammar queries without requiring the business side to pre-specify the grammar type; the word segmentation results of different grammars are distributed to the target regions configured with the corresponding grammar rules to perform structure recognition, enabling different grammar types to be matched. Lexical units can be parsed by dedicated rules, avoiding interference between rules in different syntaxes and reducing parsing errors. After the structural recognition of lexical units is completed, an abstract syntax tree is constructed, which unifies the risk control queries with different syntax expressions into an intermediate tree structure that can be executed by the graph database. This allows the financial risk control graph database to only need to perform query execution on the abstract syntax tree, and can uniformly parse and execute risk control business query commands of multiple syntax types. This improves the universality of the risk control query parsing process, reduces the problem of query parsing failure due to incompatible syntax formats, and avoids the semantic deviation and excessively high maintenance cost of the parsing link caused by dual syntax support when financial risk control business has dual syntax requirements. Attached Figure Description

[0015] 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.

[0016] Figure 1 This application discloses a flowchart of a query instruction execution method for a bilingual financial risk control graph database. Figure 2 This is a schematic diagram of the structure of a query instruction execution device for a bilingual financial risk control graph database disclosed in this application; Figure 3 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation

[0017] 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.

[0018] Current financial risk control graph databases often need to serve two types of users simultaneously: existing Cypher users and new users who want to adopt standard GQL. Taking a securities company's enterprise graph construction practice as an example, the institution initially built enterprise and industry chain graphs based on the industry-standard Cypher syntax, stored them in a graph database, and accumulated a large number of Cypher statements in its financial risk control business. Subsequently, due to various needs, the institution migrated its graph platform to a new graph database product. During the migration, the original view query service and dedicated resource service still relied on existing Cypher statements, and some business code could be directly reused; at the same time, newly built related modules required the use of standard GQL syntax. Therefore, the same set of graph data and the same financial risk control query entry point had to simultaneously receive both types of statements. If the system rewrites one syntax into another before execution, it is easy to lose semantic details such as type constraints, schema definitions, sessions, and filtering in GQL, resulting in a deviation between the investigation results and the original statement intent. If a separate parsing and tree-building link is maintained for each of the two syntaxes, the same shareholder penetration query cannot reuse subsequent optimization and execution capabilities under the two writing methods, and the maintenance cost rises rapidly with the increase of financial risk control business rules.

[0019] To overcome the aforementioned technical problems, this application provides a query instruction execution method applicable to bi-syntax financial risk control graph databases, which can avoid the semantic deviation and excessively high maintenance costs of parsing links caused by bi-syntax support when there are bi-syntax requirements in financial risk control business.

[0020] See Figure 1 As shown, this embodiment of the invention discloses a query instruction execution method applicable to a bilingual financial risk control graph database, including: Step S11: After receiving the risk control business query instruction in the financial risk control graph database, the risk control business query text corresponding to the risk control business query instruction is segmented into words to obtain the corresponding segmentation results; the syntax type of the risk control business query text is either the first syntax type or the second syntax type.

[0021] In this embodiment, after receiving a risk control business query instruction, the financial risk control graph database performs word segmentation on the corresponding risk control business query text to obtain the segmentation result. It should be noted that the syntax type of the risk control business query text can belong to either a first syntax type or a second syntax type. Specifically, the first syntax type is Cypher; the second syntax type is GQL.

[0022] It should be noted that in the current database field, user-input query text is typically processed by a syntax parsing module, which sequentially performs word segmentation, syntax matching, and conversion into an Abstract Syntax Tree (AST). The AST preserves the compositional relationships and semantic skeleton of the statement in a tree-like data structure for subsequent semantic checks, optimization, and execution. In the above processing flow, if two types of syntax rules need to be supported simultaneously, existing technologies suffer from semantic fragmentation and high maintenance costs. To allow both Cypher and GQL syntaxes to be naturally integrated into the same graph database parsing and execution chain, and to enter a unified AST and subsequent processing flow without losing key semantics, thereby avoiding parallel operation of two systems and semantic fragmentation, this application proposes a query instruction execution method suitable for dual-syntax financial risk control graph databases. Improvements are made to the three stages of the general processing flow, forming a unified word segmentation processing, unified syntax matching, and unified AST construction dual-syntax processing method and architecture. This allows for unified reception and processing of Cypher and GQL within the same processing chain, reducing redundant implementation while maintaining their respective semantic capabilities, thus limiting the problem to the core scope of syntax parsing and AST construction. It should be noted that the query instruction execution method for bigrammatical financial risk control graph databases proposed in this application can be applied not only to the field of financial risk control, but also to other fields with graph database query requirements and two syntaxes, such as social network data analysis and network security attack and defense tracing. The query instruction execution architecture of this application can be adapted and migrated.

[0023] It should be noted that the process of segmenting the risk control business query text corresponding to the risk control business query instruction is as follows: The risk control business query text corresponding to the risk control business query instruction is segmented using preset lexical rules to obtain the corresponding segmentation results. The preset lexical rules are obtained by adding keyword and terminal symbol rules corresponding to the second grammar type to the lexical units of the first grammar type. That is, after receiving the query text, the system no longer pre-splitting or translating according to the grammar type, but instead uses the same grammar parsing module to complete the segmentation, dividing the entire query text into several basic units, such as keywords, identifiers, and operators, for subsequent segment-by-segment recognition and processing. The differences between the two grammars are not processed at the input stage, but are left to be handled in the subsequent grammar matching stage, thereby avoiding information loss caused by translating first and then segmenting. It is understandable that a unified lexical approach is needed to achieve unified segmentation of both grammars. Specifically, based on the original Cypher lexical units, the keyword and terminal symbol rules required by GQL (such as session, pattern, binding table, filtering, etc.) are added. In this way, this embodiment does not rely on the transitional solution of translating first and then processing. Instead, it uses a unified AST as the core goal to achieve native dual-syntax access, improve semantic consistency, and reduce information deviation caused by cross-syntax translation. Based on the lexical unit of the first syntactic type, it expands the second syntactic type keywords and terminal symbols to construct preset lexical rules. One set of lexical rules can simultaneously adapt to the lexical parsing of two types of syntactics, without the need to maintain two independent lexical parsing logics, thus reducing the maintenance overhead of the lexical layer code.

[0024] Step S12: Perform grammatical matching on the word segmentation results according to the flow path matching rules in the preset grammatical matching rules to obtain the corresponding matching results; the preset grammatical matching rules are unified grammatical matching rules obtained by integrating the grammatical rules corresponding to the first grammatical type and the second grammatical type respectively.

[0025] In this embodiment, the word segmentation results are grammatically matched using the flow path matching rules within the preset grammar matching rules. The word segmentation results are compared with the predefined grammar rules to determine whether the combination of each segment conforms to the syntax of the query language, thus obtaining the matching result. The preset grammar matching rules are unified grammar matching rules obtained by integrating the grammar rules of the first and second grammar types, that is, by incorporating the GQL international standard grammar rules into the existing Cypher grammar matching specification to form a unified grammar matching rule.

[0026] Specifically, based on the flow path matching rules in the preset grammar matching rules, the target grammar type corresponding to the segmentation result is determined, and the target flow path matching the target grammar type is determined. The flow path matching rules are used to determine the first flow path matching the first grammar type and the second flow path matching the second grammar type. That is, structural identification and flow separation of two types of grammar are completed on the same segmentation result. Using the flow path matching rules of the preset grammar matching rules, the target grammar type corresponding to the segmentation result is determined, thereby determining the target flow path adapted to the target grammar type. The flow path matching rules can respectively determine the first and second flow paths corresponding to the first and second grammar types. It can be understood that, in order to achieve entry flow separation, this embodiment sets the Cypher query entry (first flow path) and the GQL program entry (second flow path) in parallel in the top-level entry rule of the statement, so that the parser can distinguish the statement type in the early stage of matching without first translating the entire sentence. In this way, this embodiment integrates two types of grammar rules to obtain a unified preset grammar matching rule, and then uses its internal flow path matching rule to complete the word segmentation result matching. It can complete grammar discrimination within the same parsing framework without switching between different parsing frameworks, and realize unified access for multi-grammar queries.

[0027] Step S13: Based on the target flow path that matches the target grammar type of the word segmentation result as represented by the matching result, the word segmentation result is flowed to a target region that is pre-configured with grammar rules corresponding to the target grammar type; wherein, the target flow path includes a first flow path and a second flow path, the first flow path is a flow path corresponding to the first grammar type, and the second flow path is a flow path corresponding to the second grammar type.

[0028] In this embodiment, based on the target routing path corresponding to the target grammar type of the word segmentation result as represented by the matching result, the word segmentation result is routed to the target region configured with the grammar rules corresponding to the target grammar type. The target routing path includes a first routing path adapted to the first grammar type and a second routing path adapted to the second grammar type. In this way, this embodiment utilizes the target routing path to route the word segmentation result to the target region equipped with the corresponding grammar rules, transforming dual grammar support from two parallel implementations to a unified foundation combined with entry-level routing architecture. This achieves structural complexity reduction, lowers development and maintenance costs, and reduces the burden of duplicate code and dual-track evolution.

[0029] Step S14: Using the grammar rules on the target region corresponding to the target grammar type, perform grammatical structure recognition on each lexical unit in the obtained word segmentation result to obtain the corresponding recognition result.

[0030] In this embodiment, the grammar rules that match the target grammar type within the target region are invoked, and grammar structure recognition is performed on each lexical unit of the word segmentation result, and the recognition result is output.

[0031] Specifically, the grammatical structure of each lexical unit in the obtained word segmentation result is identified using the management-type statement rules and query-type statement rules corresponding to the target grammar type in the target region. The management-type statement rules include a first management-type statement rule and a second management-type statement rule, where the first management-type statement rule corresponds to the first grammar type, and the second management-type statement rule corresponds to the second grammar type. The query-type statement rules include a first query-type statement rule and a second query-type statement rule, where the first query-type statement rule corresponds to the first grammar type, and the second query-type statement rule corresponds to the second grammar type. That is, the grammatical structure of each lexical unit is identified in the target region using the management-type statement rules and query-type statement rules corresponding to the target grammar type. The management-type statement rules include first and second management-type statement rules adapted to the two grammar types respectively, and the query-type statement rules include first and second query-type statement rules adapted to the two grammar types respectively.

[0032] Furthermore, if the target grammar type is the first grammar type, then the first management-type statement rule and the first query-type statement rule corresponding to the first grammar type on the target region are used to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result; if the target grammar type is the second grammar type, then the second management-type statement rule and the second query-type statement rule corresponding to the second grammar type on the target region are used to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result; wherein, the second management-type statement rule is stored in the preset grammar matching rule by incorporating it into the management-type statement rule block corresponding to the second grammar type, and coexists with the first management-type statement rule and the first query-type statement rule; the management-type statement rule block is determined based on the grammar specification of the second grammar type; the second query-type statement rule is stored in the preset grammar matching rule by extending the first query-type statement rule; the extension method of the first query-type statement rule is to add a query-type statement matching branch for the declarative primitive of the second grammar type in the first query-type statement rule. That is, when the target syntax type is the first syntax type, the first management class and the first query class statement rules are used to parse the lexical units; when the target syntax type is the second syntax type, the second management class and the second query class statement rules are used to parse. It is understood that, in order to achieve the aforementioned unified syntax structure recognition operation, this embodiment can perform the following processing: Incorporating GQL standard syntax rule blocks. Using the GQL syntax specification as the source, rules (management class statement rule blocks) such as program activities, session management, transaction control, and directory changes (e.g., graph creation, graph deletion, graph type and schema definition) are incorporated into the same matching rule (management class statement rule), coexisting with Cypher's original management command rules (first management class statement rules) and query command rules (first query class statement rules); Expanding Cypher's query clause matching capabilities (first query class statement rules). In the clause rules of a single Cypher query, a matching branch for GQL declarative primitives (such as variable binding, traversal, filtering, result return, etc.) is added, enabling the key query components of both syntax types to be identified in the same query chain.

[0033] It should be noted that the processing flow for grammatical structure recognition can also be as follows: Using common query class statement rules, grammatical structure recognition is performed on each lexical unit in the obtained word segmentation results; wherein, the common query class statement rules are stored in the preset grammatical matching rules by incorporating target grammatical component pairs into the same query class statement rule; the target grammatical component pair consists of a first grammatical component in the grammatical rule corresponding to the first grammatical type and a second grammatical component in the grammatical rule corresponding to the second grammatical type; the semantic functions of the first grammatical component and the second grammatical component satisfy preset similarity conditions, and their grammatical forms are different. That is, grammatical structure recognition of lexical units is completed using common query class statement rules. The common query class statement rules are incorporated into the construction of target grammatical component pairs, which consist of first and second grammatical components with similar semantic functions but different grammatical forms. This involves establishing a matching bridge for synonymous structures, connecting components with similar functions but different syntaxes at the rule level. For example, Cypher's conditional filtering syntax and GQL's FILTER filtering syntax can be incorporated into the same conditional matching rule. GQL parameters, variables, expressions, and other components can be reused and connected with existing Cypher matching rules, avoiding the need to define multiple sets of rules for similar semantics. In this way, this embodiment integrates the international standard GQL syntax rules into the existing Cypher syntax matching specification. The syntax matching stage no longer maintains two separate syntax files, nor does it rewrite one syntax entirely into another before matching. Instead, both types of syntax complete structural identification according to their native rules within a unified specification. Through a unified semantic state mechanism, the common capabilities of the two syntaxes in terms of type, scope, and semantic checking are deposited as reusable assets, improving product portability and scalability, and facilitating the parallel use of existing Cypher and incremental GQL on the same platform.

[0034] Step S15: Convert the word segmentation result into an abstract syntax tree based on the recognition result, so as to execute the risk control business query instruction for the financial risk control graph database based on the abstract syntax tree.

[0035] In this embodiment, after the syntax matching is successful, the word segmentation result is transformed into an abstract syntax tree based on the recognition result, and then the risk control business query instruction is executed in the financial risk control graph database based on the abstract syntax tree.

[0036] It should be noted that the process of converting the word segmentation result into an abstract syntax tree based on the recognition result is as follows: Based on the recognition result, generate corresponding abstract syntax tree nodes for each lexical unit in the word segmentation result; organize the abstract syntax tree nodes into an abstract syntax tree; wherein, the abstract syntax tree representation structure of the first syntax type is consistent with the abstract syntax tree representation structure of the second syntax type. That is, generate abstract syntax tree nodes for each lexical unit of the word segmentation result based on the recognition result, and organize them into an abstract syntax tree according to a hierarchical structure. It should be further noted that the abstract syntax tree representation structures output by the first syntax type and the second syntax type are consistent. That is, establish a unified AST carrying system. Regardless of the syntax from which the statement comes, it is ultimately constructed into the same set of abstract syntax tree representation structures, ensuring that subsequent semantic checks, optimizations, and execution face the same type of tree-shaped input; syntactic differences are limited to the entry recognition and local node construction stages, and general semantic information is connected in a unified tree structure, facilitating the reuse of the same processing capabilities by subsequent modules. In this way, this embodiment constructs a unified abstract syntax tree, providing a unified input basis for subsequent backend capabilities such as optimizers and execution plans, thereby enhancing the overall system stability and evolution efficiency.

[0037] As can be seen from the above, after receiving a risk control business query instruction from the financial risk control graph database, this application embodiment performs word segmentation on the corresponding risk control business query text to obtain word segmentation results. The risk control business query text may belong to a first grammar type or a second grammar type. Using the traffic distribution path matching rule in the preset grammar matching rule that integrates the grammar rules corresponding to the first grammar type and the second grammar type, the word segmentation results are grammatically matched. According to the target traffic distribution path obtained by matching, the word segmentation results are distributed to the target area carrying the corresponding grammar rules. The grammar rules that are adapted to the target grammar type in the target area are called to perform grammar structure recognition of the lexical unit to obtain recognition results. According to the recognition results, the word segmentation results are converted into an abstract syntax tree. Based on the generated abstract syntax tree, the risk control business query instruction is executed on the financial risk control graph database. In this way, through the above process of the embodiments of this application, the grammar rules corresponding to the first grammar type and the second grammar type are integrated into the preset grammar matching rules, which can simultaneously accommodate query text of two different grammar types without maintaining independent parsing logic for different grammars, reducing the development and maintenance overhead of the parsing module; based on the traffic splitting path matching rules, the grammar type is determined and routed to the corresponding target area, and the path splitting can be automatically completed according to the query grammar characteristics, realizing the automatic differentiation of the two types of grammar queries without the business side needing to pre-specify the grammar type; the word segmentation results of different grammars are distributed to the target area configured with the corresponding grammar rules to perform structure recognition, so that different grammar types The lexical units can be parsed by dedicated rules, avoiding interference between rules in different syntaxes and reducing parsing errors. After the structural recognition of the lexical units is completed, an abstract syntax tree is constructed, which unifies the risk control queries of different syntax forms into an intermediate tree structure that can be executed by the graph database. This allows the financial risk control graph database to only need to perform query execution on the abstract syntax tree, and can uniformly parse and execute risk control business query commands of multiple syntax types. This improves the universality of the risk control query parsing process, reduces the problem of query parsing failure due to incompatible syntax formats, and avoids the semantic deviation and excessively high maintenance cost of the parsing link caused by dual syntax support when there are dual syntax requirements in financial risk control business.

[0038] Accordingly, see Figure 2 As shown in the embodiment of this application, a query instruction execution device suitable for a bilingual financial risk control graph database is also provided, including: The word segmentation module 11 is used to segment the risk control business query text corresponding to the risk control business query instruction after receiving the risk control business query instruction from the financial risk control graph database, so as to obtain the corresponding word segmentation result; the syntax type of the risk control business query text is either a first syntax type or a second syntax type. The syntax matching module 12 is used to perform syntax matching on the word segmentation results according to the flow path matching rules in the preset syntax matching rules to obtain the corresponding matching results; the preset syntax matching rules are unified syntax matching rules obtained by integrating the syntax rules corresponding to the first syntax type and the second syntax type respectively. The result splitting module 13 is used to split the word segmentation result into a target region with pre-configured grammar rules corresponding to the target grammar type based on the target splitting path represented by the matching result and the target splitting path that matches the target grammar type of the word segmentation result; wherein, the target splitting path includes a first splitting path and a second splitting path, the first splitting path is a splitting path corresponding to a first grammar type, and the second splitting path is a splitting path corresponding to a second grammar type; The structure recognition module 14 is used to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result by using the grammatical rules on the target region that correspond to the target grammatical type, and to obtain the corresponding recognition result; The result conversion module 15 is used to convert the word segmentation result into an abstract syntax tree based on the recognition result, so as to execute the risk control business query instruction for the financial risk control graph database based on the abstract syntax tree.

[0039] In some specific embodiments, the word segmentation processing module 11 may specifically include: The syntax analysis unit is used to perform word segmentation on the risk control business query text corresponding to the risk control business query instruction using preset lexical rules, and obtain the corresponding word segmentation results; The preset lexical rules are lexical rules obtained by adding the keyword and terminal symbol rules corresponding to the second grammar type to the lexical units of the first grammar type.

[0040] In some specific embodiments, the syntax matching module 12 may specifically include: The path determination unit is used to determine the target grammar type corresponding to the word segmentation result according to the traffic splitting path matching rule in the preset grammar matching rule, and to determine the target traffic splitting path that matches the target grammar type; The traffic splitting path matching rule is used to determine the first traffic splitting path that matches the first syntax type and to determine the second traffic splitting path that matches the second syntax type.

[0041] In some specific embodiments, the structure recognition module 14 may specifically include: The structure recognition submodule is used to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result by utilizing the management-type statement rules and query-type statement rules on the target region that correspond to the target grammatical type. The management statement rules include a first management statement rule and a second management statement rule. The first management statement rule is a management statement rule corresponding to the first syntax type, and the second management statement rule is a management statement rule corresponding to the second syntax type. The query statement rules include a first query statement rule and a second query statement rule. The first query statement rule is a query statement rule corresponding to the first syntax type, and the second query statement rule is a query statement rule corresponding to the second syntax type.

[0042] In some specific embodiments, the structure recognition submodule may specifically include: The first structure recognition unit is used to identify the grammatical structure of each lexical unit in the obtained word segmentation result by using the first management class statement rule and the first query class statement rule corresponding to the first grammatical type on the target region if the target grammatical type is the first grammatical type. The second structure recognition unit is used to identify the grammatical structure of each lexical unit in the obtained word segmentation result by using the second management class statement rule and the second query class statement rule on the target region corresponding to the second grammatical type if the target grammatical type is the second grammatical type. The second management statement rule is stored in the preset syntax matching rules by incorporating it into the management statement rule block corresponding to the second syntax type, and coexists with the first management statement rule and the first query statement rule. The management statement rule block is determined based on the syntax specification of the second syntax type. The second query statement rule is stored in the preset syntax matching rules by extending the first query statement rule. The extension method of the first query statement rule is to add a query statement matching branch for the declarative primitive of the second syntax type in the first query statement rule.

[0043] In some specific embodiments, the structure recognition module 14 may further include: The third structure recognition unit is used to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result using common query class statement rules; The common query statement rules are stored in the preset syntax matching rules by incorporating the target syntax component pairs into the same query statement rule; the target syntax component pairs are composed of the first syntax component in the syntax rule corresponding to the first syntax type and the second syntax component in the syntax rule corresponding to the second syntax type; the semantic functions of the first syntax component and the second syntax component satisfy the preset similarity condition, and their syntax forms are different from each other.

[0044] In some specific embodiments, the result conversion module 15 may specifically include: A node generation unit is used to generate corresponding abstract syntax tree nodes for each lexical unit in the word segmentation result based on the recognition result. A node organization unit is used to organize the abstract syntax tree nodes into an abstract syntax tree; The abstract syntax tree representation structure of the first syntax type is consistent with the abstract syntax tree representation structure of the second syntax type.

[0045] Furthermore, embodiments of this application also disclose an electronic device, Figure 3 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope 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 query instruction execution method for a bilingual financial risk control graph database disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be a computer.

[0046] 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.

[0047] 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 thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0048] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of executing the query instruction execution method for a bilingual financial risk control graph database disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.

[0049] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned method for executing query instructions applicable to a bilingual financial risk control graph database. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

[0050] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0051] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0052] 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.

[0053] 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.

[0054] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A query instruction execution method applicable to a bilingual financial risk control graph database, characterized in that, include: After receiving a risk control business query instruction from the financial risk control graph database, the risk control business query text corresponding to the risk control business query instruction is segmented into words to obtain the corresponding segmentation results; the syntax type of the risk control business query text is either the first syntax type or the second syntax type. The word segmentation results are subjected to grammatical matching according to the flow path matching rules in the preset grammatical matching rules to obtain the corresponding matching results; the preset grammatical matching rules are unified grammatical matching rules obtained by integrating the grammatical rules corresponding to the first grammatical type and the second grammatical type respectively. Based on the target routing path that matches the target grammar type of the word segmentation result as represented by the matching result, the word segmentation result is routed to a target region that is pre-configured with grammar rules corresponding to the target grammar type; wherein, the target routing path includes a first routing path and a second routing path, the first routing path is a routing path corresponding to a first grammar type, and the second routing path is a routing path corresponding to a second grammar type; Using the grammar rules on the target region that correspond to the target grammar type, the grammar structure of each lexical unit in the obtained word segmentation result is identified to obtain the corresponding identification result; The word segmentation results are converted into an abstract syntax tree based on the recognition results, so that the risk control business query instruction can be executed on the financial risk control graph database based on the abstract syntax tree.

2. The query instruction execution method for a bilingual financial risk control graph database according to claim 1, characterized in that, The step of segmenting the risk control business query text corresponding to the risk control business query instruction into words to obtain the corresponding word segmentation results includes: The risk control business query text corresponding to the risk control business query instruction is segmented using preset lexical rules to obtain the corresponding segmentation results; The preset lexical rules are lexical rules obtained by adding the keyword and terminal symbol rules corresponding to the second grammar type to the lexical units of the first grammar type.

3. The query instruction execution method for a bilingual financial risk control graph database according to claim 1, characterized in that, The step of performing grammatical matching on the word segmentation results according to the traffic path matching rules in the preset grammatical matching rules to obtain the corresponding matching results includes: Based on the traffic splitting path matching rules in the preset syntax matching rules, the target syntax type corresponding to the word segmentation result is determined, and the target traffic splitting path matching the target syntax type is determined; The traffic splitting path matching rule is used to determine the first traffic splitting path that matches the first syntax type and to determine the second traffic splitting path that matches the second syntax type.

4. The query instruction execution method for a bilingual financial risk control graph database according to claim 1, characterized in that, The step of using the grammatical rules corresponding to the target grammatical type on the target region to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result includes: Using the management-type statement rules and query-type statement rules on the target region that correspond to the target syntax type, the grammatical structure of each lexical unit in the obtained word segmentation result is identified; The management statement rules include a first management statement rule and a second management statement rule. The first management statement rule is a management statement rule corresponding to the first syntax type, and the second management statement rule is a management statement rule corresponding to the second syntax type. The query statement rules include a first query statement rule and a second query statement rule. The first query statement rule is a query statement rule corresponding to the first syntax type, and the second query statement rule is a query statement rule corresponding to the second syntax type.

5. The query instruction execution method for a bilingual financial risk control graph database according to claim 4, characterized in that, The step of using management-type statement rules and query-type statement rules corresponding to the target syntax type on the target region to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result includes: If the target syntax type is the first syntax type, then the first management class statement rule and the first query class statement rule corresponding to the first syntax type on the target region are used to identify the syntax structure of each lexical unit in the obtained word segmentation result. If the target syntax type is the second syntax type, then the second management statement rule and the second query statement rule corresponding to the second syntax type on the target region are used to identify the syntax structure of each lexical unit in the obtained word segmentation result; The second management statement rule is stored in the preset syntax matching rules by incorporating it into the management statement rule block corresponding to the second syntax type, and coexists with the first management statement rule and the first query statement rule. The management statement rule block is determined based on the syntax specification of the second syntax type. The second query statement rule is stored in the preset syntax matching rules by extending the first query statement rule. The extension method of the first query statement rule is to add a query statement matching branch for the declarative primitive of the second syntax type in the first query statement rule.

6. The query instruction execution method for a bilingual financial risk control graph database according to claim 1, characterized in that, The step of using the grammatical rules corresponding to the target grammatical type on the target region to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result further includes: The grammatical structure of each lexical unit in the obtained word segmentation results is identified using common query class statement rules; The common query statement rules are stored in the preset syntax matching rules by incorporating the target syntax component pairs into the same query statement rule; the target syntax component pairs are composed of the first syntax component in the syntax rule corresponding to the first syntax type and the second syntax component in the syntax rule corresponding to the second syntax type; the semantic functions of the first syntax component and the second syntax component satisfy the preset similarity condition, and their syntax forms are different from each other.

7. The query instruction execution method for a bilingual financial risk control graph database according to any one of claims 1 to 6, characterized in that, The step of converting the word segmentation result into an abstract syntax tree based on the recognition result includes: Based on the recognition results, generate corresponding abstract syntax tree nodes for each lexical unit in the word segmentation results; Organize the abstract syntax tree nodes into an abstract syntax tree; The abstract syntax tree representation structure of the first syntax type is consistent with the abstract syntax tree representation structure of the second syntax type.

8. A query instruction execution device suitable for bilingual financial risk control graph databases, characterized in that, include: The word segmentation module is used to segment the risk control business query text corresponding to the risk control business query instruction after receiving the risk control business query instruction from the financial risk control graph database, so as to obtain the corresponding word segmentation result; the syntax type of the risk control business query text is either the first syntax type or the second syntax type. The syntax matching module is used to perform syntax matching on the word segmentation results according to the flow path matching rules in the preset syntax matching rules, so as to obtain the corresponding matching results; The preset syntax matching rule is a unified syntax matching rule obtained by integrating the syntax rules corresponding to the first syntax type and the second syntax type respectively. The result splitting module is used to split the word segmentation result into a target region with pre-configured grammar rules corresponding to the target grammar type based on the target splitting path represented by the matching result and the target splitting path that matches the target grammar type of the word segmentation result; wherein, the target splitting path includes a first splitting path and a second splitting path, the first splitting path is a splitting path corresponding to a first grammar type, and the second splitting path is a splitting path corresponding to a second grammar type; The structure recognition module is used to perform grammatical structure recognition on each lexical unit in the obtained word segmentation result by using the grammatical rules on the target region that correspond to the target grammatical type, and to obtain the corresponding recognition result; The result conversion module is used to convert the word segmentation result into an abstract syntax tree based on the recognition result, so as to execute the risk control business query instruction for the financial risk control graph database based on the abstract syntax tree.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the query instruction execution method for a bisyntax financial risk control graph database as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer programs are executed by a processor, they implement the query instruction execution method for a bisyntax financial risk control graph database as described in any one of claims 1 to 7.