A native multi-model database operation method and device

By building a software architecture, parsing and executing AQL statements, the problem of difficulty in management and maintenance of AQL statements in ArangoDB is solved, dynamic processing and unified management are realized, and the maintainability of the code is improved.

CN113901270BActive Publication Date: 2024-11-01BEIJING BAOLANDE SOFTWARE CORP
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111245200.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-26
Publication Date
2024-11-01
Estimated Expiration
2041-10-26

AI Technical Summary

Technical Problem

In the existing solutions to query ArangoDB, AQL statements are difficult to manage and maintain, especially when the business logic is complex, hard coding of AQL statements makes it difficult to achieve dynamic effects, increasing maintenance difficulty.

Method used

By building a software architecture including the basic layer, core layer and interface layer, using configuration parser, parameter processor and result mapper, AQL statements are parsed and executed from XML files, generating dynamic proxy interfaces, and achieving unified management of AQL statements using configuration parser, parameter processor and result mapper and dynamic processing.

Benefits of technology

It realizes unified management of ArangoDB AQL statements, reduces maintenance difficulty, and improves code maintainability and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113901270B_ABST
    Figure CN113901270B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for operating a native multi-model database, the method comprising: constructing a software architecture including a base layer, a core layer and an interface layer; wherein the base layer is connected to a native multi-model database; the core layer comprises an AQL executor; the core layer parses the basic configuration of the base layer to obtain a configuration file parsing result, distributes the AQL statement generated based on the configuration file parsing result to the corresponding AQL executor, obtains an execution result based on the data source of the base layer, and generates a corresponding operation result based on the corresponding reflection operation in the base layer, so as to complete the user's operation of the native multi-model database through the interface layer; wherein the basic configuration in the base layer comprises creating a data source, scanning a configuration file AQL.XML, scanning an AQL interface and injecting a global configuration. The present invention realizes the unified management of AQL statements for operating the native multi-model database ArangoDB and is easy to maintain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database operation, and in particular to a native multi-model database operation method and device. Background Art

[0002] ArangoDB is a native multi-model database that has key / value pairs, graphs, and document data models. It provides a unified database query language covering the three data models and allows the three models to be mixed in a single query. Based on its native integrated multi-model features, high-performance programs can be built, and all three data models support horizontal expansion.

[0003] In the Java field, the existing solutions for querying ArangoDB include ArangoDB Java Driver and SpringData ArangoDB. ArangoDB Java Driver only provides interfaces and APIs for operating ArangoDB. All operations need to be implemented manually by users, and all AQL statements are integrated in the code in a hard-coded form. AQL statements are often the key control points of the business. When AQL statements are integrated in the code in a hard-coded form, they will appear particularly scattered and difficult to manage uniformly. Secondly, when implementing more complex businesses, AQL statements are generally very complex, and most scenarios will use dynamic statements. In order to achieve dynamic effects, AQL statements integrated in the code need to use a lot of splicing and judgment, which will make the related AQL statements more difficult to manage. In addition, the difficulty of maintenance will be greatly increased. Spring Data ArangoDB is a series of encapsulations based on ArangoDB Java Driver using the characteristics of Spring. Some common operations do not require users to write related AQL statements, but can directly call its API, which is somewhat similar to Spring Data JPA or Hibernate, but it still does not solve the above two problems and is not the best solution. Summary of the invention

[0004] The embodiment of the present invention provides a native multi-model database operation method and device, which are used to solve the problem that the AQL statements for operating ArangoDB are difficult to manage in a unified manner and the maintenance difficulty is increased.

[0005] In a first aspect, an embodiment of the present invention provides a native multi-model database operation method, including:

[0006] Construct a software architecture including a base layer, a core layer and an interface layer; wherein the base layer is connected to a native multi-model database; and the core layer includes an AQL executor;

[0007] The core layer parses the basic configuration of the base layer to obtain a configuration file parsing result, distributes the AQL statement generated based on the configuration file parsing result to the corresponding AQL executor, obtains the execution result based on the data source of the base layer, and generates the corresponding operation result from the execution result based on the corresponding reflection operation in the base layer, so as to enable the user to operate the native multi-model database through the interface layer;

