CN103902554A - Data access method and device - Google Patents

Data access method and device Download PDF

Info

Publication number
CN103902554A
CN103902554A CN201210573013.9A CN201210573013A CN103902554A CN 103902554 A CN103902554 A CN 103902554A CN 201210573013 A CN201210573013 A CN 201210573013A CN 103902554 A CN103902554 A CN 103902554A
Authority
CN
China
Prior art keywords
key word
user data
data
configuration file
sub
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
CN201210573013.9A
Other languages
Chinese (zh)
Other versions
CN103902554B (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201210573013.9A priority Critical patent/CN103902554B/en
Publication of CN103902554A publication Critical patent/CN103902554A/en
Application granted granted Critical
Publication of CN103902554B publication Critical patent/CN103902554B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a data access method and device. The data access method comprises the steps that a keyword of user data is obtained according to a data definition, wherein the data definition defines the keyword corresponding to the user data of a certain service and a keyword corresponding to a configuration file of the service, and the keywords corresponding to the user data and the configuration file of the same service are the same; the user data are obtained according to the keyword of the user data, and a user data tree is generated; access to the user data tree and/or the configuration file is conducted according to the keywords. By the adoption of the data access method and device, uniform access and management of the user data and configuration data are achieved.

Description

Data access method and device
Technical field
The present invention relates to client application technical field, particularly relate to a kind of data access method and device.
Background technology
Client application is the software of realizing specific function that is deployed in client, as Ali Wang Wang, QQ, antivirus software etc.Client application is generally formed by each complicated combinations of services, as the flow process of changing software interface outward appearance business comprises: access associated server, various outward appearances are provided, select to push associated appearance data, recording user selection etc. according to user.
Each business of client application has the dependence of configuration data and the generation of user data, at present the treating method of configuration data and user data is mainly contained: method one, configuration data are stored in the configuration file of each business, the own access of each business and resolution data, user data and configuration data are managed separately; Method two, user data and configuration data are all by third party database storage.In said method, the configuration data editing operation simple and flexible of a pair of client application of method, but there will be configuration file numerous and at random, make configuration data be difficult to maintenance and management; Each business must go to operate disk file and resolution data simultaneously, makes the code of the parsing configuration data software of writing mixed and disorderly, and execution efficiency is low simultaneously; Although the configuration data of method two is managed concentratedly, there is unified Data Analysis, but because user data and configuration data are stored in a database file, therefore edited configuration data complicated operation, and the configuration data later stage, while having change, cannot be updated on the machine of client timely.
Therefore, when existing data processing method is gone the data of parsing and access self when each business, data can be messy, and inefficiency, and data are clear and efficient management is got up rapidly, thereby causes improving the efficiency in software development process.
Summary of the invention
The invention provides a kind of data access method and device, to solve existing data processing scheme inefficiency, cannot be rapidly data are clear and problem that efficient management is got up.
In order to address the above problem, the invention discloses a kind of data access method, comprise: the key word that obtains user data according to data definition, wherein, described data definition has defined key word that the user data of certain business is corresponding and the key word corresponding to configuration file of described business, wherein, the key word that the key word that the user data of same business is corresponding is corresponding with the configuration file of this business is identical; Obtain user data according to the key word of described user data, generate user data tree; According to described key word, described user data tree and/or described configuration file are conducted interviews.
Preferably, the described key word according to described user data obtains user data, the step that generates user data tree comprises: the key word to described user data is resolved, and successively described key word is resolved to one to multiple level key word according to the separator in described key word; Wherein, if described key word resolves to one-level key word, described one-level key word is father's key word; If described key word resolves to multistage key word, described multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level, wherein, the user data that the key word of a rank is corresponding comprises other user data at the corresponding levels and lower than user data corresponding to other key word at the corresponding levels; Determine the user data that key words at different levels are corresponding, generate the user data tree of described user data according to the rank of described key words at different levels.
Preferably, described according to described key word, the step that described user data is set and/or described configuration file conducts interviews is comprised: in the time described user data being set and/or described configuration file carries out read access, judge whether to exist corresponding user data tree according to described key word; If exist, judge under father's key word node of described user data tree whether have sub-key word node; If there is not described sub-key word node, return to user data corresponding to described father's key word node; If there is described sub-key word node, determine sub-key word node to be visited, return to described user data corresponding to sub-key word node to be visited; If there is not corresponding user data tree, access described configuration file according to described key word, return to the configuration data in described configuration file.
Preferably, the key word that described configuration file is corresponding is divided into one to multiple level key word according to the separator in described key word, and wherein, if described key word is divided into one-level key word, described one-level key word is father's key word; If described key word is divided into multistage key word, described multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level; Configuration data in described configuration file is according to described one to multiple level key word corresponding stored, and wherein, the configuration data that the key word of a rank is corresponding comprises other configuration data at the corresponding levels and lower than configuration data corresponding to other key word at the corresponding levels; Describedly access described configuration file according to described key word, the step of returning to the configuration data in described configuration file comprises: judge under described father's key word, whether there is described sub-key word; If there is not described sub-key word, return to configuration data corresponding to described father's key word; If there is described sub-key word, determine sub-key word to be visited, return to described configuration data corresponding to sub-key word to be visited.
Preferably, there is not corresponding user data tree if described, access described configuration file according to described key word, the step of returning to the configuration data in described configuration file comprises: if there is not corresponding user data tree, judge in buffer memory, whether there is the configuration data that described key word is corresponding; If exist, return to described configuration data; If do not exist, access described configuration file according to described key word, return to the configuration data in described configuration file, and described configuration data is added in described buffer memory.
Preferably, described according to described key word, the step that described user data is set and/or described configuration file conducts interviews is comprised: in the time that described user data tree is carried out to write-access, judge whether to exist corresponding user data tree according to described key word; If exist, judge under father's key word node of described user data tree whether have sub-key word node; If there is not described sub-key word node, at described father's key word node data writing; If there is described sub-key word node, determine sub-key word node to be written, at described sub-key word node data writing to be written; If there is not corresponding user data tree, generate corresponding user data tree according to described key word and user data corresponding to described key word, determine key word node data writing to be written.
Preferably, described data definition has also defined database that the user data of described each business uses and the path of described database, and, the configuration file of described each business deposit path and form; The described key word according to described user data obtains user data, and the step that generates user data tree comprises: determine the database of described user data use and the path of described database according to the key word of described user data; According to the path of described database, access described database and obtain described user data, generate described user data tree; Described according to described key word, the step that described configuration file is conducted interviews comprises: according to described key word, that determines described configuration file deposits path and form; According to the described path of depositing, call configuration file described in the File Open matching with the form of described configuration file, described configuration file is conducted interviews.
In order to address the above problem, the invention also discloses a kind of DAA, comprise: acquisition module, for obtain the key word of user data according to data definition, wherein, described data definition has defined key word that the user data of certain business is corresponding and the key word corresponding to configuration file of described business, and wherein, the key word that key word that the user data of same business is corresponding is corresponding with the configuration file of this business is identical; Generation module, obtains user data for the key word according to described user data, generates user data tree; Access modules, for according to described key word, conducts interviews to described user data tree and/or described configuration file.
Preferably, described generation module, resolves for the key word to described user data, successively described key word is resolved to one to multiple level key word according to the separator in described key word; Wherein, if described key word resolves to one-level key word, described one-level key word is father's key word; If described key word resolves to multistage key word, described multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level, wherein, the user data that the key word of a rank is corresponding comprises other user data at the corresponding levels and lower than user data corresponding to other key word at the corresponding levels; Determine the user data that key words at different levels are corresponding, generate the user data tree of described user data according to the rank of described key words at different levels.
Preferably, described access modules, in the time described user data being set and/or described configuration file carries out read access, judges whether to exist corresponding user data tree according to described key word; If exist, judge under father's key word node of described user data tree whether have sub-key word node; If there is not described sub-key word node, return to user data corresponding to described father's key word node; If there is described sub-key word node, determine sub-key word node to be visited, return to described user data corresponding to sub-key word node to be visited; If there is not corresponding user data tree, access described configuration file according to described key word, return to the configuration data in described configuration file.
Preferably, the key word that described configuration file is corresponding is divided into one to multiple level key word according to the separator in described key word, and wherein, if described key word is divided into one-level key word, described one-level key word is father's key word; If described key word is divided into multistage key word, described multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level; Configuration data in described configuration file is according to described one to multiple level key word corresponding stored, and wherein, the configuration data that the key word of a rank is corresponding comprises other configuration data at the corresponding levels and lower than configuration data corresponding to other key word at the corresponding levels; Described access modules is being accessed described configuration file according to described key word, while returning to the configuration data in described configuration file, judges under described father's key word, whether there is described sub-key word; If there is not described sub-key word, return to configuration data corresponding to described father's key word; If there is described sub-key word, determine sub-key word to be visited, return to described configuration data corresponding to sub-key word to be visited.
Preferably, if not there is not corresponding user data tree in described access modules, access described configuration file according to described key word, while returning to the configuration data in described configuration file, if there is not corresponding user data tree, judge in buffer memory, whether there is the configuration data that described key word is corresponding; If exist, return to described configuration data; If do not exist, access described configuration file according to described key word, return to the configuration data in described configuration file, and described configuration data is added in described buffer memory.
Preferably, described access modules, in the time that described user data tree is carried out to write-access, judges whether to exist corresponding user data tree according to described key word; If exist, judge under father's key word node of described user data tree whether have sub-key word node; If there is not described sub-key word node, at described father's key word node data writing; If there is described sub-key word node, determine sub-key word node to be written, at described sub-key word node data writing to be written; If there is not corresponding user data tree, generate corresponding user data tree according to described key word and user data corresponding to described key word, determine key word node data writing to be written.
Preferably, described data definition has also defined database that the user data of described each business uses and the path of described database, and, the configuration file of described each business deposit path and form;
Described generation module, for determining the database of described user data use and the path of described database according to the key word of described user data; According to the path of described database, access described database and obtain described user data, generate described user data tree; Described access modules is according to described key word, and when described configuration file is conducted interviews, according to described key word, that determines described configuration file deposits path and form; According to the described path of depositing, call configuration file described in the File Open matching with the form of described configuration file, described configuration file is conducted interviews.
Compared with prior art, the present invention has the following advantages:
The invention provides the scheme of a kind of user data and configuration data unified management and access, this scheme presets the key word of each user data and each configuration file by data definition, wherein, the user data of same business is identical with the key word of configuration file and unique, and then, this scheme is used the key word setting to obtain corresponding user data, generates user data tree; Then, utilize key word to unify calling party data and configuration data.Use key word to unify access and management to user data and configuration data, make data access and management simple and clear; By data definition, can rapidly data access solution integration of the present invention be arrived in the middle of various client application, and can realize configuration file editing operation simple and flexible, client application upgrades in time.
Accompanying drawing explanation
Fig. 1 is a kind of System data structure according to the embodiment of the present invention;
Fig. 2 is according to the flow chart of steps of a kind of data access method of the embodiment of the present invention one;
Fig. 3 is according to the flow chart of steps of a kind of data access method of the embodiment of the present invention two;
Fig. 4 is according to the flow chart of steps of a kind of method for reading data of the embodiment of the present invention three;
Fig. 5 is according to the flow chart of steps of a kind of method for writing data of the embodiment of the present invention four;
Fig. 6 is according to the structured flowchart of a kind of DAA of the embodiment of the present invention five.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
For ease of understanding data access scheme of the present invention, first system data structure of the present invention is explained.As shown in Figure 1, system of the present invention comprises that data definition, configuration file are as software configuration data bag, three structures of user data.Wherein, data definition has at least defined key word that the user data of each business is corresponding and the key word corresponding to configuration file of each business, and the key word that key word that the user data of same business is corresponding is corresponding with the configuration file of this business is identical.As, for change outward appearance business, corresponding user data and the configuration file of this business uses identical key word.The key word unification that client application can define according to this data definition conducts interviews to user data and/or configuration file.
With embodiment, data access scheme of the present invention is described below.
Embodiment mono-
With reference to Fig. 2, show according to the flow chart of steps of a kind of data access method of the embodiment of the present invention one.
The data access method of the present embodiment comprises the following steps:
Step S102: the key word that obtains user data according to data definition.
Wherein, data definition definition (also can be understood as setting) key word that the user data of certain business is corresponding and the key word corresponding to configuration file of described business, wherein, the key word that the key word that the user data of same business is corresponding is corresponding with the configuration file of this business is identical.
Business typically refers to each concrete function of software, such as: the audit function that automatically replies function, secure domain name in Instant Messenger (IM) software, change interface skin function; The data such as the user data of a business can comprise the automatic reply content that client edits, certain skin of customer selecting; In configuration file, including which domain name is safe domain name, and interface skin has the data such as several.
Step S104: obtain user data according to the key word of user data, generate user data tree.
Step S106: according to described key word, user data tree and/or configuration file are conducted interviews.
For example, in the time will accessing the user data of change outward appearance business, first obtain the key word corresponding to user data of defined change outward appearance business in data definition; Then, in corresponding database, obtain user data according to this key word, and then generate user data tree; Because user data tree generates according to key word, therefore, can determine the node in user data tree to be visited according to this key word again, conduct interviews; If user data tree is accessed unsuccessfully, can be again according to this key word access-profile, and then obtain corresponding data.Certainly,, in the time only needing configuration data, also can, according to this key word, only configuration file be conducted interviews.
Pass through the present embodiment, the scheme of a kind of user data and configuration data unified management and access is provided, this scheme presets the key word of each user data and each configuration file by data definition, wherein, the user data of same business is identical with the key word of configuration file and unique, and then this scheme is used the key word setting to obtain corresponding user data, generate user data tree; Then, utilize key word to unify calling party data and configuration data.Use key word to unify access and management to user data and configuration data, make data access and management simple and clear; By data definition, can rapidly data access solution integration of the present invention be arrived in the middle of various client application, and can realize configuration file editing operation simple and flexible, client application upgrades in time.
Embodiment bis-
With reference to Fig. 3, show according to the flow chart of steps of a kind of data access method of the embodiment of the present invention two.
The data access method of the present embodiment comprises the following steps:
Step S202: carry out data definition.
In this step, data definition has defined key word that the user data of each business is corresponding and the key word corresponding to configuration file of each business, and wherein, the key word that key word that the user data of same business is corresponding is corresponding with the configuration file of this business is identical.The key word that the key word that the user data of certain business of data definition definition is corresponding and the configuration file of this business are corresponding is as follows:
Figure BDA00002645914400081
Wherein position and the form of DefinedConfigSources definition data, DefinedConfigFileKeys definition configuration file for KEY.
In the time carrying out data definition, can according to certain rule, the user data to each business and configuration file carry out keyword definition automatically.The user data of different business and configuration file have different key words.
Preferably, data definition can also define database that the user data of each business uses and the path of database, and, the configuration file of each business deposit path and form.
Step S204: receive the request of access of user's input, determine user data to be visited.
As, the operation maintenance personnel input reference request of certain client application, the client application outward appearance that the user of a certain client application of request access arranges, according to this request of access, can determine that user data to be visited is that the outward appearance of the client application of a certain account arranges data.Now, user data is not concrete data, is only the mark of user data, as user data name or other.
Step S206: the key word that obtains user data according to data definition.
According to the corresponding relation of data definition in step S202, determine the key word of user data to be visited.
Step S208: the key word to user data is resolved, resolves to key word one to multiple level key word successively according to the separator in key word.
Wherein, if key word resolves to one-level key word, one-level key word is father's key word; If key word resolves to multistage key word, multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level, wherein, the user data that the key word of any one rank is corresponding comprises other user data at the corresponding levels and lower than user data corresponding to other key word at the corresponding levels.Also, user data has also carried out corresponding classification according to keyword-level, and the user data that in user data tree, node is corresponding is except comprising the particular user data of this node, also comprise particular user data corresponding to child node that are subordinated to this node.
Step S210: determine the user data that key words at different levels are corresponding, generate the user data tree of user data according to the rank of key words at different levels.
Preferably, in the time that data definition has defined database that the user data of each business uses and the path of database, can determine database that user data uses and the path of database according to the key word of user data; According to the path of database, adopt the database access mode accessing database adapting with database, and then obtain user data, finally generate user data tree.
Step S212: according to described key word, user data tree and/or configuration file are conducted interviews.
Wherein, described key word is the key word of the user data that obtains in step S206.
According to described key word, user data tree and/or configuration file are conducted interviews and are comprised:
(1) in the time user data being set and/or configuration file carries out read access
Judge whether to exist corresponding user data tree according to described key word;
If there is corresponding user data tree, judge under father's key word node of user data tree whether have sub-key word node; If there is not sub-key word node, return to user data corresponding to father's key word node; If there is sub-key word node, definite sub-key word node to be visited (can be searched and be determined sub-key word node to be visited by the conventional mode that tree data is searched, in the time cannot finding final sub-key word node, can determine that node finally finding is sub-key word node to be visited, because the data that the packet of this node contains its all subordinate's nodes that may exist), return to user data corresponding to sub-key word node to be visited;
If there is not corresponding user data tree,, according to described key word access-profile, return to the configuration data in configuration file.
Preferably, the key word that configuration file is corresponding is divided into one to multiple level key word according to the separator in described key word, and wherein, if key word is divided into one-level key word, one-level key word is father's key word; If key word is divided into multistage key word, multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level; Configuration data in configuration file is according to one to multiple level key word corresponding stored, and wherein, the configuration data that the key word of a rank is corresponding comprises other configuration data at the corresponding levels and lower than configuration data corresponding to other key word at the corresponding levels; According to described key word access-profile, while returning to the configuration data in configuration file, first judge under father's key word, whether there is sub-key word; If there is not sub-key word, return to the configuration data that father's key word is corresponding; If there is sub-key word, determine sub-key word to be visited (determining definite method of method with above-mentioned user data tree), return to configuration data corresponding to sub-key word to be visited.
Preferably, if while there is not corresponding user data tree, can also judge in buffer memory, whether there is the configuration data that described key word is corresponding; If exist in buffer memory, corresponding configuration data in direct return cache; If do not exist in buffer memory,, again according to described key word access-profile, return to the configuration data in configuration file, and configuration data is added in buffer memory.By the caching mechanism of data, reduce the operation of client application to disk file, promote the performance of client application.
Preferably, when data definition defined each business configuration file deposit path and form time, according to described key word, configuration file is conducted interviews and can be adopted: according to described key word, that determines configuration file deposits path and form; According to depositing path, call the File Open configuration file matching with the form of configuration file, configuration file is conducted interviews.If the form of configuration file is ZIP form, can calls WINRAR and open this configuration file, and then this configuration file is conducted interviews.
(2) in the time that user data tree is carried out to write-access
Judge whether to exist corresponding user data tree according to key word;
If there is corresponding user data tree, judge under father's key word node of user data tree whether have sub-key word node; If there is not sub-key word node, at father's key word node data writing; If there is sub-key word node, determine sub-key word node to be written, at sub-key word node data writing to be written;
If there is not corresponding user data tree, generate corresponding user data tree according to key word and user data corresponding to key word, determine key word node data writing to be written.
Wherein, generate user data tree and determine that the mode of key word node to be written can, with reference to describing in (1), not repeat them here.
Pass through the present embodiment, realize in management, maintenance and the performance history of client application, can be by the method for unified configuration management, data are clear and management is efficiently got up rapidly, thereby improve the efficiency of management, maintenance and the exploitation of client application, improved the file read-write performance of client application simultaneously.On the one hand, the present embodiment has carried out managing uniformly and resolving to configuration file and user data, is convenient to the maintenance to data, can reduce the operation of client application to disk file by the caching mechanism of data simultaneously, has promoted the performance of client application; On the other hand, configuration file and the user data separately storage of the present embodiment to client application, wherein, configuration file is stored with document form, user data is with the storage of database form, but defined unified data access form by data definition, makes the access of data have unified interface, kept the configuration file editing operation simple and flexible to client application, the later stage also can be updated on client machine while having the configuration data of client application to upgrade in time simultaneously.
Embodiment tri-
With reference to Fig. 4, show according to the flow chart of steps of a kind of method for reading data of the embodiment of the present invention three.
The present embodiment reads aspect from data data access scheme of the present invention is explained, and the method for reading data of the present embodiment comprises the following steps:
Step S302: according to data definition, obtain the KEY that user data to be visited and configuration file are corresponding (key word).
Step S304: obtain whole user data according to the KEY of user data.
Step S306: the KEY of user data is resolved to father KEY and multiple sub-KEY according to separator as " | ".
The present embodiment is take multistage KEY as example, but it should be understood by those skilled in the art that in some cases to only have father KEY.
Step S308: according to the father KEY parsing and multiple sub-KEY, user data is generated to a user data tree.
Step S310: search father KEY in user data tree, judge whether to find, if so, perform step S312; If not, perform step S320.
Step S312: judge whether father KEY has sub-KEY, if having, perform step S316; If no, perform step S314.
Step S314: father KEY does not have sub-KEY, returns to the user data that father KEY is corresponding, process ends.
If father KEY does not have sub-KEY, read the user data that father KEY is corresponding, and resolution data finds user data corresponding to sub-KEY to be visited to return.
Step S316: father KEY has sub-KEY, continues to search, and judges whether the sub-KEY of subordinate in addition, if having, returns to step S312; If no, perform step S318.
Step S318: read the user data that sub-KEY is corresponding, parse the user data that sub-KEY to be visited is corresponding and return to this user data, process ends from this user data.
Step S320: if father KEY does not find, judge that whether configuration file has the configuration data corresponding with father KEY in data cached, if had, returns to this configuration data; If no, perform step S322.
Step S322: if there is no the configuration data corresponding with father KEY in buffer memory, search according to data definition the configuration file that father KEY is corresponding.
Step S324: judge whether the configuration file corresponding with father KEY finds, and if not, returns to failed message, process ends; If so, perform step S326.
Step S326: read the configuration data in configuration file.
Step S328: judge in configuration data, whether father KEY has sub-KEY, if do not have, performs step S330; If have, perform step S332.
Step S330: if there is no sub-KEY, return to whole file data, and according to access frequency and time, data replacement in buffer memory.
Step S332: if there is sub-KEY, file data is parsed to the configuration data that sub-KEY is corresponding, return data, and according to access frequency and time, data replacement in buffer memory.
By the present embodiment, the uniform data read schemes of the configuration data of a kind of user data and configuration file is provided, utilize KEY to unify calling party data and profile data, make data access simple and clear; Data definition is provided, can rapidly the solution integration of the present embodiment have been arrived in the middle of various client application; Caching process has been done in the access of the configuration data to configuration file, can reduce the access of client application to disk file, has promoted the performance of client application.
Embodiment tetra-
With reference to Fig. 5, show according to the flow chart of steps of a kind of method for writing data of the embodiment of the present invention four.
The present embodiment writes aspect from data data access scheme of the present invention is explained, and the method for writing data of the present embodiment comprises the following steps:
Step S402: according to data definition, get the KEY that user data to be visited and configuration file are corresponding (key word).
Step S404: obtain whole user data according to the KEY of user data.
Step S406: the KEY of user data is resolved to father KEY and multiple sub-KEY according to separator as " | ".
The present embodiment is take multistage KEY as example, but it should be understood by those skilled in the art that in some cases to only have father KEY.
Step S408: according to the father KEY parsing and multiple sub-KEY, user data is generated to a user data tree.
Step S410: judge in user data tree whether find father KEY, if find, execution step S412; If do not find, execution step S420.
Step S412: judge whether father KEY has sub-KEY, if do not have, perform step S414; If have, perform step S416.
Step S414: father KEY does not have sub-KEY, arranges data at present node (being father KEY), and all son node number of present node according to deletion.
Also, data are write to this father KEY.
Step S416: father KEY has sub-KEY to continue to search sub-KEY, judges whether that whether this sub-KEY also has the sub-KEY of subordinate, if having, returns to step S412; If no, perform step S418.
Step S418: KEY does not find as fruit creates the corresponding node of sub-KEY in data tree, and the Node configuration data that creating.
Step S420: if father KEY does not find, create the corresponding node of father KEY in data tree.
Step S422: judge whether father KEY has sub-KEY, if having, perform step S424; If no, perform step S426.
Step S424: if father KEY has sub-KEY, create the node that sub-KEY is corresponding in data tree, until after all sub-KEY nodes have set up, data are set on last node to process ends.
Step S426: if father KEY does not have sub-KEY, data are set on the corresponding node of father KEY.
For example, the data that KEY is KA|KA1|KA11 are set, analyze known to this KEY, this KEY comprises father KEY KA, sub-KEY KA1 and sub-KEY KA11, if do not find these KEY in data tree, that creates the corresponding node of these KEY in tree, data are finally set on KA11, if any the lower less important data that KEY KA|KA1 is set, can find the corresponding node of KA1, then KA11 knot removal, data are set on KA1, this is because assert that the corresponding packet of KA1 node has contained the data of KA11 respective nodes here, and the corresponding number of KA1 node is up-to-date data, so be as the criterion with up-to-date data here, old data are deleted.
By the present embodiment, the uniform data writing scheme of the configuration data of a kind of user data and configuration file is provided, utilize KEY to unify calling party data and profile data, make data access simple and clear; Data definition is provided, can rapidly the solution integration of the present embodiment have been arrived in the middle of various client application; When data writing, do the merging of father KEY data and sub-KEY data, guaranteed the uniqueness of latest data.
Embodiment five
With reference to Fig. 6, show according to the structured flowchart of a kind of DAA of the embodiment of the present invention five.
The DAA of the present embodiment comprises: acquisition module 502, for obtain the key word of user data according to data definition, wherein, data definition has defined key word that the user data of certain business is corresponding and the key word corresponding to configuration file of described business, wherein, the key word that the key word that the user data of same business is corresponding is corresponding with the configuration file of this business is identical; Generation module 504, obtains user data for the key word according to user data, generates user data tree; Access modules 506, for according to described key word, conducts interviews to user data tree and/or configuration file.
Preferably, generation module 504, resolves for the key word to user data, successively key word is resolved to one to multiple level key word according to the separator in key word; Wherein, if key word resolves to one-level key word, one-level key word is father's key word; If key word resolves to multistage key word, multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level, wherein, the user data that the key word of a rank is corresponding comprises other user data at the corresponding levels and lower than user data corresponding to other key word at the corresponding levels; Determine the user data that key words at different levels are corresponding, generate the user data tree of user data according to the rank of key words at different levels.
Preferably, access modules 506, in the time user data being set and/or configuration file carries out read access, judges whether to exist corresponding user data tree according to key word; If exist, judge under father's key word node of user data tree whether have sub-key word node; If there is not sub-key word node, return to user data corresponding to father's key word node; If there is sub-key word node, determine sub-key word node to be visited, return to user data corresponding to sub-key word node to be visited; If there is not corresponding user data tree, according to key word access-profile, return to the configuration data in configuration file.
Preferably, the key word that configuration file is corresponding is divided into one to multiple level key word according to the separator in key word, and wherein, if key word is divided into one-level key word, one-level key word is father's key word; If key word is divided into multistage key word, multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level; Configuration data in configuration file is according to one to multiple level key word corresponding stored, and wherein, the configuration data that the key word of a rank is corresponding comprises other configuration data at the corresponding levels and lower than configuration data corresponding to other key word at the corresponding levels; Access modules 506 is according to key word access-profile, while returning to the configuration data in configuration file, judges under father's key word, whether there is sub-key word; If there is not sub-key word, return to the configuration data that father's key word is corresponding; If there is sub-key word, determine sub-key word to be visited, return to configuration data corresponding to sub-key word to be visited.
Preferably, if access modules 506 is there not being corresponding user data tree, according to key word access-profile, while returning to the configuration data in configuration file, if there is not corresponding user data tree, judge in buffer memory, whether there is the configuration data that key word is corresponding; If exist, return to configuration data; If do not exist, according to key word access-profile, return to the configuration data in configuration file, and configuration data is added in buffer memory.
Preferably, access modules 506, in the time that user data tree is carried out to write-access, judges whether to exist corresponding user data tree according to key word; If exist, judge under father's key word node of user data tree whether have sub-key word node; If there is not sub-key word node, at father's key word node data writing; If there is sub-key word node, determine sub-key word node to be written, at sub-key word node data writing to be written; If there is not corresponding user data tree, generate corresponding user data tree according to key word and user data corresponding to key word, determine key word node data writing to be written.
Preferably, data definition has also defined database that the user data of each business uses and the path of database, and, the configuration file of each business deposit path and form; Generation module 504, for determining the database of user data use and the path of database according to the key word of user data; According to the path of database, accessing database obtains user data, generates user data tree; Access modules 506 is according to key word, and when configuration file is conducted interviews, according to key word, that determines configuration file deposits path and form; According to depositing path, call the File Open configuration file matching with the form of configuration file, configuration file is conducted interviews.
The DAA of the present embodiment is used for realizing the corresponding data access method of aforementioned multiple embodiment of the method, and has the beneficial effect of corresponding embodiment of the method, does not repeat them here.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is and the difference of other embodiment, between each embodiment identical similar part mutually referring to.For device embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part is referring to the part explanation of embodiment of the method.
Above a kind of data access method provided by the present invention and device are described in detail, applied specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention meanwhile.

Claims (14)

1. a data access method, is characterized in that, comprising:
Obtain the key word of user data according to data definition, wherein, described data definition has defined key word that the user data of certain business is corresponding and the key word corresponding to configuration file of described business, wherein, the key word that the key word that the user data of same business is corresponding is corresponding with the configuration file of this business is identical;
Obtain user data according to the key word of described user data, generate user data tree;
According to described key word, described user data tree and/or described configuration file are conducted interviews.
2. method according to claim 1, is characterized in that, the described key word according to described user data obtains user data, and the step that generates user data tree comprises:
Key word to described user data is resolved, and successively described key word is resolved to one to multiple level key word according to the separator in described key word; Wherein, if described key word resolves to one-level key word, described one-level key word is father's key word; If described key word resolves to multistage key word, described multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level, wherein, the user data that the key word of a rank is corresponding comprises other user data at the corresponding levels and lower than user data corresponding to other key word at the corresponding levels;
Determine the user data that key words at different levels are corresponding, generate the user data tree of described user data according to the rank of described key words at different levels.
3. method according to claim 2, is characterized in that, described according to described key word, and the step that described user data is set and/or described configuration file conducts interviews is comprised:
In the time described user data being set and/or described configuration file carries out read access, judge whether to exist corresponding user data tree according to described key word;
If exist, judge under father's key word node of described user data tree whether have sub-key word node; If there is not described sub-key word node, return to user data corresponding to described father's key word node; If there is described sub-key word node, determine sub-key word node to be visited, return to described user data corresponding to sub-key word node to be visited;
If there is not corresponding user data tree, access described configuration file according to described key word, return to the configuration data in described configuration file.
4. method according to claim 3, it is characterized in that, the key word that described configuration file is corresponding is divided into one to multiple level key word according to the separator in described key word, wherein, if described key word is divided into one-level key word, described one-level key word is father's key word; If described key word is divided into multistage key word, described multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level; Configuration data in described configuration file is according to described one to multiple level key word corresponding stored, and wherein, the configuration data that the key word of a rank is corresponding comprises other configuration data at the corresponding levels and lower than configuration data corresponding to other key word at the corresponding levels;
Describedly access described configuration file according to described key word, the step of returning to the configuration data in described configuration file comprises: judge under described father's key word, whether there is described sub-key word; If there is not described sub-key word, return to configuration data corresponding to described father's key word; If there is described sub-key word, determine sub-key word to be visited, return to described configuration data corresponding to sub-key word to be visited.
5. method according to claim 4, is characterized in that, does not have corresponding user data tree if described, accesses described configuration file according to described key word, and the step of returning to the configuration data in described configuration file comprises:
If there is not corresponding user data tree, judge in buffer memory, whether there is the configuration data that described key word is corresponding;
If exist, return to described configuration data;
If do not exist, access described configuration file according to described key word, return to the configuration data in described configuration file, and described configuration data is added in described buffer memory.
6. method according to claim 2, is characterized in that, described according to described key word, and the step that described user data is set and/or described configuration file conducts interviews is comprised:
In the time that described user data tree is carried out to write-access, judge whether to exist corresponding user data tree according to described key word;
If exist, judge under father's key word node of described user data tree whether have sub-key word node; If there is not described sub-key word node, at described father's key word node data writing; If there is described sub-key word node, determine sub-key word node to be written, at described sub-key word node data writing to be written;
If there is not corresponding user data tree, generate corresponding user data tree according to described key word and user data corresponding to described key word, determine key word node data writing to be written.
7. method according to claim 1, is characterized in that, described data definition has also defined database that the user data of described each business uses and the path of described database, and, the configuration file of described each business deposit path and form;
The described key word according to described user data obtains user data, and the step that generates user data tree comprises: determine the database of described user data use and the path of described database according to the key word of described user data; According to the path of described database, access described database and obtain described user data, generate described user data tree;
Described according to described key word, the step that described configuration file is conducted interviews comprises: according to described key word, that determines described configuration file deposits path and form; According to the described path of depositing, call configuration file described in the File Open matching with the form of described configuration file, described configuration file is conducted interviews.
8. a DAA, is characterized in that, comprising:
Acquisition module, for obtain the key word of user data according to data definition, wherein, described data definition has defined key word that the user data of certain business is corresponding and the key word corresponding to configuration file of described business, wherein, the key word that the key word that the user data of same business is corresponding is corresponding with the configuration file of this business is identical;
Generation module, obtains user data for the key word according to described user data, generates user data tree;
Access modules, for according to described key word, conducts interviews to described user data tree and/or described configuration file.
9. device according to claim 8, is characterized in that, described generation module is resolved for the key word to described user data, successively described key word is resolved to one to multiple level key word according to the separator in described key word; Wherein, if described key word resolves to one-level key word, described one-level key word is father's key word; If described key word resolves to multistage key word, described multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level, wherein, the user data that the key word of a rank is corresponding comprises other user data at the corresponding levels and lower than user data corresponding to other key word at the corresponding levels; Determine the user data that key words at different levels are corresponding, generate the user data tree of described user data according to the rank of described key words at different levels.
10. device according to claim 9, is characterized in that, described access modules, in the time described user data being set and/or described configuration file carries out read access, judges whether to exist corresponding user data tree according to described key word; If exist, judge under father's key word node of described user data tree whether have sub-key word node; If there is not described sub-key word node, return to user data corresponding to described father's key word node; If there is described sub-key word node, determine sub-key word node to be visited, return to described user data corresponding to sub-key word node to be visited; If there is not corresponding user data tree, access described configuration file according to described key word, return to the configuration data in described configuration file.
11. devices according to claim 10, it is characterized in that, the key word that described configuration file is corresponding is divided into one to multiple level key word according to the separator in described key word, wherein, if described key word is divided into one-level key word, described one-level key word is father's key word; If described key word is divided into multistage key word, described multistage key word comprises father's key word and one or more sub-key word sorting according to rank height of highest level; Configuration data in described configuration file is according to described one to multiple level key word corresponding stored, and wherein, the configuration data that the key word of a rank is corresponding comprises other configuration data at the corresponding levels and lower than configuration data corresponding to other key word at the corresponding levels;
Described access modules is being accessed described configuration file according to described key word, while returning to the configuration data in described configuration file, judges under described father's key word, whether there is described sub-key word; If there is not described sub-key word, return to configuration data corresponding to described father's key word; If there is described sub-key word, determine sub-key word to be visited, return to described configuration data corresponding to sub-key word to be visited.
12. devices according to claim 11, it is characterized in that, if not there is not corresponding user data tree in described access modules, access described configuration file according to described key word, while returning to the configuration data in described configuration file, if there is not corresponding user data tree, judge in buffer memory, whether there is the configuration data that described key word is corresponding; If exist, return to described configuration data; If do not exist, access described configuration file according to described key word, return to the configuration data in described configuration file, and described configuration data is added in described buffer memory.
13. devices according to claim 9, is characterized in that, described access modules, in the time that described user data tree is carried out to write-access, judges whether to exist corresponding user data tree according to described key word; If exist, judge under father's key word node of described user data tree whether have sub-key word node; If there is not described sub-key word node, at described father's key word node data writing; If there is described sub-key word node, determine sub-key word node to be written, at described sub-key word node data writing to be written; If there is not corresponding user data tree, generate corresponding user data tree according to described key word and user data corresponding to described key word, determine key word node data writing to be written.
14. devices according to claim 8, is characterized in that, described data definition has also defined database that the user data of described each business uses and the path of described database, and, the configuration file of described each business deposit path and form;
Described generation module, for determining the database of described user data use and the path of described database according to the key word of described user data; According to the path of described database, access described database and obtain described user data, generate described user data tree;
Described access modules is according to described key word, and when described configuration file is conducted interviews, according to described key word, that determines described configuration file deposits path and form; According to the described path of depositing, call configuration file described in the File Open matching with the form of described configuration file, described configuration file is conducted interviews.
CN201210573013.9A 2012-12-25 2012-12-25 Data access method and device Active CN103902554B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210573013.9A CN103902554B (en) 2012-12-25 2012-12-25 Data access method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210573013.9A CN103902554B (en) 2012-12-25 2012-12-25 Data access method and device

Publications (2)

Publication Number Publication Date
CN103902554A true CN103902554A (en) 2014-07-02
CN103902554B CN103902554B (en) 2018-06-29

Family

ID=50993883

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210573013.9A Active CN103902554B (en) 2012-12-25 2012-12-25 Data access method and device

Country Status (1)

Country Link
CN (1) CN103902554B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105956140A (en) * 2016-05-12 2016-09-21 无锡威泰迅电力科技有限公司 Local data storage method based on mixed-mode mobile application
CN108073635A (en) * 2016-11-18 2018-05-25 中国电力科学研究院 A kind of system and its loading method of the loading of power information system data scene
CN108304186A (en) * 2016-08-16 2018-07-20 阿里巴巴集团控股有限公司 A kind of method and apparatus executing multi-mode operation based on synthesized configuration file

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1650295A (en) * 2001-09-28 2005-08-03 克莱特动力有限公司 Method and system for database queries and information delivery
CN1652534A (en) * 2004-02-03 2005-08-10 华为技术有限公司 Method for storing character string matching rule and character string matching by storing rule
US20110035424A1 (en) * 2005-04-01 2011-02-10 Microsoft Corporation User data profile namespace
CN102006281A (en) * 2010-10-19 2011-04-06 中国联合网络通信集团有限公司 Soft terminal data processing method and system and devices
CN105447166A (en) * 2015-12-03 2016-03-30 沈文策 Keyword based information search method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1650295A (en) * 2001-09-28 2005-08-03 克莱特动力有限公司 Method and system for database queries and information delivery
CN1652534A (en) * 2004-02-03 2005-08-10 华为技术有限公司 Method for storing character string matching rule and character string matching by storing rule
US20110035424A1 (en) * 2005-04-01 2011-02-10 Microsoft Corporation User data profile namespace
CN102006281A (en) * 2010-10-19 2011-04-06 中国联合网络通信集团有限公司 Soft terminal data processing method and system and devices
CN105447166A (en) * 2015-12-03 2016-03-30 沈文策 Keyword based information search method and system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105956140A (en) * 2016-05-12 2016-09-21 无锡威泰迅电力科技有限公司 Local data storage method based on mixed-mode mobile application
CN105956140B (en) * 2016-05-12 2019-03-22 无锡威泰迅电力科技有限公司 The method that data are locally stored based on mixed mode mobile application
CN108304186A (en) * 2016-08-16 2018-07-20 阿里巴巴集团控股有限公司 A kind of method and apparatus executing multi-mode operation based on synthesized configuration file
CN108304186B (en) * 2016-08-16 2021-07-06 阿里巴巴集团控股有限公司 Method and equipment for executing multiple operations based on synthetic configuration file
CN108073635A (en) * 2016-11-18 2018-05-25 中国电力科学研究院 A kind of system and its loading method of the loading of power information system data scene
CN108073635B (en) * 2016-11-18 2021-08-27 中国电力科学研究院有限公司 System for loading data scene of electric power information system and loading method thereof

Also Published As

Publication number Publication date
CN103902554B (en) 2018-06-29

Similar Documents

Publication Publication Date Title
CN101276361B (en) Method and system for displaying related key words
CN102122285B (en) Data cache system and data inquiry method
CN104794123A (en) Method and device for establishing NoSQL database index for semi-structured data
CN102929936B (en) Log recording method, log inquiring method and system
US20130191523A1 (en) Real-time analytics for large data sets
CN109313640B (en) Method and system for database optimization
CN106407303A (en) Data storage method and apparatus, and data query method and apparatus
US11068536B2 (en) Method and apparatus for managing a document index
CN104601736A (en) Method and device for realizing short uniform resource locator (URL) service
CN101000619A (en) Data synchronous method and device based on SQL
CN107609302B (en) Method and system for generating product process structure
CN106649602B (en) Business object data processing method, device and server
CN101236569A (en) Highly effective dynamic path analysis method based on ContextFS
CN109271449A (en) A kind of distributed storage inquiry system file-based and querying method
CN104111924A (en) Database system
CN105447166A (en) Keyword based information search method and system
CN104636477A (en) Push list duplicate removal method before information push
CN110134738A (en) Distributed memory system resource predictor method, device
CN109145053B (en) Data processing method and device, client and server
US20160301572A1 (en) Communication control device, communication control method, and computer program product
CN111241090B (en) Method and device for managing data index in storage system
CN103902554A (en) Data access method and device
CN104239337A (en) TCAM (ternary content addressable memory) based table look-up processing method and device
CN107291454A (en) A kind of method and Commentary Systems that comment is added in the comment list of event
CN101540785A (en) Web access method, terminal and service platform based on IPTV system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant