[go: up one dir, main page]

CN109063136A - Non-relational database inquiry system and method - Google Patents

Non-relational database inquiry system and method Download PDF

Info

Publication number
CN109063136A
CN109063136A CN201810877537.4A CN201810877537A CN109063136A CN 109063136 A CN109063136 A CN 109063136A CN 201810877537 A CN201810877537 A CN 201810877537A CN 109063136 A CN109063136 A CN 109063136A
Authority
CN
China
Prior art keywords
query statement
relational database
processing unit
inquiry
inquiry request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810877537.4A
Other languages
Chinese (zh)
Inventor
王韬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Rice Future Technology Co Ltd
Original Assignee
Beijing Rice Future Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Rice Future Technology Co Ltd filed Critical Beijing Rice Future Technology Co Ltd
Priority to CN201810877537.4A priority Critical patent/CN109063136A/en
Publication of CN109063136A publication Critical patent/CN109063136A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to field of computer technology, in order to solve the problems, such as that non-relational database query capability is weak, the invention discloses a kind of non-relational database inquiry system and methods, wherein non-relational database inquiry system includes: service application unit, it is used to receive inquiry request, generates the first query statement according to the inquiry request;Processing unit is used to handle first query statement, generates the second query statement, and the processing unit sends the second query statement to non-relational database and inquired, and second query statement is the primary query statement of non-relational database.The present invention greatly improves the weak problem of non-relational database query capability.

Description

Non-relational database inquiry system and method
Technical field
The present invention relates to field of computer technology, in particular to a kind of non-relational database inquiry system and method.
Background technique
The present invention belongs to the relevant technologies related to the present invention for the description of background technique, be only used for explanation and just In understanding summary of the invention of the invention, it should not be construed as applicant and be specifically identified to or estimate applicant being considered of the invention for the first time The prior art for the applying date filed an application.
Database is widely used middleware in software product, and query statement is then the important tool using database. In various database products, the structured query language of relational database (SQL, Structured Query Language) It is powerful, the extensive query statement of ability, in Transaction Processing (OLTP, on-line transaction Processing it) programs in scene and plays central role always.
With the arrival of big data era, the specific gravity of unstructured data is increasing, so occurring more and more Non-relational database (no-sql), such as mongodb, elasticsearch etc..These non-relational databases can be convenient Quickly inquiry big data.But since non-relational database is without using complicated SQL query statement, its query capability with SQL compares weaker.
In order to improve the query capability of non-relational database, generally by the way of database plug-in unit or service code divides Solve the mode of querying condition.For the mode of database plug-in unit, it is desirable that non-relational database must be supported to extend.And business generation The mode complexity of code decomposition query condition is high, poor universality, and inquires code together with the easy close coupling of service code.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of non-relational database inquiry system, main purpose is that improvement is non- The weak problem of relevant database query capability.
In order to achieve the above objectives, present invention generally provides following technical solutions:
In a first aspect, the embodiment of the invention provides a kind of non-relational database inquiry systems, comprising:
Service application unit is used to receive inquiry request, generates the first query statement according to the inquiry request;
Processing unit is used to handle first query statement, generates the second query statement, and the processing is single Member sends the second query statement to non-relational database and is inquired, and second query statement is that non-relational database is former Raw query statement.
Second aspect, the embodiment of the invention provides a kind of non-relational database querying methods, include the following steps:
Inquiry request is received, the first query statement is generated according to the inquiry request;
First query statement is handled, the second query statement is generated, second query statement is non-relationship The primary query statement of type database.
The third aspect, the embodiment of the invention provides a kind of computer readable storage mediums, are stored thereon with computer journey The step of sequence, which realizes above-mentioned method when being executed by processor.
Fourth aspect the embodiment of the invention provides a kind of computer equipment, including memory, processor and is stored in On reservoir and the computer program that can run on a processor, the processor realize above-mentioned method when executing described program Step.
Compared with prior art, the beneficial effect of the embodiment of the present invention is:
Non-relational database inquiry system provided in an embodiment of the present invention increases processing unit, and the processing unit is to industry The first query statement that business applying unit generates is handled, and the primary query statement of non-relational database is obtained, in order to non- Relevant database is inquired, and query statement is extended, and improves the query capability of non-relational database.
Detailed description of the invention
Fig. 1 shows the schematic diagram of an embodiment of non-relational database inquiry system of the present invention.
Fig. 2 shows the schematic diagrames of an embodiment of non-relational database querying method of the present invention.
Specific embodiment
Present invention is further described in detail combined with specific embodiments below, but not as a limitation of the invention.? In following the description, what different " embodiment " or " embodiment " referred to is not necessarily the same embodiment.In addition, one or more are implemented Special characteristic, structure or feature in example can be combined by any suitable form.
The embodiment of the invention provides a kind of non-relational database inquiry system, Fig. 1 shows non-relational of the present invention The schematic diagram of one embodiment of database inquiry system.Referring to Fig. 1, the non-relational database inquiry system of the embodiment of the present invention Include:
Service application unit 10 is used to receive inquiry request, generates the first query statement according to inquiry request;
Processing unit 20 is used to handle the first query statement, generates the second query statement, and processing unit 10 is sent out The second query statement to non-relational database is sent to be inquired, the second query statement is the primary inquiry language of non-relational database Sentence.
Non-relational database inquiry system provided in an embodiment of the present invention increases processing unit, and the processing unit is to industry The first query statement that business applying unit generates is handled, and the primary query statement of non-relational database is obtained, in order to non- Relevant database is inquired, and query statement is extended, and improves the query capability of non-relational database.Above-mentioned processing list Member reduces service code and inquires the degree of coupling of code.
In the embodiment of the present invention, service application unit 10 receives inquiry request, data needed for analyzing inquiry request, according to Required data generate the first query statement.
In one embodiment of the invention, processing unit 20 provides the structure of query statement to service application unit 10, business The first query statement of structural generation for the query statement that applying unit 10 is provided according to processing unit 20.In the present embodiment, business The structure for the first query statement that applying unit 10 generates is provided by processing unit 20, and processing unit 20 can be right according to its rule First query statement is handled, to obtain the primary query statement of non-relational database, non-relational database can be into Row inquiry.
In one embodiment of the invention, the first query statement includes replacement keyword and calculation expression.Processing unit pair When the processing of the first query statement, replacement keyword and calculation expression are converted, second is obtained by the first query statement and looks into Sentence is ask, which is the primary query statement of non-relational database.The present embodiment further provides versatility, It is easily achieved.
In one embodiment of the invention, the replacement keyword in the first query statement is not included in non-relational database original In raw query statement.It is not identical with replacement keyword interior in the primary query statement of non-relational database in the present embodiment Hold, easily identify, replacement keyword can be distinguished easily, will not should miss the additional problems such as replacement.
In one embodiment of the invention, the main structure of the first query statement is json (JSON, JavaScript Object Notation) format.In the present embodiment, main structure using Json format as the first query statement inquires language Sentence analysis is simple, and processing speed is fast.
In an alternative embodiment of the invention, the first query statement handles to obtain the second inquiry language using regular expression Sentence.In the present embodiment, the first query statement can be handled by regular expression, without complicated code generation, it is easy to accomplish.
An alternative embodiment of the invention, processing unit are packaged with the professional knowledge and business rule of service application unit, Processing unit directly understands the first query statement that service application unit is sent, so that the second query statement generated is general looks into Ask sentence.In the present embodiment, processing unit encapsulates the professional knowledge and business rule in service application unit specific transactions field, So processing unit can directly understand the technical term that service application unit is sent, and it is unrelated that technical term is translated into business Universal inquiry statement give Universal Database execution.Therefore, the service application unit on upper layer can directly use technical term Inquire data, it is not necessary to take a lot of trouble succinct technical term to be translated into interminable general movement;The database of lower layer then need not simultaneously Special business knowledge and term keep the versatility of oneself.
Whether an alternative embodiment of the invention, processing unit judge inquiry request in allowed band according to business rule Interior, if inquiry request exceeds allowed band, the first query statement is converted to the second query statement to non-pass by processing unit refusal It is that type database is inquired.In the present embodiment, since processing unit understands business rule, so processing unit knows which is used Which business datum family can inquire.Therefore processing unit can judge specifically to look into according to information such as the permissions of current queries user Whether within the allowable range to ask.If processing unit determines that the range for the data that this inquiry request is related to has exceeded the power of user Limit, processing unit can refuse the inquiry business movement translation user to database, prevent the inquiry of going beyond one's commission of user, ensure number According to safety.
Second aspect, the embodiment of the invention provides a kind of non-relational database querying methods, and Fig. 2 shows the present invention The schematic diagram of one embodiment of non-relational database querying method.Referring to fig. 2, this method comprises the following steps:
Inquiry request is received, the first query statement is generated according to inquiry request;
First query statement is handled, the second query statement is generated, the second query statement is non-relational database Primary query statement.
In non-relational database querying method provided in an embodiment of the present invention, inquired according to first that inquiry request generates Sentence, to the first query statement processing, obtain the primary query statement of non-relational database, in order to non-relational database into Row inquiry, extends query statement, improves the query capability of non-relational database.Above-mentioned processing unit reduces business generation The degree of coupling of code and inquiry code.
In the embodiment of the present invention, generating the first query statement be can specifically include: being received inquiry request, is analyzed inquiry request Required data generate the first query statement according to required data.
In one embodiment of the invention, the first query statement includes replacement keyword and calculation expression.It inquires first When sentence processing, replacement keyword and calculation expression are converted, the second query statement is obtained by the first query statement, it should Second query statement is the primary query statement of non-relational database.The present embodiment further provides versatility, it is easy to accomplish.
In one embodiment of the invention, the replacement keyword in the first query statement is not included in non-relational database original In raw query statement.It is not identical with replacement keyword interior in the primary query statement of non-relational database in the present embodiment Hold, easily identify, replacement keyword can be distinguished easily, is not in miss the additional problems such as replacement.
In one embodiment of the invention, the main structure of the first query statement is json format.In the present embodiment, use Main structure of the Json format as the first query statement, query statement analysis is simple, and processing speed is fast.
In one embodiment of the invention, the first query statement handles to obtain the second query statement using regular expression.This In embodiment, the first query statement can be handled by regular expression, without complicated code generation, it is easy to accomplish.
An alternative embodiment of the invention, is handled the first query statement according to professional knowledge and business rule, with Generate the second query statement.In the present embodiment, according to the professional knowledge in specific transactions field and business rule directly professional art Language is translated into the unrelated universal inquiry statement of business, executes to give Universal Database.It is thereby achieved that different business layer Relatively independent and versatility.
An alternative embodiment of the invention, before to the processing of the first query statement further include: judge that inquiry request is It is no within the allowable range, if inquiry request exceeds allowed band, the first query statement is converted to the second query statement by refusal It is inquired to non-relational database.In the present embodiment, this can be judged according to information such as the permissions of current queries user Within the allowable range whether inquiry.If it is determined that the range for the data that this inquiry request is related to has exceeded the range of permission, can To refuse the inquiry business movement translation user to database, the inquiry of going beyond one's commission of user is prevented, ensures the safety of data.
Below by example way, the present invention is further described.Referring to fig. 2, such as by taking ElasticSearch as an example, Using same day birth as querying condition, current time is taken since ElasticSearch is not provided, whens taking the month etc. of some time Between function, therefore, ElasticSearch itself cannot achieve the inquiry.The embodiment of above system and method for the present invention can be with Expand corresponding query statement.Expand these functions in original no-sql query statement, the embodiment of the present invention can be with A $ { date } is introduced as replacement keyword.Since ElasticSearch primary inquiry uses josn, and json's In format regulation, $ symbol will not be gone out before braces, it is possible to easily distinguish the replacement keyword, be not in miss The additional problems such as replacement.Certainly, when forming the first query statement according to certain inquiry requests, if non-relational database is original There is content identical with the replacement keyword of the first query statement in the string content of query statement (such as json sentence), it can To use escape or select other key markers that will not be obscured.In this example, it is specified that { date } key representations work as the day before yesterday Phase, { field } represent inquiry field, then one extension after ElasticSearch query statement can be so that " Term ": " { field } ": " { date } ", when system time is on January 1st, 2000, processing unit is to first inquiry The processing transformation result of sentence is { " term ": { " birthday ": " 2000-01-01 " } }.The second inquiry that above-mentioned processing obtains Sentence is the primary query statement of non-relational database, can carry out inquiry job.Query result is fed back.
Except of course that replacement keyword can also quote more format control contents except above-described embodiment, and such as: $ {date[<+-><span><unit>][|format]}.Since replacement keyword can quote more multi-format control content, extension Inquiry language it is richer, such as " wildcard ": " $ { field } .str ": " $ date+1M |??? ?-MM-dd ", pass through After the processing conversion of above-mentioned first query statement, the query statement for being transmitted to ElasticSearch is: " wildcard ": " Birthiday.str ": "? -01-? ", it can be used to indicate the querying condition of same month next month birth.
In the embodiment of the present invention, $ { date } the replacement keyword of these different additional formats is handled, it is only necessary to use one Regular expression " $ date ((?<span>[+-] d+) (?<unit>[A-Za-z]+))? (| (?<format>. +? ))? ", without complicated code generation, it is easy to accomplish.
Other than $ { field } in the example above and $ { date }, the keyword of other many meanings can also be quoted to expand Open up the primary query statement of non-relational database.Realize that being capable of handling replacement in the embodiment of the present invention with regular expression closes Key word, the literary style of the realization regular expression in above-described embodiment also non-exclusive alternative, can flexibly play regular expression Ability realize more replacement keyword formats.
Those skilled in the art can be understood that the embodiment of the present invention technical solution can by software and/or Hardware is realized." unit " or " module " in this specification is to refer to complete independently or complete with other component cooperation specific The software and/or hardware of function, wherein hardware for example can be FPGA (Field-Programmable Gate Array, it is existing Field programmable gate array), IC (Integrated Circuit, integrated circuit) etc..
The embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer program, the journey The step of any of the above-described embodiment method is realized when sequence is executed by processor.Wherein, computer readable storage medium may include But be not limited to any kind of disk, including floppy disk, CD, DVD, CD-ROM, mini drive and magneto-optic disk, ROM, RAM, EPROM, EEPROM, DRAM, VRAM, flash memory device, magnetic or optical card, nanosystems (including molecular memory IC), Or it is suitable for any kind of medium or equipment of store instruction and/or data.
The embodiment of the invention also provides a kind of computer equipments, including memory, processor and storage are on a memory And the computer program that can be run on a processor, the step of realizing any of the above-described embodiment method when processor executes program. In embodiments of the present invention, processor is the control centre of computer system, can be the processor of physical machine, is also possible to void The processor of quasi- machine.
In the present invention, term " first ", " second " etc. are only used for the purpose of description, are not understood to indicate or imply Relative importance or sequence;Term " multiple " then refers to two or more, unless otherwise restricted clearly.Term " installation ", The terms such as " connected ", " connection ", " fixation " shall be understood in a broad sense, for example, " connection " may be a fixed connection, being also possible to can Dismantling connection, or be integrally connected;" connected " can be directly connected, can also be indirectly connected through an intermediary.For this For the those of ordinary skill in field, the specific meanings of the above terms in the present invention can be understood according to specific conditions.
In description of the invention, it is to be understood that the orientation or positional relationship of the instructions such as term " on ", "lower" be based on Orientation or positional relationship shown in the drawings, is merely for convenience of description of the present invention and simplification of the description, rather than indication or suggestion institute The device or unit of finger must have specific direction, be constructed and operated in a specific orientation, it is thus impossible to be interpreted as to this hair Bright limitation.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.