[0008] The basic configuration in the basic layer includes creating a data source, scanning a configuration file AQL.XML, scanning an AQL interface, and injecting a global configuration.

[0009] Furthermore, the core layer also includes a configuration parser;

[0010] The parsing of the basic configuration of the basic layer by the core layer to obtain a configuration file parsing result includes:

[0011] The AQL interface scanned based on the basic configuration of the basic layer uses JDK dynamic proxy to generate the corresponding interface proxy;

[0012] Parse the configuration file AQL.XML through the configuration parser based on the corresponding interface agent, and generate an AqlMethod object for each subnode aql tag in the configuration file AQL.XML, wherein the AqlMethod object records the file location, return value type and specific AQL statement of the current configuration file AQL.XML; wherein the AqlMethod object includes parameters and subtags of the AQL statement;

[0013] The interface proxy and the AqlMethod object are bound through the domain name space namespace, and the corresponding binding relationship is recorded in the configuration Configuration object of the configuration parser to obtain the configuration file parsing result.

[0014] Further, the parsing of the configuration file AQL.XML by the configuration parser based on the corresponding interface agent includes:

[0015] Each configuration file AQL.XML is associated with the AQL interface through the namespace attribute of the domain name space; wherein the root node of the configuration file AQL.XML is aqls, the child node is aql, each aql child node defines an id attribute as a unique identifier, the id attribute value and the interface method in the associated AQL interface correspond one-to-one, and the configuration file AQL.XML and the AQL interface correspond one-to-one.

[0016] Furthermore, the core layer also includes a parameter processor;

[0017] Generate an AQL statement based on the parsing result of the configuration file, including:

[0018] Input the parameter list of the AQL interface into the parameter processor. If the parameter has @AqlParam annotation, the value in the annotation is used as the basis for available parameters. Otherwise, a default value is generated as the basis for available parameters.

[0019] Generates AQL statements based on available parameters by replacing actual parameter values ​​with the actual positions of each parameter.

[0020] Furthermore, the core layer also includes a result mapper;

[0021] The generating a corresponding operation result from the execution result based on the corresponding reflection operation in the base layer includes:

[0022] After the query statement obtains the execution result data, the result type resultType in AqlMethod is used through the result mapper to generate the corresponding POJO object as the operation result by using the specific reflection operation in the base layer.

[0023] In a second aspect, an embodiment of the present invention provides a native multi-model database operation device, including:

[0024] An architecture construction unit, used to construct a software architecture including a base layer, a core layer and an interface layer; wherein the base layer is connected to the native multi-model database; and the core layer includes an AQL executor;

[0025] An operation unit, configured to parse the basic configuration of the base layer through the core layer to obtain a configuration file analysis, distribute the AQL statements generated based on the configuration file analysis to the corresponding AQL executor, obtain the execution result based on the data source of the base layer, and generate the corresponding operation result from the execution result based on the corresponding reflection operation in the base layer, so as to enable the user to operate the native multi-model database through the interface layer;

[0026] The basic configuration in the basic layer includes creating a data source, scanning a configuration file AQL.XML, scanning an AQL interface, and injecting a global configuration.

[0027] Furthermore, the core layer also includes a configuration parser; the operation unit includes an agent generation module, a file parsing module and a relationship binding module;

[0028] The proxy generation module is used to generate a corresponding interface proxy by using a JDK dynamic proxy method based on the AQL interface scanned by the basic configuration of the basic layer;

[0029] The file parsing module is used to parse the configuration file AQL.XML through the configuration parser based on the corresponding interface agent, and generate an AqlMethod object for each sub-node aql tag in the configuration file AQL.XML, wherein the AqlMethod object records the file location, return value type and specific AQL statement of the current configuration file AQL.XML; wherein the AqlMethod object includes parameters and sub-tags of the AQL statement;

[0030] The relationship binding module is used to bind the interface proxy and the AqlMethod object through the domain name space namespace, and record the corresponding binding relationship in the configuration Configuration object of the configuration parser to obtain the configuration file parsing result.

