CN108733668A - Method and apparatus for inquiring data - Google Patents

Method and apparatus for inquiring data Download PDF

Info

Publication number
CN108733668A
CN108733668A CN201710242321.6A CN201710242321A CN108733668A CN 108733668 A CN108733668 A CN 108733668A CN 201710242321 A CN201710242321 A CN 201710242321A CN 108733668 A CN108733668 A CN 108733668A
Authority
CN
China
Prior art keywords
data
back end
mentioned
node
level
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.)
Granted
Application number
CN201710242321.6A
Other languages
Chinese (zh)
Other versions
CN108733668B (en
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.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201710242321.6A priority Critical patent/CN108733668B/en
Publication of CN108733668A publication Critical patent/CN108733668A/en
Application granted granted Critical
Publication of CN108733668B publication Critical patent/CN108733668B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

This application discloses the method and apparatus for inquiring data.One specific implementation mode of this method includes:Receive the data inquiry request that user terminal is sent, wherein the data inquiry request includes user identifier, field name and data version number;Determine the identical target tier data of versions of data number for being included with the data inquiry request with the presence or absence of the versions of data number that included Data Identification is matched with the user identifier and is included in hierarchical data set, wherein, the hierarchical data set prestores in memory, each hierarchical data in the hierarchical data set is provided with Data Identification and data version number;In response to determining, there are the target tier data in the hierarchical data set, then are based on the target tier data, determine the requested relevant data of field with indicated by the field name of the data inquiry request, and the data are back to the user terminal.This embodiment improves the validity of data query.

Description

Method and apparatus for inquiring data
Technical field
This application involves field of computer technology, and in particular to Internet technical field more particularly, to inquires data Method and apparatus.
Background technology
Hierarchical data is to include the data of multiple levels (such as father's level, child level), has specific hierarchical structure.Layer Level data may, for example, be the data with Storage Structure of Tree.Such as the layer for including three levels for storage article information Level data, the first level of the hierarchical data may include the category mark of the level-one category belonging to article, and the second level can be with The category of each sub- category including level-one category identifies, and third level may include belonging to each article of each sub- category Article mark, the third level are the last one level of the hierarchical data.Here, which can be described as second level Father's level, which can be described as the child level of first level;Second level can be described as father's layer of the third level Grade, the third level can be described as the child level of second level.
Data query system in the prior art be typically according to positioned at father's level identify inquire in child level with The set or quantity of the relevant mark of the mark do not consider whether stored hierarchical data is out of date usually, to return to The data of user are likely to be expired data.
Invention content
The purpose of the application is to propose a kind of improved method and apparatus for inquiring data, to solve background above The technical issues of technology segment is mentioned.
In a first aspect, the embodiment of the present application provides a kind of method for inquiring data, this method includes:Receive user The data inquiry request that terminal is sent, wherein above-mentioned data inquiry request includes user identifier, field name and data version number; It determines in hierarchical data set with the presence or absence of the number that included Data Identification is matched with above-mentioned user identifier and is included The identical target tier data of versions of data number for being included according to version number and above-mentioned data inquiry request, wherein above-mentioned level Data acquisition system prestores in memory, each hierarchical data in above-mentioned hierarchical data set is provided with Data Identification sum number According to version number;In response to there are above-mentioned target tier data in the above-mentioned hierarchical data set of determination, then above-mentioned target tier is based on Data, determine above-mentioned data inquiry request it is requested with above-mentioned field name indicated by the relevant data of field, and by the number According to being back to above-mentioned user terminal.
In some embodiments, for each hierarchical data in above-mentioned hierarchical data set, the hierarchical data it is every One level includes being provided at least one back end of node identification;For in the hierarchical data not being the last one layer Each level of grade, for each back end in the level, which includes in next level of the level At least one back end;Each back end in the last one above-mentioned level is leaf node, for above-mentioned last Each back end included by the last layer grade of one level, the back end are stored with the leaf of included leaf node Number of child nodes.
In some embodiments, above-mentioned data inquiry request further includes request type and querying condition, above-mentioned request type For following any one:Record queries, quantity inquiry;And it is above-mentioned based on above-mentioned target tier data, determine that above-mentioned data are looked into The requested relevant data of field with indicated by above-mentioned field name of request are ask, including:It is looked into if above-mentioned request type is record It askes, then searches the data met under the above-mentioned field of above-mentioned querying condition in above-mentioned target tier data.
In some embodiments, when above-mentioned request type is record queries, above-mentioned data inquiry request further includes data Return to initial value and data number;And if above-mentioned request type be record queries, in above-mentioned target tier data The data met under the above-mentioned field of above-mentioned querying condition are searched, including:If above-mentioned field name is wrapped for characterizing leaf node The data contained, then determination meets above-mentioned querying condition in the last layer grade of the last one level of above-mentioned target tier data Target data node generates target data sequence node;Based on the target data node institute in above-mentioned target data sequence node The leaf node number of storage determines that above-mentioned data return to the target indicated by initial value in above-mentioned target data sequence node The first object back end that leaf node is belonged to;Since above-mentioned target leaves node, above-mentioned first object is traversed successively The sequence in leaf node and/or above-mentioned target data sequence node included by back end is inferior to above-mentioned first object data Leaf node included by the back end of node, until the data under the above-mentioned field of above-mentioned data number are found, and will The data found are back to above-mentioned user terminal.
In some embodiments, above-mentioned to be based on above-mentioned target tier data, determine that above-mentioned data inquiry request is requested The relevant data of field with indicated by above-mentioned field name further include:If above-mentioned request type is inquired for quantity, and above-mentioned word Section name is for characterizing leaf node quantity, then included by the last layer grade of the last one level of above-mentioned target tier data The back end for meeting above-mentioned querying condition is determined in back end, to generate back end set;If above-mentioned data section point set Conjunction includes a back end, then the leaf node number that the back end is stored is back to above-mentioned user terminal.
In some embodiments, above-mentioned to be based on above-mentioned target tier data, determine that above-mentioned data inquiry request is requested The relevant data of field with indicated by above-mentioned field name further include:If above-mentioned back end set includes at least two data Node then sums to the leaf node number that each back end in above-mentioned back end set stores respectively, by summing The numerical value obtained is back to above-mentioned user terminal.
In some embodiments, for each hierarchical data in above-mentioned hierarchical data set, the number of levels is belonged to According to the node identification of leaf node stored by bitmap method.
In some embodiments, the above method further includes:In response to there is no above-mentioned in the above-mentioned hierarchical data set of determination Above-mentioned data inquiry request is then forwarded to connected data storage server, to be deposited from the data by target tier data Storage server receives the above-mentioned requested data of data inquiry request, and the data received are back to above-mentioned user's end End.
In some embodiments, the above method further includes:In response to there is no above-mentioned in the above-mentioned hierarchical data set of determination Target tier data, then to above-mentioned user terminal returned data failure prompt message.
Second aspect, the embodiment of the present application provide a kind of device for inquiring data, which includes:It receives single Member, be configured to receive user terminal send data inquiry request, wherein above-mentioned data inquiry request include user identifier, Field name and data version number;Determination unit is configured to determine in hierarchical data set with the presence or absence of included data mark Know the data version that versions of data number that is matched with above-mentioned user identifier and being included is included with above-mentioned data inquiry request This number identical target tier data, wherein above-mentioned hierarchical data set prestores in memory, above-mentioned hierarchical data set In each hierarchical data be provided with Data Identification and data version number;Data returning unit, is configured in response to determination There are above-mentioned target tier data in above-mentioned hierarchical data set, then are based on above-mentioned target tier data, determine that above-mentioned data are looked into The requested relevant data of field with indicated by above-mentioned field name of request are ask, and above-mentioned data are back to above-mentioned user's end End.
In some embodiments, for each hierarchical data in above-mentioned hierarchical data set, the hierarchical data it is every One level includes being provided at least one back end of node identification;For in the hierarchical data not being the last one layer Each level of grade, for each back end in the level, which includes in next level of the level At least one back end;Each back end in the last one above-mentioned level is leaf node, for above-mentioned last Each back end included by the last layer grade of one level, the back end are stored with the leaf of included leaf node Number of child nodes.
In some embodiments, above-mentioned data inquiry request further includes request type and querying condition, above-mentioned request type For following any one:Record queries, quantity inquiry;And it is that data returning unit includes:Subelement is searched, if being configured to Above-mentioned request type is record queries, then searches and meet under the above-mentioned field of the querying condition in above-mentioned target tier data Data.
In some embodiments, when above-mentioned request type is record queries, above-mentioned data inquiry request further includes data Return to initial value and data number;And above-mentioned lookup subelement includes:Searching module is used for if being configured to above-mentioned field name The data that characterization leaf node is included then determine in the last layer grade of the last one level of above-mentioned target tier data full The target data node of the above-mentioned querying condition of foot, generates target data sequence node;Based in above-mentioned target data sequence node The leaf node number that is stored of target data node, determine that above-mentioned data return in above-mentioned target data sequence node The first object back end that target leaves node indicated by initial value is belonged to;Since above-mentioned target leaves node, successively It traverses the leaf node included by above-mentioned first object back end and/or the sequence in above-mentioned target data sequence node is inferior to Leaf node included by the back end of above-mentioned first object back end, until finding the above-mentioned word of above-mentioned data number Data under section, and the data found are back to above-mentioned user terminal.
In some embodiments, above-mentioned data returning unit further includes:First data return to subelement, if on being configured to It states request type to inquire for quantity, and above-mentioned field name is used to characterize leaf node quantity, then in above-mentioned target tier data The last one level last layer grade included by back end in determine and meet the back end of above-mentioned querying condition, with life At back end set;If above-mentioned back end set includes a back end, the leaf which is stored Interstitial content is back to above-mentioned user terminal.
In some embodiments, above-mentioned data returning unit further includes:Second data return to subelement, if on being configured to It includes at least two back end to state back end set, then is deposited respectively to each back end in above-mentioned back end set The leaf node number of storage is summed, and the numerical value of summation gained is back to above-mentioned user terminal.
In some embodiments, for each hierarchical data in above-mentioned hierarchical data set, the number of levels is belonged to According to the node identification of leaf node stored by bitmap method.
In some embodiments, above-mentioned apparatus further includes:First data returning unit, is configured to above-mentioned in response to determination Above-mentioned target tier data are not present in hierarchical data set, then above-mentioned data inquiry request is forwarded to connected data and deposited Storage server to receive the above-mentioned requested data of data inquiry request from above-mentioned data storage server, and will receive To data be back to above-mentioned user terminal.
In some embodiments, above-mentioned apparatus further includes:Second data returning unit, is configured to above-mentioned in response to determination Above-mentioned target tier data are not present in hierarchical data set, then to above-mentioned user terminal returned data failure prompt message.
The third aspect, the embodiment of the present application provide a kind of server, which includes:One or more processors; Storage device, for storing one or more programs;When said one or multiple programs are held by said one or multiple processors Row so that said one or multiple processors realize the method as described in any realization method in first aspect.
Fourth aspect, the embodiment of the present application provide a kind of computer readable storage medium, are stored thereon with computer journey Sequence, which is characterized in that the method as described in any realization method in first aspect is realized when above procedure is executed by processor.
Method and apparatus provided by the embodiments of the present application for inquiring data, receive user terminal transmission include After the data inquiry request of user identifier, field name and data version number, it whether there is institute in hierarchical data set by determining Including Data Identification it is matched with the user identifier and the versions of data number that is included is included with the data inquiry request The identical target tier data of versions of data number, to determine in memory with the presence or absence of for the use indicated by the user terminal The valid data at family.Then after determining above-mentioned hierarchical data set there are above-mentioned target tier data, it is based on destination layer series According to, determine above-mentioned data inquiry request it is requested with above-mentioned field name indicated by the relevant data of field, and by the data It is back to above-mentioned user terminal.To be effectively utilized the determination to above-mentioned target tier data, avoids and return to user's end The data at end are invalid data, and then improve the validity of data query.
Description of the drawings
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other Feature, objects and advantages will become more apparent upon:
Fig. 1 is that this application can be applied to exemplary system architecture figures therein;
Fig. 2 is the flow chart according to one embodiment of the method for inquiring data of the application;
Fig. 3 is a schematic diagram of a hierarchical data comprising three levels;
Fig. 4 is the schematic diagram of an application scenarios corresponding with embodiment shown in Fig. 2;
Fig. 5 is the flow chart according to another embodiment of the method for inquiring data of the application;
Fig. 6 is the structural schematic diagram according to one embodiment of the device for inquiring data of the application;
Fig. 7 is adapted for the structural schematic diagram of the computer system of the server for realizing the embodiment of the present application.
Specific implementation mode
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to Convenient for description, is illustrated only in attached drawing and invent relevant part with related.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 shows the implementation of the method for inquiring data or the device for inquiring data that can apply the application The exemplary system architecture 100 of example.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104 and server 105. Network 104 between terminal device 101,102,103 and server 105 provide communication link medium.Network 104 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be interacted by network 104 with server 105 with using terminal equipment 101,102,103, with transmission data Inquiry request or reception data etc..Various telecommunication customer end applications, such as net can be installed on terminal device 101,102,103 The application of page browsing device, the application of data query class etc..
Terminal device 101,102,103 can be the various electronic equipments for having display screen, including but not limited to intelligent hand Machine, tablet computer, pocket computer on knee and desktop computer etc..
Server 105 can be to provide the server of various services, such as the number to the transmission of terminal device 101,102,103 It is handled according to inquiry request, and handling result (such as the requested data of data inquiry request) is back to terminal device.
It should be noted that the method for inquiring data that the embodiment of the present application is provided generally is held by server 105 Row, correspondingly, the device for inquiring data is generally positioned in server 105.
It should be understood that the number of the terminal device, network and server in Fig. 1 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
With continued reference to Fig. 2, the flow of one embodiment of the method for inquiring data according to the application is shown 200.The method for being used to inquire data, includes the following steps:
Step 201, the data inquiry request that user terminal is sent is received.
In the present embodiment, the method for inquiring data runs electronic equipment (such as service shown in FIG. 1 thereon Device 105) user terminal (such as terminal device shown in FIG. 1 can be received by wired connection mode or radio connection 101,102, the 103) data inquiry request sent.Wherein, which may include user identifier, field name sum number According to version number.Here, user identifier can be the user identifier of the user terminal owning user.The user identifier may include word The characters such as mother, number.Field name be the field name of field where the requested data of the data inquiry request or with the data phase The field name of the field of pass, for example, when the requested data of the data inquiry request are article mark or article mark quantity, The field name can be the field name of article mark field.The field name can be indicated with English, can also be indicated with Chinese.Example The field name " article mark " such as indicated with Chinese, the field name corresponding with " article mark " indicated with English "GoodsID".Versions of data number is hierarchical data associated with the requested data of the data inquiry request (such as with tree The data of shape storage organization) version number.
Step 202, it determines matched with the presence or absence of included Data Identification and user identifier, simultaneously in hierarchical data set And the identical target tier data of versions of data number that the versions of data number for being included is included with data inquiry request.
In the present embodiment, above-mentioned electronic equipment, can in memory in advance after receiving above-mentioned data inquiry request It is matched with above-mentioned user identifier and wrapped that included Data Identification is determined whether there is in the hierarchical data set of storage The versions of data number contained identical target tier data with the versions of data number that above-mentioned data inquiry request is included.Wherein, on Each hierarchical data stated in hierarchical data set is provided with Data Identification and data version number.Here, for above-mentioned level Each hierarchical data in data acquisition system, the Data Identification of the hierarchical data can be the users of the hierarchical data owning user Mark, can also be that above-mentioned electronic equipment is arranged automatically.The Data Identification of the hierarchical data can with belonging to the hierarchical data The advance associated storage of user identifier of user to correspondence list, correspondence list can be stored in above-mentioned electronic equipment It is local.If the Data Identification of each hierarchical data in above-mentioned hierarchical data set is the user of the hierarchical data owning user Mark, if the Data Identification of the hierarchical data is identical as the user identifier that above-mentioned data inquiry request is included, above-mentioned electricity Sub- equipment can determine that the Data Identification of the hierarchical data is matched with the user identifier that above-mentioned data inquiry request is included.
Optionally, if the Data Identification of each hierarchical data in above-mentioned hierarchical data set is not the hierarchical data institute Belong to the user identifier of user, then above-mentioned electronic equipment can by reading local pre-stored above-mentioned correspondence list, with It determines in the Data Identification of each hierarchical data in above-mentioned hierarchical data set and whether there is and above-mentioned data inquiry request institute Including the matched Data Identification of user identifier.
In some optional realization methods of the present embodiment, for each number of levels in above-mentioned hierarchical data set According to each level of the hierarchical data may include being provided at least one back end of node identification;For the level In data is not each level of the last one level, for each back end in the level, the back end At least one of next level including level back end;Each back end in the last one level is leaf Child node, each back end included by the last layer grade for the last one level, the back end store Including leaf node leaf node number.Please refer to Fig. 3, Fig. 3 shows hierarchical data comprising three levels One schematic diagram.In figure 3, back end 301,302 is the back end positioned at the first level.Back end 3011,3021 It is the back end positioned at the second level.Back end 3011 belongs to back end 301, is the child node of back end 301. Back end 3021 belongs to back end 302, is the child node of back end 302.Back end 30111,30112, 30211,30212 be the back end positioned at third level (i.e. the last one level of the hierarchical data), back end 30111,30112 back end 3011 is belonged to, is the child node of back end 3011.Back end 30211,30212 belongs to It is the child node of back end 3021 in back end 3021.Wherein, back end 30111,30112,30211,30212 can With referred to as leaf node.It should be pointed out that leaf node is construed as the back end of not child node.
In some optional realization methods of the present embodiment, for each number of levels in above-mentioned hierarchical data set According to belonging to the node identification of the leaf node of the hierarchical data can be stored by bitmap method (bitmap).This In, bitmap method can store certain state with each, be suitable for large-scale data, but data mode is not many feelings again Condition.For example, above-mentioned electronic equipment can pre-set a radix (such as 1024), it is the first preset value that a length, which is arranged, (such as 1000) and data type be basic integer (int) array, it is assumed that the array include 1000 elements, the array Including element call number from 0 to 999, if the node identification of some leaf node is " 1025 ", above-mentioned electronics sets Numerical value 1, the element that the call number in the array can be 1 by above-mentioned electronic equipment are obtained for radix 1024 can be subtracted by 1025 Value be set as 1.In this way, when storing large-scale data, a large amount of memory sky can be saved to store data by bitmap method Between, it can greatly mitigate memory load.
In some optional realization methods of the present embodiment, the hierarchical data in above-mentioned hierarchical data set is can be by It updates (such as increase, delete, change).Above-mentioned electronic equipment can be with data storage server (not shown in figure 1) telecommunication Connection, the hierarchical data that above-mentioned hierarchical data set is included can be the data in the data storage server.Here, on It can also be the server for supporting data synchronizing function to state electronic equipment or above-mentioned data storage server, when above-mentioned data are deposited When data in storage server have altered, above-mentioned data storage server or above-mentioned electronic equipment can be automatically by changes Data be synchronized in above-mentioned hierarchical data set, to ensure in above-mentioned hierarchical data set and above-mentioned data storage server Data consistency.It should be pointed out that when the data in each hierarchical data have altered, the data of the hierarchical data Version number also can and then change, such as the data change in the hierarchical data is primary, and the versions of data number of the hierarchical data will Increase 1.It should be noted that when the data in above-mentioned data storage server have altered, above-mentioned data storage server Or the latest data version number of the hierarchical data where the data of change can also be fed back to the number of levels by above-mentioned electronic equipment According to affiliated user.
Step 203, in response to determining, there are target tier data in hierarchical data set, then are based on target tier data, It determines the requested relevant data of field with indicated by field name of data inquiry request, and data is back to user's end End.
In the present embodiment, it is determined in above-mentioned hierarchical data set there are above-mentioned target tier data in response to step 202, Then above-mentioned electronic equipment can be based on above-mentioned target tier data, determine that above-mentioned data inquiry request is requested with above-mentioned field The relevant data of field indicated by name, and the data are back to above-mentioned user terminal.For example, above-mentioned target tier data The last one level includes article mark " 001 ", " 002 " and " 003 ", and above-mentioned field is entitled " article mark ", and above-mentioned electronics is set It is standby to search article in above-mentioned target tier data using depth-first traversal (Depth-First Traversa) algorithm Data under identification field, and the data found (such as " 001 ", " 002 " and " 003 ") are back to above-mentioned user terminal.
For another example above-mentioned electronic equipment can also count the number of the data under the above-mentioned article mark field found out Mesh is back to above-mentioned user terminal using the number as with the above-mentioned relevant data of article mark field.
It should be noted that depth-first traversal algorithm is the classic algorithm in graph theory, depth-first traversal algorithm is utilized The corresponding topological sorting table that target figure can be generated can easily solve many relevant graph theorys using topological sorting table and ask Topic, such as maximum path problem.Since depth-first traversal algorithm is the known technology studied and applied extensively at present, herein It repeats no more.
In some optional realization methods of the present embodiment, above-mentioned data inquiry request can also include request type and Querying condition, above-mentioned request type are following any one:Record queries, quantity inquiry.It is looked into if above-mentioned request type is record It askes, then above-mentioned electronic equipment can search data query that meet above-mentioned querying condition, above-mentioned in above-mentioned target tier data The data under field indicated by the included field name of request.Wherein, record queries can refer to inquiry specific field (such as object Product identification field) under field value (such as article mark " 10000 ", " 10001 " " 10002 " etc.);Quantity inquiry, which can refer to, looks into Ask the number of the field value under specific field.
Here, above-mentioned querying condition can limit the range of the requested data of above-mentioned data inquiry request.As an example, Above-mentioned target tier data include three levels, and the first level includes multiple articles (such as laptop, micro-wave oven) difference The category of affiliated level-one category (such as " computer ", " electric appliance ") identifies, and the second level includes that multiple article is affiliated respectively The category of two level category (such as " laptop ", " kitchen appliance ") identifies, and third level includes the article of multiple article Mark, it is assumed that above-mentioned field is entitled " article mark ", then it is (such as big can be that article mark is more than preset value for above-mentioned querying condition In 1000), above-mentioned querying condition can be that the category mark of seconds class is among default value range, above-mentioned querying condition Second preset value etc. can also be equal to for the category mark of level-one category.The content that is included for above-mentioned querying condition, on The size of preset value and above-mentioned second preset value is stated, the present embodiment does not do any restriction to content in this respect.Above-mentioned preset value and Above-mentioned second preset value can modify according to actual needs.
In some optional realization methods of the present embodiment, if above-mentioned electronic equipment determines in above-mentioned hierarchical data set There is no above-mentioned target tier data, above-mentioned data inquiry request can be forwarded to above-mentioned data storage and used by above-mentioned electronic equipment Server to receive the above-mentioned requested data of data inquiry request from above-mentioned data storage server, and the data is returned It is back to above-mentioned user terminal.
In some optional realization methods of the present embodiment, if above-mentioned electronic equipment determines in above-mentioned hierarchical data set There is no above-mentioned target tier data, above-mentioned electronic equipment can also be to above-mentioned user terminal returned data failure prompt message.
It is a signal according to the application scenarios of the method for inquiring data of the present embodiment with continued reference to Fig. 4, Fig. 4 Figure.In the application scenarios of Fig. 4, user initiates a data inquiry request by user terminal 401 to server 402 first 403, wherein data inquiry request 403 includes user identifier " 001 ", field name " article mark " and data version number " 10 ".It Afterwards, server 402 can by user identifier " 001 " and data version number " 10 " respectively with pre-stored hierarchical data in memory The Data Identification of each hierarchical data in set 404 and data version number are compared, and determine included Data Identification " 001 " and above-mentioned user identifier " 001 " be matched and the versions of data number " 10 " for being included and 403 institute of data inquiry request Including the identical target tier data of versions of data number " 10 " 4041, it is assumed that target tier data 4041 include article mark "10000","10001","10002".Finally, server 402 can utilize depth-first traversal algorithm to traverse destination layer series According to the data in 4041, the article mark indicated by 403 requested field name " article mark " of data inquiry request is found out Data 40411 under field, i.e. article mark " 10000 ", " 10001 ", " 10002 ", the object that server 402 can will be found out Product mark " 10000 ", " 10001 ", " 10002 " are back to user terminal 401.
The method that above-described embodiment of the application provides avoids return by the determination to above-mentioned target tier data Data to user terminal are invalid data, and then improve the validity of data query.
With further reference to Fig. 5, it illustrates the flows 500 for inquiring another embodiment of the method for data.This is used for The flow 500 for inquiring the method for data, includes the following steps:
Step 501, the data inquiry request that user terminal is sent is received.
In the present embodiment, the method for inquiring data runs electronic equipment (such as service shown in FIG. 1 thereon Device 105) user terminal (such as terminal device shown in FIG. 1 can be received by wired connection mode or radio connection 101,102, the 103) data inquiry request sent.Wherein, which may include user identifier, field name, number Initial value and data number are returned according to version number, request type, querying condition, data.Here, for user identifier, field name, The explanation of versions of data number, request type and querying condition can be respectively referring in above-mentioned steps 201 and above-mentioned steps 203 Associated description, details are not described herein.It can be expressed as from satisfaction it should be noted that data return to initial value and data number The above-mentioned data in the data under field indicated by field name that state querying condition, that above-mentioned data inquiry request is included It returns to initial value data to start to return to above-mentioned user terminal, until continuously returning to above-mentioned data number data.On for example, It is 10000 to state data and return to initial value, and above-mentioned data number is 30, the entitled " object of field that above-mentioned data inquiry request is included Product identify ", above-mentioned electronic equipment finds out the article mark met indicated by the field name " article mark " of above-mentioned querying condition Know under 11000 datas, then above-mentioned electronic equipment can be returned to since the 10000th data of 11000 data Above-mentioned user terminal, until continuous return to 30 datas.
Step 502, it determines matched with the presence or absence of included Data Identification and user identifier, simultaneously in hierarchical data set And the identical target tier data of versions of data number that the versions of data number for being included is included with data inquiry request.
In the present embodiment, which can be stored in advance in the memory of above-mentioned electronic equipment, the level Each hierarchical data in data acquisition system can be provided with Data Identification and data version number.For in the hierarchical data set Each hierarchical data, each level of the hierarchical data may include being provided at least one data section of node identification Point;For in the hierarchical data be not the last one level each level, for each data section in the level Point, the back end include at least one of next level of level back end;It is each in the last one level A back end is leaf node, each back end included by the last layer grade for the last one level, the number The leaf node number of included leaf node is stored with according to node.It here, can for the determination method of target tier data Referring to the associated description in above-mentioned steps 202, details are not described herein.
Here, if above-mentioned electronic equipment determines that there are above-mentioned target tier data and above-mentioned in above-mentioned hierarchical data set Request type is record queries, then above-mentioned electronic equipment can execute step 503-505.If above-mentioned electronic equipment determines above-mentioned layer There are above-mentioned target tier data and above-mentioned request type it is quantity inquiry in level data set, then above-mentioned electronic equipment can be with Step 506-507 is executed, or executes step 506 and 508.
Step 503, if field name is for characterizing the data that leaf node is included, in last of target tier data The target data node for meeting querying condition is determined in the last layer grade of a level, generates target data sequence node.
In the present embodiment, if the field name that above-mentioned data inquiry request is included is used to characterize what leaf node was included Data (such as node identification of leaf node), then above-mentioned electronic equipment can be in the last one layer of above-mentioned target tier data The target data node for meeting above-mentioned querying condition is determined in the last layer grade of grade, generates target data sequence node.As showing Example, the field that above-mentioned data inquiry request is included is entitled " article mark ", and above-mentioned querying condition is the category mark of two level category Know among 10 to 12 (including 10 and 12).Above-mentioned target tier data include three levels, and the first level includes multiple is used for The back end of level-one category is characterized, the second level includes multiple back end for characterizing two level category, third level packet Include multiple back end (i.e. leaf node) for characterizing Item Information, the node of each back end in each level Mark is the article mark of the article indicated by the Item Information that the category for the category that the back end is characterized is identified or characterized Know.Above-mentioned electronic equipment can traverse the number for belonging to the back end in back end and the second level in the first level According to node, to determine that the node identification in the second level is respectively target data node A, B and C of " 10 ", " 11 " and " 12 ", And generate the target data sequence node P that included target data node is followed successively by A, B and C.
Step 504, the leaf node number stored based on the target data node in target data sequence node, in mesh Determine that data return to the first object data section that the target leaves node indicated by initial value is belonged in mark back end sequence Point.
In the present embodiment, after generating above-mentioned target data sequence node, above-mentioned electronic equipment can be based on above-mentioned The leaf node number that target data node in target data sequence node is stored, in above-mentioned target data sequence node Determine that above-mentioned data return to the first object back end that the target leaves node indicated by initial value is belonged to.Continue with step For example in 503, it is assumed that it is 10000 that above-mentioned data, which return to initial value, and above-mentioned data number is 30, target data node A The leaf node number stored is 5000, and the leaf node number that target data node B is stored is 4000, target data section The leaf node number that point C is stored is 6000, then above-mentioned electronic equipment can by the way that 5000 and 4000 are added up, then with Above-mentioned data return to initial value 10000 and are compared, to determine that data return to initial value in target data sequence node P The first object back end that target leaves node D indicated by 10000 is belonged to, i.e. target data node C.Wherein, target Leaf node D is the 1000th leaf node in target data node C.
Step 505, since target leaves node, the leaf node included by first object back end is traversed successively And/or the leaf node included by back end of the sequence in target data sequence node inferior to first object back end, Until finding the data under the field indicated by the field name that data number data inquiry request is included, and will find Data be back to above-mentioned user terminal.
In the present embodiment, after determining first object back end that target leaves node is belonged to, above-mentioned electronics Equipment can traverse the leaf node included by above-mentioned first object back end successively since above-mentioned target leaves node And/or the leaf included by back end of the sequence in above-mentioned target data sequence node inferior to above-mentioned first object back end Child node, until finding above-mentioned data number data (indicated by the field name that i.e. above-mentioned data inquiry request is included Data under field).Continue by taking the example in step 504 as an example, above-mentioned electronic equipment can since target leaves node D, The leaf node included by first object back end is traversed successively, until 30 leaf nodes of traversal, wherein above-mentioned electronics is set It is standby to be recorded in one leaf node of every traversal in the node identification to memory or caching of the leaf node.Here, above-mentioned The data found can be back to above-mentioned user terminal by electronic equipment in the form of such as text or picture.
Step 506, if request type is inquired for quantity, and field name is used to characterize leaf node quantity, then in target The back end for meeting querying condition is determined in back end included by the last layer grade of the last one level of hierarchical data, To generate back end set.
In the present embodiment, if above-mentioned request type is inquired for quantity, and the word that above-mentioned data inquiry request is included Section name is for characterizing leaf node quantity, such as above-mentioned field entitled " leaf node quantity " or " leaf node mark quantity " Deng above-mentioned electronic equipment can be in the data section included by a upper level for the last one level of above-mentioned target tier data The back end for meeting above-mentioned querying condition is determined in point, to generate back end set.As an example, above-mentioned querying condition is The category mark of two level category is more than 100 and less than 103, and above-mentioned target tier data include 3 levels, and the second level includes Multiple product that for characterizing the back end of different two level categories, the node identification of the back end is characterized for the back end The category of class identifies, then above-mentioned electronic equipment can be determined to meet above-mentioned look into the back end included by second level The node identification of inquiry condition is respectively 101,102 back end A, B, and above-mentioned electronic equipment can be generated comprising back end A With the back end set Q of back end B.
Step 507, if back end set includes a back end, the leaf node number that back end is stored Mesh is back to user terminal.
In the present embodiment, if above-mentioned back end set includes a back end, above-mentioned electronic equipment can incite somebody to action The leaf node number that the back end is stored is back to above-mentioned user terminal.
Step 508, if back end set includes at least two back end, to each number in data node set The numerical value of summation gained is back to user terminal by the leaf node number summation stored respectively according to node.
In the present embodiment, if above-mentioned back end set includes at least two back end, above-mentioned electronic equipment can With the leaf node number summation stored respectively to each back end in above-mentioned back end set, by the number of summation gained Value is back to above-mentioned user terminal.By taking the example in step 506 as an example, it is assumed that back end A, B institutes in back end set Q The leaf node number of storage is respectively 5000,4000, then above-mentioned electronic equipment can obtain numerical value to 5000 and 4000 summations 9000, numerical value 9000 can be back to above-mentioned user terminal by above-mentioned electronic equipment.
From figure 5 it can be seen that compared with the corresponding embodiments of Fig. 2, the method for inquiring data in the present embodiment Flow 500 highlight the step of being extended to data query.The scheme of the present embodiment description passes through pre-stored as a result, Leaf node number may be implemented to look into the quick jump of data, greatly improve efficiency data query.
With further reference to Fig. 6, as the realization to method shown in above-mentioned each figure, this application provides one kind for inquiring number According to device one embodiment, the device embodiment is corresponding with embodiment of the method shown in Fig. 2, which can specifically answer For in various electronic equipments.
As shown in fig. 6, the device 600 shown in the present embodiment for inquiring data includes:Receiving unit 601 determines list Member 602 and data returning unit 603.Wherein, receiving unit 501 be configured to receive user terminal send data query ask It asks, wherein above-mentioned data inquiry request includes user identifier, field name and data version number;Determination unit 602 is configured to really With the presence or absence of the data that included Data Identification is matched with above-mentioned user identifier and is included in given layer level data set The identical target tier data of versions of data number that version number is included with above-mentioned data inquiry request, wherein above-mentioned number of levels It is prestored in memory according to set, each hierarchical data in above-mentioned hierarchical data set is provided with Data Identification and data Version number;And data returning unit 603 is configured in response to there are above-mentioned target tiers in the above-mentioned hierarchical data set of determination Data are then based on above-mentioned target tier data, determine above-mentioned data inquiry request it is requested with above-mentioned field name indicated by The relevant data of field, and above-mentioned data are back to above-mentioned user terminal.
In the present embodiment, for inquiring in the device 600 of data:Receiving unit 601, determination unit 602 and data are returned The specific processing of receipt member 603 and its caused technique effect can be respectively with reference to step 201, the steps in 2 corresponding embodiment of figure Rapid 202 and step 203 related description, details are not described herein.
In some optional realization methods of the present embodiment, for each number of levels in above-mentioned hierarchical data set According to each level of the hierarchical data may include being provided at least one back end of node identification;For the level In data is not each level of the last one level, for each back end in the level, the back end It may include at least one of next level of level back end;Each data section in the last one above-mentioned level Point is leaf node, each back end included by the last layer grade for the last one above-mentioned level, the back end It is stored with the leaf node number of included leaf node.
In some optional realization methods of the present embodiment, above-mentioned data inquiry request can also include request type and Querying condition, above-mentioned request type are following any one:Record queries, quantity inquiry;And above-mentioned data returning unit 603 May include:Subelement (not shown) is searched, if it is record queries to be configured to above-mentioned request type, in above-mentioned target The data met under the above-mentioned field of above-mentioned querying condition are searched in hierarchical data.
In some optional realization methods of the present embodiment, when above-mentioned request type is record queries, above-mentioned data Inquiry request can also include that data return to initial value and data number;And above-mentioned lookup subelement can also include:It searches Module (not shown), if being configured to above-mentioned field name for characterizing the data that leaf node is included, in above-mentioned mesh The target data node for being determined in the last layer grade of the last one level of hierarchical data and meeting above-mentioned querying condition is marked, mesh is generated Mark back end sequence;Based on the leaf node number that the target data node in above-mentioned target data sequence node is stored, Determine that above-mentioned data return to that the target leaves node indicated by initial value belonged in above-mentioned target data sequence node the One target data node;Since above-mentioned target leaves node, the leaf included by above-mentioned first object back end is traversed successively Sequence in child node and/or above-mentioned target data sequence node is wrapped inferior to the back end of above-mentioned first object back end The leaf node included until finding the data under the above-mentioned field of above-mentioned data number, and the data found is back to Above-mentioned user terminal.
In some optional realization methods of the present embodiment, above-mentioned data returning unit 603 can also include:First number According to subelement (not shown) is returned, inquired for quantity if being configured to above-mentioned request type, and above-mentioned field name is used for Leaf node quantity is characterized, then the back end included by the last layer grade of the last one level of above-mentioned target tier data Middle determination meets the back end of above-mentioned querying condition, to generate back end set;If above-mentioned back end set includes one The leaf node number that the back end is stored then is back to above-mentioned user terminal by a back end.
In some optional realization methods of the present embodiment, above-mentioned data returning unit 603 can also include:Second number It is right if it includes at least two back end to be configured to above-mentioned back end set according to return subelement (not shown) The leaf node number summation that each back end in above-mentioned back end set stores respectively, the numerical value of summation gained is returned It is back to above-mentioned user terminal.
In some optional realization methods of the present embodiment, for each number of levels in above-mentioned hierarchical data set According to belonging to the node identification of the leaf node of the hierarchical data can be stored by bitmap method.
In some optional realization methods of the present embodiment, above-mentioned apparatus 600 can also include:First data return single First (not shown) is configured in response to above-mentioned target tier data are not present in the above-mentioned hierarchical data set of determination, then Above-mentioned data inquiry request is forwarded to connected data storage server, to be received from above-mentioned data storage with server The above-mentioned requested data of data inquiry request, and the data received are back to above-mentioned user terminal.
In some optional realization methods of the present embodiment, above-mentioned apparatus 600 can also include:Second data return single First (not shown) is configured in response to above-mentioned target tier data are not present in the above-mentioned hierarchical data set of determination, then To above-mentioned user terminal returned data failure prompt message.
The device that above-described embodiment of the application provides avoids return by the determination to above-mentioned target tier data Data to user terminal are invalid data, and then improve the validity of data query.
Below with reference to Fig. 7, it illustrates the computer systems 700 suitable for the server for realizing the embodiment of the present application Structural schematic diagram.Server shown in Fig. 7 is only an example, should not be to the function and use scope band of the embodiment of the present application Carry out any restrictions.
As shown in fig. 7, computer system 700 includes central processing unit (CPU) 701, it can be read-only according to being stored in Program in memory (ROM) 702 or be loaded into the program in random access storage device (RAM) 703 from storage section 708 and Execute various actions appropriate and processing.In RAM 703, also it is stored with system 700 and operates required various programs and data. CPU 701, ROM 702 and RAM 703 are connected with each other by bus 704.Input/output (I/O) interface 705 is also connected to always Line 704.
It is connected to I/O interfaces 705 with lower component:Importation 706 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 707 of spool (CRT), liquid crystal display (LCD) etc. and loud speaker etc.;Storage section 708 including hard disk etc.; And the communications portion 709 of the network interface card including LAN card, modem etc..Communications portion 709 via such as because The network of spy's net executes communication process.Driver 710 is also according to needing to be connected to I/O interfaces 705.Detachable media 711, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on driver 710, as needed in order to be read from thereon Computer program be mounted into storage section 708 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium On computer program, which includes the program code for method shown in execution flow chart.In such reality It applies in example, which can be downloaded and installed by communications portion 709 from network, and/or from detachable media 711 are mounted.When the computer program is executed by central processing unit (CPU) 701, executes and limited in the system of the application Above-mentioned function.
It should be noted that computer-readable medium shown in the application can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two arbitrarily combines.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or arbitrary above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to:Electrical connection with one or more conducting wires, just It takes formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type and may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In this application, can be any include computer readable storage medium or storage journey The tangible medium of sequence, the program can be commanded the either device use or in connection of execution system, device.And at this In application, computer-readable signal media may include in a base band or as the data-signal that a carrier wave part is propagated, Wherein carry computer-readable program code.Diversified forms may be used in the data-signal of this propagation, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By instruction execution system, device either device use or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to:Wirelessly, electric wire, optical cable, RF etc. or above-mentioned Any appropriate combination.
Flow chart in attached drawing and block diagram, it is illustrated that according to the system of the various embodiments of the application, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part for a part for one module, program segment, or code of table, above-mentioned module, program segment, or code includes one or more Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical On can be basically executed in parallel, they can also be executed in the opposite order sometimes, this is depended on the functions involved.Also it wants It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction It closes to realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard The mode of part is realized.Described unit can also be arranged in the processor, for example, can be described as:A kind of processor packet Include receiving unit, determination unit and data returning unit.Wherein, the title of these units is not constituted to this under certain conditions The restriction of unit itself, for example, receiving unit is also described as " receiving the list for the data inquiry request that user terminal is sent Member ".
As on the other hand, present invention also provides a kind of computer-readable medium, which can be Included in server described in above-described embodiment;Can also be individualism, and without be incorporated the server in.It is above-mentioned Computer-readable medium carries one or more program, when said one or multiple programs are executed by the server When so that the server includes:Receive the data inquiry request that user terminal is sent, wherein above-mentioned data inquiry request includes User identifier, field name and data version number;Determine in hierarchical data set with the presence or absence of included Data Identification with it is above-mentioned User identifier is matched and the versions of data number that is included is identical as the versions of data number that above-mentioned data inquiry request is included Target tier data, wherein above-mentioned hierarchical data set prestores in memory, each in above-mentioned hierarchical data set A hierarchical data is provided with Data Identification and data version number;In response to there are above-mentioned targets in the above-mentioned hierarchical data set of determination Hierarchical data is then based on above-mentioned target tier data, determines that above-mentioned data inquiry request is requested signified with above-mentioned field name The relevant data of field shown, and the data are back to above-mentioned user terminal.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.People in the art Member should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature Other technical solutions of arbitrary combination and formation.Such as features described above has similar work(with (but not limited to) disclosed herein Can technical characteristic replaced mutually and the technical solution that is formed.

Claims (17)

1. a kind of method for inquiring data, which is characterized in that the method includes:
Receive user terminal send data inquiry request, wherein the data inquiry request include user identifier, field name and Versions of data number;
It determines matched with the user identifier with the presence or absence of included Data Identification in hierarchical data set and is included The versions of data number identical target tier data of versions of data number that are included with the data inquiry request, wherein it is described Hierarchical data set prestores in memory, each hierarchical data in the hierarchical data set is provided with Data Identification With data version number;
In response to there are the target tier data in the determination hierarchical data set, then the target tier data are based on, It determines the requested relevant data of field with indicated by the field name of the data inquiry request, and the data is returned It is back to the user terminal.
2. according to the method described in claim 1, it is characterized in that, for each number of levels in the hierarchical data set According to each level of the hierarchical data includes being provided at least one back end of node identification;For the hierarchical data In be not the last one level each level, for each back end in the level, which includes At least one of next level of level back end;Each back end in the last one described level is leaf Node, each back end included by the last layer grade for the last one level, the back end store Including leaf node leaf node number.
3. according to the method described in one of claim 1-2, which is characterized in that the data inquiry request further includes request type And querying condition, the request type are following any one:Record queries, quantity inquiry;And
It is described to be based on the target tier data, determine the data inquiry request it is requested with the field name indicated by The relevant data of field, including:
If the request type is record queries, searches and meet described in the querying condition in the target tier data Data under field.
4. according to the method described in claim 3, it is characterized in that, when the request type be record queries when, the data Inquiry request further includes that data return to initial value and data number;And
If the request type is record queries, is searched in the target tier data and meet the querying condition Data under the field, including:
If the field name is for characterizing the data that leaf node is included, in the last one layer of the target tier data The target data node for meeting the querying condition is determined in the last layer grade of grade, generates target data sequence node;Based on institute The leaf node number that the target data node in target data sequence node is stored is stated, in the target data sequence node The middle determination data return to the first object back end that the target leaves node indicated by initial value is belonged to;From the mesh Mark leaf node starts, and traverses the leaf node included by the first object back end and/or the target data successively The leaf node included by back end of the sequence inferior to the first object back end in sequence node, until finding Data under the data number field, and the data found are back to the user terminal.
5. according to the method described in claim 3, it is characterized in that, it is described be based on the target tier data, determine the number According to the requested relevant data of field with indicated by the field name of inquiry request, further include:
If the request type is inquired for quantity, and the field name is used to characterize leaf node quantity, then in the target The data for meeting the querying condition are determined in back end included by the last layer grade of the last one level of hierarchical data Node, to generate back end set;If the back end set includes a back end, which is deposited The leaf node number of storage is back to the user terminal.
6. according to the method described in claim 5, it is characterized in that, it is described be based on the target tier data, determine the number According to the requested relevant data of field with indicated by the field name of inquiry request, further include:
If the back end set includes at least two back end, to each data section in the back end set The numerical value of summation gained is back to the user terminal by the leaf node number summation that point stores respectively.
7. according to the method described in claim 2, it is characterized in that, for each number of levels in the hierarchical data set According to the node identification for belonging to the leaf node of the hierarchical data is stored by bitmap method.
8. according to the method described in claim 1, it is characterized in that, the method further includes:
In response to the target tier data are not present in the determination hierarchical data set, then the data inquiry request is turned It is sent to connected data storage server, is asked with receiving the data inquiry request from the data storage server The data asked, and the data received are back to the user terminal.
9. according to the method described in right 1, which is characterized in that the method further includes:
In response to the target tier data are not present in the determination hierarchical data set, then number is returned to the user terminal According to failure prompt message.
10. a kind of for inquiring the devices of data, which is characterized in that described device includes:
Receiving unit is configured to receive the data inquiry request that user terminal is sent, wherein the data inquiry request includes User identifier, field name and data version number;
Determination unit is configured to determine in hierarchical data set with the presence or absence of included Data Identification and the user identifier The identical destination layer of versions of data number that versions of data number that is matched and being included is included with the data inquiry request Level data, wherein the hierarchical data set prestores in memory, each number of levels in the hierarchical data set According to being provided with Data Identification and data version number;
Data returning unit is configured in response to there are the target tier data in the determination hierarchical data set, then Based on the target tier data, determine that the data inquiry request is requested related to the field indicated by the field name Data, and the data are back to the user terminal.
11. device according to claim 10, which is characterized in that for each level in the hierarchical data set Data, each level of the hierarchical data include being provided at least one back end of node identification;For the number of levels In is not each level of the last one level, for each back end in the level, the back end packet Include at least one of next level of level back end;Each back end in the last one described level is leaf Child node, each back end included by the last layer grade for the last one level, the back end are stored with The leaf node number of included leaf node.
12. according to the device described in one of claim 10-11, which is characterized in that the data inquiry request further includes request Type and querying condition, the request type are following any one:Record queries, quantity inquiry;And
The data returning unit includes:
Subelement is searched, if it is record queries to be configured to the request type, is searched in the target tier data full Data under the field of the foot querying condition.
13. device according to claim 12, which is characterized in that when the request type is record queries, the number Further include that data return to initial value and data number according to inquiry request;And
The lookup subelement includes:
Searching module, if being configured to the field name for characterizing the data that leaf node is included, in the destination layer The target data node for meeting the querying condition is determined in the last layer grade of the last one level of level data, generates number of targets According to sequence node;Based on the leaf node number that the target data node in the target data sequence node is stored, in institute It states and determines that the data return to the first mesh that the target leaves node indicated by initial value is belonged in target data sequence node Mark back end;Since the target leaves node, the leaf section included by the first object back end is traversed successively Included by back end of the sequence inferior to the first object back end in point and/or the target data sequence node Leaf node until find the data under the data number field, and the data found is back to described User terminal.
14. device according to claim 12, which is characterized in that the data returning unit further includes:
First data return to subelement, are inquired for quantity if being configured to the request type, and the field name is used for table Leaf node quantity is levied, then in the back end included by the last layer grade of the last one level of the target tier data The back end for meeting the querying condition is determined, to generate back end set;If the back end set includes one The leaf node number that the back end is stored then is back to the user terminal by back end.
15. device according to claim 14, which is characterized in that the data returning unit further includes:
Second data return to subelement, if it includes at least two back end to be configured to the back end set, to institute The leaf node number summation that each back end in back end set stores respectively is stated, the numerical value of summation gained is returned To the user terminal.
16. a kind of server, which is characterized in that including:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors so that one or more of processors are real The now method as described in any in claim 1-9.
17. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that described program is handled The method as described in any in claim 1-9 is realized when device executes.
CN201710242321.6A 2017-04-13 2017-04-13 Method and device for querying data Active CN108733668B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710242321.6A CN108733668B (en) 2017-04-13 2017-04-13 Method and device for querying data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710242321.6A CN108733668B (en) 2017-04-13 2017-04-13 Method and device for querying data

Publications (2)

Publication Number Publication Date
CN108733668A true CN108733668A (en) 2018-11-02
CN108733668B CN108733668B (en) 2021-10-19

Family

ID=63923760

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710242321.6A Active CN108733668B (en) 2017-04-13 2017-04-13 Method and device for querying data

Country Status (1)

Country Link
CN (1) CN108733668B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110795632A (en) * 2019-10-30 2020-02-14 北京达佳互联信息技术有限公司 State query method and device and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070162465A1 (en) * 2003-06-27 2007-07-12 Bill Cope Method and apparatus for the creation, location and formatting of digital content
CN102546798A (en) * 2011-12-31 2012-07-04 易程科技股份有限公司 Data transmission method and system of train-mounted terminal, server and train-mounted terminal
CN103106092A (en) * 2013-02-18 2013-05-15 青岛海信宽带多媒体技术有限公司 System software updating method and device in terminal appliance
CN103793470A (en) * 2013-12-31 2014-05-14 远光软件股份有限公司 Data processing method and data processing device
US20160063174A1 (en) * 2014-08-26 2016-03-03 Dassault Systemes Execution of sequential update
CN105488172A (en) * 2015-11-30 2016-04-13 北京奇艺世纪科技有限公司 Location-based data query method and device
US20170060912A1 (en) * 2015-08-26 2017-03-02 Oracle International Corporation Techniques related to binary encoding of hierarchical data objects to support efficient path navigation of the hierarchical data objects

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070162465A1 (en) * 2003-06-27 2007-07-12 Bill Cope Method and apparatus for the creation, location and formatting of digital content
CN102546798A (en) * 2011-12-31 2012-07-04 易程科技股份有限公司 Data transmission method and system of train-mounted terminal, server and train-mounted terminal
CN103106092A (en) * 2013-02-18 2013-05-15 青岛海信宽带多媒体技术有限公司 System software updating method and device in terminal appliance
CN103793470A (en) * 2013-12-31 2014-05-14 远光软件股份有限公司 Data processing method and data processing device
US20160063174A1 (en) * 2014-08-26 2016-03-03 Dassault Systemes Execution of sequential update
US20170060912A1 (en) * 2015-08-26 2017-03-02 Oracle International Corporation Techniques related to binary encoding of hierarchical data objects to support efficient path navigation of the hierarchical data objects
CN105488172A (en) * 2015-11-30 2016-04-13 北京奇艺世纪科技有限公司 Location-based data query method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110795632A (en) * 2019-10-30 2020-02-14 北京达佳互联信息技术有限公司 State query method and device and electronic equipment
CN110795632B (en) * 2019-10-30 2022-10-04 北京达佳互联信息技术有限公司 State query method and device and electronic equipment

Also Published As

Publication number Publication date
CN108733668B (en) 2021-10-19

Similar Documents

Publication Publication Date Title
CN109409119A (en) Data manipulation method and device
CN108228887B (en) Method and apparatus for generating information
CN109697075A (en) File updating method, system and device
CN110298716A (en) Information-pushing method and device
CN108256070A (en) For generating the method and apparatus of information
CN110348771A (en) The method and apparatus that a kind of pair of order carries out group list
CN108984553A (en) Caching method and device
CN108776692A (en) Method and apparatus for handling information
CN109783197A (en) Dispatching method and device for program runtime environment
CN110019552A (en) User pays close attention to the method and apparatus that state updates
CN110019263A (en) Information storage means and device
CN108170843A (en) For obtaining the method and apparatus of data
CN108154024A (en) A kind of data retrieval method, device and electronic equipment
CN109213824A (en) Data grabber system, method and apparatus
CN109885593A (en) Method and apparatus for handling information
CN109409419A (en) Method and apparatus for handling data
CN109639801A (en) Back end distribution and data capture method and system
CN110321242A (en) Data processing method and device
CN108733668A (en) Method and apparatus for inquiring data
CN108959294A (en) A kind of method and apparatus accessing search engine
CN108052290A (en) For storing the method and apparatus of data
CN110493291A (en) A kind of method and apparatus handling HTTP request
CN108804442A (en) Sequence number generation method and device
CN108874838A (en) Page push method and apparatus
CN110147368A (en) Data capture method and device for server

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
GR01 Patent grant
GR01 Patent grant