CN107194014B - Data source calling method and device - Google Patents
Data source calling method and device Download PDFInfo
- Publication number
- CN107194014B CN107194014B CN201710538674.0A CN201710538674A CN107194014B CN 107194014 B CN107194014 B CN 107194014B CN 201710538674 A CN201710538674 A CN 201710538674A CN 107194014 B CN107194014 B CN 107194014B
- Authority
- CN
- China
- Prior art keywords
- data source
- calling
- key information
- target data
- module
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 230000002159 abnormal effect Effects 0.000 claims description 8
- 238000004422 calculation algorithm Methods 0.000 claims description 4
- 238000000605 extraction Methods 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 6
- 239000011435 rock Substances 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Input From Keyboards Or The Like (AREA)
Abstract
The embodiment of the invention discloses a data source calling device, relates to the technical field of information, and can solve the problem of high complexity of calling a data source. The method of the invention comprises the following steps: receiving input parameters based on the standardized interface; calling a target data source corresponding to the input parameter; and calculating the input parameters according to the target data source to obtain an output result. The embodiment of the invention can reduce the complexity of calling the data source.
Description
Technical Field
The invention relates to the technical field of information, in particular to a data source calling method and device.
Background
With the development of information technology, business application informatization puts higher and higher requirements on acquisition of a large amount of real-time data. In order to better exert the function of the real-time data center, a large amount of real-time data of multiple data sources generated during the operation of the power grid needs to be accessed into a real-time database corresponding to the real-time data center.
At present, when data is received, each data source needs a corresponding data interface, and the complexity of calling the data source is high due to different interface implementation modes, different source system manufacturers and the like.
Disclosure of Invention
The embodiment of the invention provides a data source calling method and device, which can solve the problem of high complexity of calling a data source.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides a data source calling method, including:
receiving input parameters based on the standardized interface;
calling a target data source corresponding to the input parameter;
and calculating the input parameters according to the target data source to obtain an output result.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the invoking a target data source corresponding to the input parameter includes:
extracting key information in the input parameters;
and calling the corresponding target data source according to the key information.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, before the invoking the corresponding target data source according to the key information, the method further includes:
establishing a corresponding relation between each key information and each data source;
and storing the corresponding relation between each piece of key information and each data source.
With reference to the first aspect, in a third possible implementation manner of the first aspect, the method further includes:
and when the target data source is not called, calling a standby data source.
With reference to the first aspect, in a fourth possible implementation manner of the first aspect, the method further includes:
and when the called target data source is abnormal in state, calling the standby data source.
In a second aspect, an embodiment of the present invention provides a data source invoking device, including:
the receiving module is used for receiving input parameters based on the standardized interface;
the first calling module is used for calling the target data source corresponding to the input parameter received by the receiving module;
and the operation module is used for performing operation on the input parameters according to the target data source called by the first calling module to obtain an output result.
With reference to the second aspect, in a first possible implementation manner of the second aspect, the first invoking module includes: extracting a submodule and calling a submodule;
the extraction submodule is used for extracting key information in the input parameters;
and the calling submodule is used for calling the corresponding target data source according to the key information.
With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the apparatus further includes: establishing a module and a storage module;
the establishing module is used for establishing the corresponding relation between each piece of key information and each data source;
the storage module is configured to store the correspondence between each piece of key information and each data source that is established by the establishment module.
With reference to the second aspect, in a third possible implementation manner of the second aspect, the apparatus further includes: a second calling module;
and the second calling module is used for calling the standby data source when the target data source is not called.
With reference to the second aspect, in a fourth possible implementation manner of the second aspect, the apparatus further includes: a third calling module;
and the third calling module is used for calling the standby data source when the called target data source is abnormal in state.
According to the data source calling method and device provided by the embodiment of the invention, input parameters are received based on a standardized interface, and then a target data source corresponding to the input parameters is called; and finally, calculating the input parameters according to the target data source to obtain an output result. The method and the device can realize that different data sources are called through a unified standardized data interface, thereby reducing the complexity of calling the data sources.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow diagram of a data source invocation method according to an embodiment of the invention;
FIG. 2A is another flow chart diagram of a data source invocation method according to an embodiment of the invention;
FIG. 2B is a diagram illustrating the results of a data source call method according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a data source call device according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of the first calling module 32 according to an embodiment of the present invention;
fig. 5 is another schematic structural diagram of a data source calling device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a data source invoking method, as shown in fig. 1, the method includes:
101. based on the standardized interface, input parameters are received.
Wherein the standardized interfaces can receive different data sources of the same type. For example, the Beijing market identification number data source, Shanghai market identification number data source, national male identification number data source and the like are different data sources of the same type.
102. And calling a target data source corresponding to the input parameter.
For the embodiment of the present invention, the corresponding target data source may be called through the type of the input parameter, or the corresponding target data source may be called through the key information carried in the input parameter, which is not limited in the embodiment of the present invention.
For calling the corresponding target data source through the key information carried in the input parameters, the following algorithm can be adopted for implementation:
suppose that the input parameters carry M pieces of key information, and the weight of each piece of key information is Wi(1≤i≤M)。WiThe key information can be scored by a user according to different types of the key information or determined according to an analytic hierarchy process. The matching degree of any data source and the ith key information is assumed to be UiThen U isiIs 0 or 1:
According to the method, the target data source with the maximum matching degree with the key information can be selected, and the target data source can be matched with the data source expected by the user to the maximum extent.
103. And calculating the input parameters according to the target data source to obtain an output result.
For example, when the input parameters are the name and the identification number, after the identification number data source of the province where the input parameter is located is called according to the identification number, the name information corresponding to the identification number is searched in the identification number data source of the province, so that whether the name in the input parameters is correct or not is judged, and a corresponding output result is obtained.
Compared with the prior art, different data sources can be called through a unified standardized data interface, and therefore the complexity of calling the data sources can be reduced.
Another embodiment of the present invention provides a data source calling method, as shown in fig. 2A, the method includes:
201. and establishing a corresponding relation between each piece of key information and each data source.
Wherein, different key information respectively corresponds to different data sources. For example, for the ID card number data source, when the first two digits of the key information are '11', the key information corresponds to the ID card number data source in Beijing City; when the first two digits of the key information are '61', the key information corresponds to the ID number data source of Shaanxi province.
202. And storing the corresponding relation between each piece of key information and each data source.
203. Based on the standardized interface, input parameters are received.
Wherein the standardized interfaces can receive different data sources of the same type. For example, the Beijing market identification number data source, Shanghai market identification number data source, national male identification number data source and the like are different data sources of the same type.
204. And extracting key information in the input parameters.
The key information is used for determining a data source corresponding to the key information. For example, for the identification number, the key information can be the first 2 bits of the identification number, so that the corresponding provincial identification number data source can be called; the key information can also be the 7 th to 10 th digits of the ID number, so that the province number data source of the birth year of the ID number can be called.
205. And calling the corresponding target data source according to the key information in the input parameters.
For the embodiment of the invention, when the target data source is not called, the standby data source is called. In the embodiment of the invention, the standby data source is called when the calling of the data source fails, so that the coverage range of the data source can be effectively improved, and the information of each data source is fully utilized.
For the embodiment of the invention, when the state of the called target data source is abnormal, the standby data source is called. In the embodiment of the invention, the standby data source is called when the target data source is in an abnormal state, so that the system stability can be effectively improved.
And calling the standby data source when the target data source is in an abnormal state, wherein the standby data source and the target data source have certain deviation and are not completely consistent. In order to ensure that the deviation between the finally called standby data source and the target data source is small, the following algorithm may be adopted to select a more suitable standby data source from all other optional standby data sources except the target data source for calling:
suppose there are M pieces of key information in the input parameters, and the weight of each piece of key information is Wi (i is more than or equal to 1 and less than or equal to M). Wi can be scored by the user according to different types of key information or determined according to an analytic hierarchy process. Calling corresponding relations between the key information and the optional standby data sources; according to the corresponding relation, the matching degree Ui of any optional standby data source and the ith key information is calculated by using the following function:
in the formula, xi,0The value of the ith key information is obtained; x is the number ofi,minThe value lower limit of the preset key information which belongs to the same type of information as the ith key information is set; x is the number ofi,maxThe value upper limit of the preset key information which belongs to the same type of information as the ith key information is set; x is the number ofiThe value of the key information which belongs to the same type of information as the ith key information in the key information corresponding to the optional standby data source currently being calculated is obtained.
In the function, for convenience of calculation, each piece of key information in the stored correspondence between each piece of key information and each data source is assigned in advance to obtain a value of each piece of key information in the correspondence. For example, all the key information in the corresponding relationship is classified according to the meanings expressed by the key information, and the meanings are classified into one class; assigning values to each key information in the same type according to an assignment rule, wherein the assignment rule can be that a basic meaning corresponding to the type is set according to the meaning of each key information in the same type; and assigning values to each piece of key information according to the similarity between the meaning of each piece of key information under the type and the basic meaning. The following examples illustrate: there are five key information "rock", "musical instrument", "food", "dress" in the corresponding relation, wherein, have the relation among the meanings "rock", "musical instrument", can classify the three key information into a kind, and presume a basic meaning for this kind is "music"; the meaning of the three key information in the type is different from the similarity between the basic meanings, wherein the similarity of the rock is greater than that of the instrument, so when the rock is assigned with 80, the instrument can be assigned with 50, and the specific assignment rule is what can be self-defined and is within the protection scope of the application.
Find outThe optional standby data source corresponding to J is the standby data source for final call.
E.g. as shown in FIG. 2B, xi,0=5,xi,min=1,xi,maxWhen x is 9, if xiWhen the value is 6, then Ui=0.853553。
According to the method, the standby data source which is matched with the key information can be selected, and the standby data source which is matched with the data source expected by the user can be called as far as possible under the condition that the target data source cannot be obtained, so that the condition that the user cannot obtain any data source as a reference is avoided.
206. And calculating the input parameters according to the target data source to obtain an output result.
For example, when the input parameters are the name and the identification number, after the identification number data source of the province where the input parameter is located is called according to the identification number, the name information corresponding to the identification number is searched in the identification number data source of the province, so that whether the name in the input parameters is correct or not is judged, and a corresponding output result is obtained.
Compared with the prior art, different data sources can be called through a unified standardized data interface, and therefore the complexity of calling the data sources can be reduced.
Another embodiment of the present invention provides a data source calling apparatus, as shown in fig. 3, the apparatus includes: a receiving module 31, a first calling module 32, and an operation module 33.
A receiving module 31, configured to receive an input parameter based on a standardized interface;
a first calling module 32, configured to call a target data source corresponding to the input parameter received by the receiving module 31;
and an operation module 33, configured to perform operation on the input parameter according to the target data source called by the first calling module 32, so as to obtain an output result.
Compared with the prior art, different data sources can be called through a unified standardized data interface, and therefore the complexity of calling the data sources can be reduced.
Further, as shown in fig. 4, the first calling module 32 includes: an extraction submodule 3201 and a call submodule 3202.
An extraction submodule 3201, configured to extract key information in the input parameter;
the calling sub-module 3202 is configured to call the corresponding target data source according to the key information.
Further, as shown in fig. 5, the apparatus further includes: the device comprises a building module 51, a storage module 52, a second calling module 53 and a third calling module 54.
The establishing module 51 is configured to establish a corresponding relationship between each piece of key information and each data source;
a storage module 52, configured to store the correspondence between each piece of key information and each data source that is established by the establishing module 51.
And the second calling module 53 is configured to call the standby data source when the target data source is not called.
And a third calling module 54, configured to call the standby data source when the called target data source is abnormal in state.
Compared with the prior art, different data sources can be called through a unified standardized data interface, and therefore the complexity of calling the data sources can be reduced.
The data source calling device provided in the embodiment of the present invention can implement the method embodiment provided above, and for specific function implementation, reference is made to the description in the method embodiment, which is not described herein again. The data source calling method and device provided by the embodiment of the invention can be suitable for uniformly calling different data sources, but are not limited to this.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to some descriptions of the method embodiment for relevant points.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (8)
1. A data source calling method, comprising:
receiving input parameters based on the standardized interface;
calling a target data source corresponding to the input parameter;
the algorithm of the target data source is as follows:
the input parameters carry M pieces of key information, and the weight of each piece of key information is Wi(i is more than or equal to 1 and less than or equal to M), and the matching degree of any data source and the ith key information is UiSaid UiIs 0 or 1:
calculating the input parameters according to the target data source to obtain an output result;
when the target data source is not called and/or the called target data source is abnormal in state, calling a standby data source;
when the standby data source needs to be called, calculating the matching degree between the target data source and the standby data source by adopting the following algorithm, and selecting one of all other optional standby data sources except the target data source to call according to the matching degree:
wherein,
xi,0the value of the ith key information is obtained;
xi,minthe value lower limit of the preset key information which belongs to the same type of information as the ith key information is set;
xi,maxthe value upper limit of the preset key information which belongs to the same type of information as the ith key information is set;
xithe value of the key information which belongs to the same type of information as the ith key information in the key information corresponding to the optional standby data source currently being calculated is obtained.
2. The method of claim 1, wherein the invoking a target data source corresponding to the input parameter comprises:
extracting key information in the input parameters;
and calling the corresponding target data source according to the key information.
3. The method according to claim 2, wherein before the calling the corresponding target data source according to the key information, further comprising:
establishing a corresponding relation between each key information and each data source;
and storing the corresponding relation between each piece of key information and each data source.
4. A data source calling apparatus, wherein the data source calling method according to any one of claims 1 to 3 is applied, and the apparatus comprises:
the receiving module is used for receiving input parameters based on the standardized interface;
the first calling module is used for calling the target data source corresponding to the input parameter received by the receiving module;
and the operation module is used for performing operation on the input parameters according to the target data source called by the first calling module to obtain an output result.
5. The apparatus of claim 4, wherein the first calling module comprises: extracting a submodule and calling a submodule;
the extraction submodule is used for extracting key information in the input parameters;
and the calling submodule is used for calling the corresponding target data source according to the key information.
6. The apparatus of claim 5, further comprising: establishing a module and a storage module;
the establishing module is used for establishing the corresponding relation between each piece of key information and each data source;
the storage module is configured to store the correspondence between each piece of key information and each data source that is established by the establishment module.
7. The apparatus of claim 4, further comprising: a second calling module;
and the second calling module is used for calling the standby data source when the target data source is not called.
8. The apparatus of claim 4, further comprising: a third calling module;
and the third calling module is used for calling the standby data source when the called target data source is abnormal in state.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710538674.0A CN107194014B (en) | 2017-07-04 | 2017-07-04 | Data source calling method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710538674.0A CN107194014B (en) | 2017-07-04 | 2017-07-04 | Data source calling method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107194014A CN107194014A (en) | 2017-09-22 |
CN107194014B true CN107194014B (en) | 2021-05-28 |
Family
ID=59880726
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710538674.0A Active CN107194014B (en) | 2017-07-04 | 2017-07-04 | Data source calling method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107194014B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104866383A (en) * | 2015-05-29 | 2015-08-26 | 北京金山安全软件有限公司 | Interface calling method and device and terminal |
CN106649363A (en) * | 2015-10-30 | 2017-05-10 | 北京国双科技有限公司 | Data query method and device |
CN106649488A (en) * | 2016-09-30 | 2017-05-10 | 广东网金数据服务有限公司 | Method and device for invoking multi-data-source interaction interface |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8694532B2 (en) * | 2004-09-17 | 2014-04-08 | First American Data Co., Llc | Method and system for query transformation for managing information from multiple datasets |
US9020981B2 (en) * | 2011-09-30 | 2015-04-28 | Comprehend Systems, Inc. | Systems and methods for generating schemas that represent multiple data sources |
CN103279573B (en) * | 2013-06-20 | 2016-06-29 | 天脉聚源(北京)传媒科技有限公司 | A kind of method and system of data search |
CN106649638B (en) * | 2016-12-08 | 2020-01-17 | 贵州数据宝网络科技有限公司 | Big data acquisition method |
-
2017
- 2017-07-04 CN CN201710538674.0A patent/CN107194014B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104866383A (en) * | 2015-05-29 | 2015-08-26 | 北京金山安全软件有限公司 | Interface calling method and device and terminal |
CN106649363A (en) * | 2015-10-30 | 2017-05-10 | 北京国双科技有限公司 | Data query method and device |
CN106649488A (en) * | 2016-09-30 | 2017-05-10 | 广东网金数据服务有限公司 | Method and device for invoking multi-data-source interaction interface |
Also Published As
Publication number | Publication date |
---|---|
CN107194014A (en) | 2017-09-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11003754B2 (en) | Method and apparatus for user authentication based on feature information | |
CN109597822B (en) | User data storage and query method and user data processing device | |
CN112818457B (en) | BIM model intelligent generation method and system based on CAD drawing | |
CN107360536A (en) | Control method, terminal device and the computer-readable recording medium of terminal device | |
CN102752294B (en) | Method and system for synchronizing data of multiple terminals on basis of equipment capacity | |
CN109033220B (en) | Automatic selection method, system, equipment and storage medium of labeled data | |
US20200286100A1 (en) | Payment complaint method, device, server and readable storage medium | |
CN104462307A (en) | Searching method and device for object in terminal | |
RU2662405C2 (en) | Certification documents automatic generation | |
CN111445319A (en) | Voucher generation method and device, computer equipment and storage medium | |
CN111047434B (en) | Operation record generation method and device, computer equipment and storage medium | |
CN110222046B (en) | List data processing method, device, server and storage medium | |
CN115408546A (en) | Time sequence data management method, device, equipment and storage medium | |
CN107066175A (en) | Method and device for generating display interface of securities | |
CN110633318A (en) | Data extraction processing method, device, equipment and storage medium | |
CN111209061A (en) | Method and device for filling in user information, computer equipment and storage medium | |
CN107341202A (en) | Appraisal procedure, device and the storage medium of business datum table amendment risk factor | |
CN112199443B (en) | Data synchronization method and device, computer equipment and storage medium | |
CN114445682A (en) | Method, device, electronic equipment, storage medium and product for training model | |
CN107194014B (en) | Data source calling method and device | |
CN111680478B (en) | Report generation method, device, equipment and storage medium based on configuration software | |
US12032584B2 (en) | Data management method and system for a security protection terminal, device and storage medium | |
CN115543428A (en) | Simulated data generation method and device based on strategy template | |
CN115544169A (en) | Data synchronization method, device, equipment and storage medium | |
CN115309658A (en) | Test data derivation method, device, equipment and storage medium |
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 | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: Method and device for calling data sources Granted publication date: 20210528 Pledgee: Industrial Bank Co.,Ltd. Shanghai People's Square Branch Pledgor: GUIZHOU CHINADATAPAY NETWORK TECHNOLOGY CO.,LTD. Registration number: Y2024310000370 |