[0031] Furthermore, the file parsing module is specifically used to associate each configuration file AQL.XML with the AQL interface through a domain name space namespace attribute; wherein the root node of the configuration file AQL.XML is aqls, the child node is aql, each aql child node defines an id attribute as a unique identifier, the id attribute value and the interface method in the associated AQL interface have a one-to-one correspondence, and the configuration file AQL.XML and the AQL interface have a one-to-one correspondence.

[0032] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the native multi-model database operation method as described in any one of the items provided in the first aspect above are implemented.

[0033] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the native multi-model database operation method as described in any one of the items provided in the first aspect above.

[0034] The embodiment of the present invention provides a method and device for operating a native multi-model database, which constructs a software architecture including a base layer, a core layer and an interface layer; the core layer parses the basic configuration of the base layer to obtain a configuration file parsing result, distributes the AQL statement generated based on the configuration file parsing result to the corresponding AQL executor, obtains the execution result based on the data source of the base layer, and generates the corresponding operation result from the execution result based on the corresponding reflection operation in the base layer, so as to complete the user's operation of the native multi-model database through the interface layer. The present invention realizes the unified management of AQL statements for operating the native multi-model database ArangoDB and is easy to maintain. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 It is a flowchart of a native multi-model database operation method provided by the present invention;

[0037] FIG2 is an overall architecture diagram of an operation native multi-model database provided by the present invention;

[0038] FIG3 is a schematic diagram of an execution flow of operating a native multi-model database provided by the present invention;

[0039] Figure 4 It is a structural schematic diagram of a native multi-model database operation device provided by the present invention;

[0040] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] Combine the following Figure 1-Figure 5 A native multi-model database operation method and device provided by the present invention are described.

[0043] An embodiment of the present invention provides a native multi-model database operation method. Figure 1 A flowchart of a native multi-model database operation method provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:

[0044] Step 110, constructing a software architecture including a base layer, a core layer and an interface layer; wherein the base layer is connected to a native multi-model database; and the core layer includes an AQL executor;

[0045] Specifically, Figure 2 As shown, the entire software architecture is divided into the following three layers:

[0046] 1) Basic layer: This layer provides some basic services and operations, such as providing data sources, creating agents, various reflection operations, etc.;

[0047] 2) Core layer: This layer is the core processing logic of the technical solution of the present invention, which includes four modules: configuration parser, parameter processor, AQL executor and result mapper. Among them, the AQL executor is mainly responsible for distributing different AQL statements to the corresponding Executor and executing them using the configured data source;

[0048] 3) Interface layer: This layer provides users with the ability to access the operation solution of the present invention, so that users can easily operate the native multi-model database ArangoDB through the interface layer.

[0049] Step 120, the core layer parses the basic configuration of the base layer to obtain a configuration file parsing result, distributes the AQL statement generated based on the configuration file parsing result to the corresponding AQL executor, obtains the execution result based on the data source of the base layer, and generates the corresponding operation result based on the corresponding reflection operation in the base layer, so as to complete the user's operation of the native multi-model database through the interface layer, such as Figure 3 The flowchart of operating a native multi-model database is shown;

[0050] The basic configuration in the basic layer includes creating a data source, scanning a configuration file AQL.XML, scanning an AQL interface, and injecting a global configuration.

[0051] The method provided in the embodiment of the present invention is based on ArangoDB Java Driver and has the following improvements compared to the existing solution: 1) AQL statements are uniformly placed in an XML file for unified management; 2) AQL statements in the XML file can be dynamically processed using different tags according to actual needs.

[0052] Based on any of the above embodiments, the core layer further includes a configuration parser;

[0053] Specifically, the configuration parser is mainly responsible for loading global configuration, loading and creating data sources, scanning AQL.XML files, loading parameter mapping configuration, loading result mapping configuration, etc.

[0054] Combination Figure 3 , the parsing of the basic configuration of the basic layer by the core layer to obtain a configuration file parsing result includes:

[0055] The AQL interface scanned based on the basic configuration of the basic layer uses JDK dynamic proxy to generate the corresponding interface proxy;