Claims (13)

1. a kind of non-relational database inquiry system, comprising:
Service application unit is used to receive inquiry request, generates the first query statement according to the inquiry request;
Processing unit is used to handle first query statement, generates the second query statement, the processing unit hair The second query statement to non-relational database is sent to be inquired, second query statement, which is that non-relational database is primary, to be looked into Ask sentence.
2. system according to claim 1, which is characterized in that the processing unit provides the structure of query statement to described Service application unit, described in the structural generation for the query statement that the service application unit is provided according to the processing unit First query statement.
3. system according to claim 1, which is characterized in that first query statement includes replacement keyword and calculating Expression formula;Replacement keyword in first query statement is not included in the primary query statement of the non-relational database In.
4. system according to claim 1, which is characterized in that first query statement is handled using regular expression To the second query statement.
5. system according to claim 1, which is characterized in that the processing unit is packaged with the service application unit Professional knowledge and business rule, the processing unit directly understand the first query statement that the service application unit is sent, with Make the second query statement universal inquiry statement generated.
6. system according to claim 5, which is characterized in that the processing unit judges to inquire according to the business rule Within the allowable range whether, if the inquiry request exceeds allowed band, the processing unit refusal is looked into described first for request Inquiry sentence is converted to second query statement and is inquired to the non-relational database.
7. a kind of non-relational database querying method, includes the following steps:
Inquiry request is received, the first query statement is generated according to the inquiry request;
First query statement is handled, the second query statement is generated, second query statement is non-relational number According to the primary query statement in library.
8. the method according to the description of claim 7 is characterized in that first query statement includes replacement keyword and calculating Expression formula;Replacement keyword in first query statement is not included in the primary query statement of non-relational database.
9. the method according to the description of claim 7 is characterized in that first query statement is handled using regular expression To the second query statement.
10. the method according to the description of claim 7 is characterized in that being looked into according to professional knowledge and business rule described first It askes sentence to be handled, to generate second query statement.
11. the method according to the description of claim 7 is characterized in that before to first query statement processing further include: Whether within the allowable range to judge the inquiry request, if the inquiry request exceeds allowed band, refuses described first Query statement is converted to second query statement and is inquired to non-relational database.
12. a kind of computer readable storage medium, is stored thereon with computer program, power is realized when which is executed by processor Benefit requires the step of any one of 7-11 the method.
13. a kind of computer equipment including memory, processor and stores the meter that can be run on a memory and on a processor The step of calculation machine program, the processor realizes any one of claim 7-11 the method when executing described program.
CN201810877537.4A 2018-08-03 2018-08-03 Non-relational database inquiry system and method Pending CN109063136A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810877537.4A CN109063136A (en) 2018-08-03 2018-08-03 Non-relational database inquiry system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810877537.4A CN109063136A (en) 2018-08-03 2018-08-03 Non-relational database inquiry system and method

