Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method for analyzing logic expression into general query statement

A logical expression and general query technology, applied in the field of parsing logical expressions into general query statements, can solve problems such as single business scenarios, inability to adapt to multiple data sources, and inability to dynamically configure data sources, etc., to achieve enhanced expansion flexibility, enrich business scenarios, and reduce the effect of development

Pending Publication Date: 2020-04-14
SICHUAN XW BANK CO LTD
View PDF6 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] (1) Relying on third-party toolkits will bring a lot of maintenance work during passive upgrades;
[0005] (2) The business scenario is single and only supports in-memory computing;
[0006] (3) It is not possible to dynamically configure various existing data sources;
[0007] (4) Cannot adapt to multiple data sources, such as Hbase (a distributed, column-oriented open source database), Solr (a full-text search engine developed in Java), etc.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for analyzing logic expression into general query statement

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0036] Take the logical expression of pure number type: 3+(3-0)*2 as an example, the logical expression is divided into three parts, variables (3, 0, 2), operators (+, -, *), separators characters (brackets ()).

[0037] Generate a parseable list of logical expressions:

[0038] 1. Declare logical expression: 3+(3-0)*2;

[0039] 2. Traverse the declared logical expression and generate the basic list in the queue structure storage unit: ("3", "+", "(", "3", "-", "0", ")", "* ","2");

[0040] 3. Declare a list structure storage unit (list) and a stack structure storage unit (stack);

[0041] 4. Traverse the basic list of the list, put the variable into the list, and push the operator into the stack;

[0042] 5. When the variable "3" is encountered, put it into list('3');

[0043] 6. When operator "+" is encountered, push into stack('+');

[0044] 7. When the delimiter "(" is encountered, press stack('+', '(');

[0045] 8. When the variable "3" is encountered, put it into ...

Embodiment 2

[0061] Taking Hbase (a distributed, column-oriented open source database) and Solr (a full-text search engine developed in Java) as examples, two different data interfaces between Hbase and Solr need to be connected. Among them, Solr is used as the data source.

[0062] The business modules are shown in Table 1:

[0063] Table 1:

[0064] module name data source Table Name Business 1 query module Hbase hbase_1 Business 2 query module Solr solr_1

[0065] The business field mapping is shown in Table 2:

[0066] Table 2:

[0067] module name query field name The real field name in the table field data type Business 2 query module a solr_col_1 string Business 2 query module b solr_col_2 int Business 2 query module c solr_col_3 string

[0068] The mapping table of configuration operators is shown in Table 3:

[0069] table 3:

[0070] module name data source query operator d...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention relates to a method for analyzing a logic expression into a general query statement. The method comprises the following steps of: A, extracting elements in the logic expression to form an element queue; B, putting variables in the element queue into a list, respectively putting operators and separators into stacks, and popping up the separators and related operators from the stacks and putting the separators and related operators into the list according to the priorities of the operators put into the stacks; C, after traversing the element queue, popping up all elements in the stack and putting the elements into a list to form an analyzable list; D, configuring a mapping table of operators, wherein the elements in the analyzable list are put into the stacks, and when the elements in the analyzable list are operators currently, the operators are mapped into data source operators and assembled with the put related variables into variable statements to be put into the stacks; and E, after traversing the analyzable list, outputting the query statement in the stacks. The method can adapt to logic expressions of different data sources, query statements of the different datasources are automatically generated, and code development and maintenance work of developers is greatly reduced.

Description

technical field [0001] The invention relates to a method for parsing logical expressions, specifically a method for parsing logical expressions into general query sentences. Background technique [0002] In the process of software development, we often encounter the problem of docking interfaces between different databases, systems, and data sources, such as the interface between the page and the application background, the interface between the App and the server, and the interface between different systems. butt. Usually, during the interface docking process of different systems, developers will agree on conditions to adapt to different business requirements, such as: (condition A>0&&condition B>1)||(condition C=0) and so on. Usually, the back-end interface will be customized according to business conditions. However, in the face of complex business scenarios, it is impossible for developers to exhaustively enumerate all conditional branches in the interface. To ca...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F8/41G06F8/73G06F16/242
CPCG06F8/427G06F8/73G06F16/2433
Inventor 赵伟
Owner SICHUAN XW BANK CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products