[0056] Specifically, the configuration file parsing stage mainly handles some basic configurations, including the following points: creating a data source; scanning AQL.XML; scanning AQL interfaces; injecting global configurations; generating interface proxy stages will use JDK dynamic proxy to generate corresponding proxy classes for the interface AQL scanned in the above configuration file parsing stage. This proxy class only exists in the memory object.

[0057] It should be noted that the present invention adopts the JDK dynamic proxy as the proxy mode. The proxy mode provides a proxy object for a certain object, and the proxy object controls the reference to the original object. Generally speaking, the proxy mode is a common intermediary in life. The present invention uses the JDK dynamic proxy, which is an implementation of the proxy mode and can only proxy interfaces.

[0058] The configuration parser parses the configuration file AQL.XML based on the corresponding interface agent, and generates an AqlMethod object for each subnode aql tag in the configuration file AQL.XML, and the AqlMethod object records the file location, return value type and specific AQL statement of the current configuration file AQL.XML; wherein the AqlMethod object includes parameters and subtags of the AQL statement; that is, the AQL.XML configuration file parsing stage generates an AqlMethod object for each aql tag, and the object records the current AQL.XML file location, return value type and specific AQL statement.

[0059] It should be noted that the AQL statement in AqlMethod cannot be executed directly. It often carries some parameters or sub-tags. The parameters will be processed in the parameter processor, and the sub-tags will be processed using the combination mode combined with the open source component ONGL, such as logical judgment processing, traversal processing, etc.

[0060] The composite pattern used in this invention is also called the part-whole pattern, which is used to treat a group of similar objects as a single object. The composite pattern combines objects according to a tree structure to represent the part and whole hierarchy. This type of design pattern belongs to the structural pattern, which creates a tree structure of object groups. This pattern creates a class that contains its own object group, which provides a way to modify the same object group. The core is:

[0061] 1. Abstract component role: define the commonalities between leaf and container components

[0062] 2. Leaf component role: no child nodes

[0063] 3. Container component role: has container characteristics and can contain child nodes

[0064] The combination mode is applied to the AqlMethod parsing stage in the present invention. The AQL statement may contain multiple sub-tags in this stage. These sub-tags have corresponding levels and can be regarded as a tree structure. Different AqlNodes are applied to different levels for parsing.

[0065] The full name of OGNL used in the present invention is Object Graph Navigation Language, which is a powerful expression language that uses simple and consistent expression syntax to read and set the attribute values ​​of Java objects, call object methods, traverse the entire object structure graph, and implement field type conversion and other functions. Compared with other expression languages, OGNL is more powerful and provides many advanced and necessary features, such as powerful type conversion functions, execution of static or instance methods, cross-collection projection, and dynamic lambda expression definition.

[0066] ONGL is applied in the present invention to the AqlMethod parsing stage, that is, in the AqlNode parsing operation, when the AQL statement contains dynamic tags, such as logic judgment tags, dynamic attribute judgment operations, etc., ONGL related APIs will be called to perform related logic parsing operations.

[0067] The interface proxy and the AqlMethod object are bound through the domain name space namespace, and the corresponding binding relationship is recorded in the configuration Configuration object of the configuration parser to obtain the configuration file parsing result.

[0068] Based on any of the above embodiments, combined with Figure 3 , the corresponding interface agent parses the configuration file AQL.XML through the configuration parser, including:

[0069] Each configuration file AQL.XML is associated with the AQL interface through the namespace attribute of the domain name space; wherein the root node of the configuration file AQL.XML is aqls, the child node is aql, each aql child node defines an id attribute as a unique identifier, the id attribute value and the interface method in the associated AQL interface correspond one-to-one, and the configuration file AQL.XML and the AQL interface correspond one-to-one.

[0070] Based on any of the above embodiments, the core layer further includes a parameter processor;

[0071] Specifically, the parameter processor is mainly responsible for parsing the parameters and related attributes in the AQL statement, packaging them in a certain way, and generating the final AQL statement in combination with dynamic tags and parameter mapping configuration.

[0072] Combination Figure 3 , generating an AQL statement based on the parsing result of the configuration file, including:

[0073] Input the parameter list of the AQL interface into the parameter processor. If the parameter has @AqlParam annotation, the value in the annotation is used as the basis for available parameters. Otherwise, a default value is generated as the basis for available parameters.

[0074] Generates AQL statements based on available parameters by replacing actual parameter values ​​with the actual positions of each parameter.

[0075] Based on any of the above embodiments, the core layer further includes a result mapper;

[0076] Specifically, the result mapper is mainly responsible for mapping the result set and generating the corresponding operation result using the corresponding reflection operation according to the result mapping configuration.

[0077] Combination Figure 3 , generating a corresponding operation result from the execution result based on the corresponding reflection operation in the base layer, comprises:

[0078] After the query statement obtains the execution result data, the result type resultType in AqlMethod is used through the result mapper to generate the corresponding POJO object as the operation result by using the specific reflection operation in the base layer.

[0079] It should be noted that for each AQL operation in the global exception handling, the following information will be recorded in its execution context: error message, location of the AQL.XML file that generated the error, object (specific interface method) that generated the error, stage that generated the error, AQL statement that generated the error, and error stack information. When an exception occurs when executing an AQL statement using the technical solution of the present invention, the problem point can be quickly found based on the detailed error information, thereby significantly improving the efficiency of locating the problem.

[0080] A native multi-model database operation device provided by the present invention is described below. The native multi-model database operation method described below and the native multi-model database operation method described above can be referenced to each other.

[0081] Figure 4 A schematic diagram of the structure of a native multi-model database operation device provided by an embodiment of the present invention, such as Figure 4 As shown, the device includes an architecture building unit 410 and an operating unit 420;

[0082] The architecture construction unit 410 is used to construct a software architecture including a basic layer, a core layer and an interface layer; wherein the basic layer is connected to the native multi-model database; and the core layer includes an AQL executor;

[0083] The operation unit 420 is used to parse the basic configuration of the basic layer through the core layer to obtain a configuration file analysis, distribute the AQL statement generated based on the configuration file analysis to the corresponding AQL executor, obtain the execution result based on the data source of the basic layer, and generate the corresponding operation result from the execution result based on the corresponding reflection operation in the basic layer, so as to complete the user operating the native multi-model database through the interface layer;

[0084] The basic configuration in the basic layer includes creating a data source, scanning a configuration file AQL.XML, scanning an AQL interface, and injecting a global configuration.

[0085] The device provided by the embodiment of the present invention is based on ArangoDB Java Driver and has the following improvements compared to the existing solution: 1) AQL statements are uniformly placed in an XML file for unified management; 2) AQL statements in the XML file can be dynamically processed using different tags according to actual needs.

[0086] Based on any of the above embodiments, the core layer further includes a configuration parser; the operation unit includes an agent generation module, a file parsing module and a relationship binding module;

[0087] The proxy generation module is used to generate a corresponding interface proxy by using a JDK dynamic proxy method based on the AQL interface scanned by the basic configuration of the basic layer;

[0088] The file parsing module is used to parse the configuration file AQL.XML through the configuration parser based on the corresponding interface agent, and generate an AqlMethod object for each sub-node aql tag in the configuration file AQL.XML, wherein the AqlMethod object records the file location, return value type and specific AQL statement of the current configuration file AQL.XML; wherein the AqlMethod object includes parameters and sub-tags of the AQL statement;

[0089] The relationship binding module is used to bind the interface proxy and the AqlMethod object through the domain name space namespace, and record the corresponding binding relationship in the configuration Configuration object of the configuration parser to obtain the configuration file parsing result.

[0090] Based on any of the above embodiments, the file parsing module is specifically used to associate each configuration file AQL.XML with the AQL interface through a domain name space namespace attribute; wherein the root node of the configuration file AQL.XML is aqls, the child node is aql, each aql child node defines an id attribute as a unique identifier, the id attribute value and the interface method in the associated AQL interface have a one-to-one correspondence, and the configuration file AQL.XML and the AQL interface have a one-to-one correspondence.

[0091] Based on any of the above embodiments, the core layer further includes a parameter processor; the operation unit further includes a parameter processing module and a statement generation module;