Publications (1)

Publication Number Publication Date
CN109063136A true CN109063136A (en) 2018-12-21

Family

ID=64833182

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810877537.4A Pending CN109063136A (en) 2018-08-03 2018-08-03 Non-relational database inquiry system and method

Country Status (1)

Country Link
CN (1) CN109063136A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111897824A (en) * 2020-03-25 2020-11-06 上海云励科技有限公司 Data operation method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779114A (en) * 2011-05-12 2012-11-14 商业对象软件有限公司 Unstructured data support generated by utilizing automatic rules
CN103744891A (en) * 2013-12-23 2014-04-23 大唐软件技术股份有限公司 Method and system for data query
CN104239506A (en) * 2014-09-12 2014-12-24 北京优特捷信息技术有限公司 Unstructured data processing method and device
CN104598587A (en) * 2015-01-19 2015-05-06 深圳市华成峰数据技术有限公司 Invoice authenticity inquiry method and system
US20160299982A1 (en) * 2011-10-05 2016-10-13 Mr. AJIT BHAVE System for organizing and fast searching of massive amounts of data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779114A (en) * 2011-05-12 2012-11-14 商业对象软件有限公司 Unstructured data support generated by utilizing automatic rules
US20160299982A1 (en) * 2011-10-05 2016-10-13 Mr. AJIT BHAVE System for organizing and fast searching of massive amounts of data
CN103744891A (en) * 2013-12-23 2014-04-23 大唐软件技术股份有限公司 Method and system for data query
CN104239506A (en) * 2014-09-12 2014-12-24 北京优特捷信息技术有限公司 Unstructured data processing method and device
CN104598587A (en) * 2015-01-19 2015-05-06 深圳市华成峰数据技术有限公司 Invoice authenticity inquiry method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111897824A (en) * 2020-03-25 2020-11-06 上海云励科技有限公司 Data operation method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US7103611B2 (en) Techniques for retaining hierarchical information in mapping between XML documents and relational data
US7567968B2 (en) Integration of a non-relational query language with a relational data store
US8793267B2 (en) Optimization of queries on a repository based on constraints on how the data is stored in the repository
US7039622B2 (en) Computer-implemented knowledge repository interface system and method
US7181680B2 (en) Method and mechanism for processing queries for XML documents using an index
US7401336B2 (en) Role based integrated platform
US11928114B2 (en) Query generation based on a logical data model with one-to-one joins
US20190138522A1 (en) Query translation for searching complex structures of objects
US20080183657A1 (en) Method and apparatus for providing direct access to unique hierarchical data items
US10242123B2 (en) Method and system for handling non-presence of elements or attributes in semi-structured data
WO2023125718A1 (en) Data query method and system based on knowledge graph, and device and storage medium
US20100319006A1 (en) Persisting application state
JP4854542B2 (en) Document search system and document search method
US9489459B2 (en) Single point metadata driven search configuration, indexing and execution
CN109063136A (en) Non-relational database inquiry system and method
CN108874944A (en) A kind of isomeric data mapped system and method based on XSL language conversion
CN106201542B (en) WOF rapid development platform
Khriyenko et al. Context description framework for the semantic web
US7970867B2 (en) Hypermedia management system
EP3170101B1 (en) Data model indexing for model queries
Liu et al. Using semantic web technologies in heterogeneous distributed database system: A case study for managing energy data on mobile devices
US20120265781A1 (en) Semantics-based information input
CN112100207B (en) Sub-query processing method, device, equipment and storage medium
US11860715B2 (en) Messaging for OData error targets
US12072881B2 (en) Key range query optimization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20181221

RJ01 Rejection of invention patent application after publication