[0092] The parameter processing module is used to input the parameter list of the AQL interface into the parameter processor, and if the parameter has an @AqlParam annotation, the value in the annotation is used as the basis for the available parameters, otherwise a default value is generated as the basis for the available parameters;

[0093] The statement generation module is used to replace the actual parameter values ​​to the actual positions of the parameters based on the available parameters to generate AQL statements.

[0094] Based on any of the above embodiments, the core layer further includes a result mapper; the operation unit further includes a reflection operation module;

[0095] The reflection operation module is used to obtain the execution result data for the query statement and then generate the corresponding POJO object as the operation result through the result mapper according to the result type resultType in AqlMethod by adopting the specific reflection operation in the base layer.

[0096] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the native multi-model database operation method, the method comprising: constructing a software architecture comprising a base layer, a core layer and an interface layer; wherein the base layer is connected to the native multi-model database; the core layer comprises an AQL executor; the basic configuration of the base layer is parsed by the core layer to obtain a configuration file parsing result, the AQL statement generated based on the configuration file parsing result is distributed to the corresponding AQL executor, and then the execution result is obtained based on the data source of the base layer, and the execution result is generated based on the corresponding reflection operation in the base layer. The corresponding operation result is generated from the execution result to complete the user operating the native multi-model database through the interface layer; wherein the basic configuration in the base layer includes creating a data source, scanning the configuration file AQL.XML, scanning the AQL interface and injecting a global configuration.

[0097] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0098] On the other hand, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the native multi-model database operation method provided by the above methods, the method including: constructing a software architecture including a base layer, a core layer and an interface layer; wherein the base layer is connected to the native multi-model database; the core layer includes an AQL executor; parsing the basic configuration of the base layer through the core layer to obtain a configuration file parsing result, distributing the AQL statement generated based on the configuration file parsing result to the corresponding AQL executor, and then obtaining an execution result based on the data source of the base layer, and generating a corresponding operation result from the execution result based on the corresponding reflection operation in the base layer, so as to complete the user's operation of the native multi-model database through the interface layer; wherein the basic configuration in the base layer includes creating a data source, scanning the configuration file AQL.XML, scanning the AQL interface and injecting a global configuration.

[0099] On the other hand, an embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned native multi-model database operation methods, the method comprising: constructing a software architecture comprising a base layer, a core layer and an interface layer; wherein the base layer is connected to the native multi-model database; the core layer comprises an AQL executor; parsing the basic configuration of the base layer through the core layer to obtain a configuration file parsing result, distributing the AQL statement generated based on the configuration file parsing result to the corresponding AQL executor, and obtaining an execution result based on the data source of the base layer, and generating a corresponding operation result from the execution result based on the corresponding reflection operation in the base layer, so as to complete the user's operation of the native multi-model database through the interface layer; wherein the basic configuration in the base layer comprises creating a data source, scanning the configuration file AQL.XML, scanning the AQL interface and injecting a global configuration.

[0100] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0101] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A native multi-model database operation method, It is characterized in that include: Constructing a software architecture including a base layer, a core layer and an interface layer; wherein the base layer is connected to a native multi-model database; and the core layer includes an AQL executor; The core layer parses the basic configuration of the base layer to obtain a configuration file parsing result, distributes the AQL statement generated based on the configuration file parsing result to the corresponding AQL executor, obtains the execution result based on the data source of the base layer, and generates the corresponding operation result from the execution result based on the corresponding reflection operation in the base layer, so as to enable the user to operate the native multi-model database through the interface layer; The basic configuration in the basic layer includes creating a data source, scanning the configuration file AQL.XML, scanning the AQL interface and injecting the global configuration; The core layer also includes a configuration parser; The parsing of the basic configuration of the basic layer by the core layer to obtain a configuration file parsing result includes: The AQL interface scanned based on the basic configuration of the basic layer uses JDK dynamic proxy to generate the corresponding interface proxy; Parse the configuration file AQL.XML through the configuration parser based on the corresponding interface agent, and generate an AqlMethod object for each subnode aql tag in the configuration file AQL.XML, wherein the AqlMethod object records the file location, return value type and specific AQL statement of the current configuration file AQL.XML; wherein the AqlMethod object includes parameters and subtags of the AQL statement; The interface proxy and the AqlMethod object are bound through the domain name space namespace, and the corresponding binding relationship is recorded in the configuration Configuration object of the configuration parser to obtain the configuration file parsing result.

2. The native multi-model database operation method according to claim 1, It is characterized in that The corresponding interface agent parses the configuration file AQL.XML through the configuration parser, including: Each configuration file AQL.XML is associated with the AQL interface through the namespace attribute of the domain name space; wherein the root node of the configuration file AQL.XML is aqls, the child node is aql, each aql child node defines an id attribute as a unique identifier, the id attribute value and the interface method in the associated AQL interface correspond one-to-one, and the configuration file AQL.XML and the AQL interface correspond one-to-one.

3. The native multi-model database operation method according to claim 1, It is characterized in that The core layer also includes a parameter processor; Generate an AQL statement based on the parsing result of the configuration file, including: Input the parameter list of the AQL interface into the parameter processor. If the parameter has @AqlParam annotation, the value in the annotation is used as the basis for available parameters. Otherwise, a default value is generated as the basis for available parameters. Generates AQL statements based on available parameters by replacing actual parameter values ​​with the actual positions of each parameter.

4. The native multi-model database operation method according to claim 1, It is characterized in that The core layer also includes a result mapper; The generating a corresponding operation result from the execution result based on the corresponding reflection operation in the base layer includes: After the query statement obtains the execution result data, the result type resultType in AqlMethod is used through the result mapper to generate the corresponding POJO object as the operation result by using the specific reflection operation in the base layer.

5. A native multi-model database operation device, It is characterized in that include: An architecture construction unit, used to construct a software architecture including a base layer, a core layer and an interface layer; wherein the base layer is connected to the native multi-model database; and the core layer includes an AQL executor; An operation unit, configured to parse the basic configuration of the base layer through the core layer to obtain a configuration file analysis, distribute the AQL statements generated based on the configuration file analysis to the corresponding AQL executor, obtain the execution result based on the data source of the base layer, and generate the corresponding operation result from the execution result based on the corresponding reflection operation in the base layer, so as to enable the user to operate the native multi-model database through the interface layer; The basic configuration in the basic layer includes creating a data source, scanning the configuration file AQL.XML, scanning the AQL interface and injecting the global configuration; The core layer also includes a configuration parser; the operation unit includes an agent generation module, a file parsing module and a relationship binding module; The proxy generation module is used to generate a corresponding interface proxy by using a JDK dynamic proxy method based on the AQL interface scanned by the basic configuration of the basic layer; The file parsing module is used to parse the configuration file AQL.XML through the configuration parser based on the corresponding interface agent, and generate an AqlMethod object for each sub-node aql tag in the configuration file AQL.XML, wherein the AqlMethod object records the file location, return value type and specific AQL statement of the current configuration file AQL.XML; wherein the AqlMethod object includes parameters and sub-tags of the AQL statement; The relationship binding module is used to bind the interface proxy and the AqlMethod object through the domain name space namespace, and record the corresponding binding relationship in the configuration Configuration object of the configuration parser to obtain the configuration file parsing result.

6. The native multi-model database operation device according to claim 5, It is characterized in that The file parsing module is specifically used to associate each configuration file AQL.XML with the AQL interface through a domain name space namespace attribute; wherein the root node of the configuration file AQL.XML is aqls, the child node is aql, each aql child node defines an id attribute as a unique identifier, the id attribute value and the interface method in the associated AQL interface correspond one-to-one, and the configuration file AQL.XML and the AQL interface correspond one-to-one.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the steps of the native multi-model database operation method according to any one of claims 1 to 4 are implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the native multi-model database operation method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Database operation code generation method and device

    CN106095792A

  • Automated testing system and automated testing method

    CN110515848A

  • Multi-mode database evaluation benchmark system for streaming data and construction method of multi-mode database evaluation benchmark system

    CN112948228A

  • Multi-model access to data

    US7418435B1