CN107194014B - Data source calling method and device - Google Patents

Data source calling method and device Download PDF

Info

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
Application number
CN201710538674.0A
Other languages
Chinese (zh)
Other versions
CN107194014A (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.)
Guizhou Chinadatapay Network Technology Co ltd
Original Assignee
Guizhou Chinadatapay Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guizhou Chinadatapay Network Technology Co ltd filed Critical Guizhou Chinadatapay Network Technology Co ltd
Priority to CN201710538674.0A priority Critical patent/CN107194014B/en
Publication of CN107194014A publication Critical patent/CN107194014A/en
Application granted granted Critical
Publication of CN107194014B publication Critical patent/CN107194014B/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/25Integrating or interfacing systems involving database management systems

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

Data source calling method and device
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:
Figure BDA0001341295760000041
calculating corresponding of each data source
Figure BDA0001341295760000042
Find out
Figure BDA0001341295760000043
The data source corresponding to J is the target data source.
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:
Figure BDA0001341295760000061
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.
Calculating for each alternative backup data source
Figure BDA0001341295760000071
Find out
Figure BDA0001341295760000072
The 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:
Figure FDA0002707875310000011
calculating corresponding of each data source
Figure FDA0002707875310000012
Find out
Figure FDA0002707875310000013
The data source corresponding to J is the target data source;
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:
Figure FDA0002707875310000021
wherein the content of the first and second substances,
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.
CN201710538674.0A 2017-07-04 2017-07-04 Data source calling method and device Active CN107194014B (en)

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)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866383A (en) * 2015-05-29 2015-08-26 北京金山安全软件有限公司 Interface calling method and device and terminal
CN106649488A (en) * 2016-09-30 2017-05-10 广东网金数据服务有限公司 Method and device for invoking multi-data-source interaction interface
CN106649363A (en) * 2015-10-30 2017-05-10 北京国双科技有限公司 Data query method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
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
CN109597822B (en) User data storage and query method and user data processing device
US11003754B2 (en) Method and apparatus for user authentication based on feature information
US10963888B2 (en) Payment complaint method, device, server and readable storage medium
CN109325118B (en) Unbalanced sample data preprocessing method and device and computer equipment
CN102752294B (en) Method and system for synchronizing data of multiple terminals on basis of equipment capacity
CN107832440B (en) Data mining method, device, server and computer readable storage medium
CN104462307A (en) Searching method and device for object in terminal
CN102707948B (en) Source code generation method
CN104572781A (en) Method and device for generating transaction log
WO2022105119A1 (en) Training corpus generation method for intention recognition model, and related device thereof
CN111047434B (en) Operation record generation method and device, computer equipment and storage medium
CN112036125B (en) Document management method and device and computer equipment
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
CN107066175A (en) Method and device for generating display interface of securities
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
CN110222046B (en) List data processing method, device, server and storage medium
CN107194014B (en) Data source calling method and device
CN115543428A (en) Simulated data generation method and device based on strategy template
CN115408546A (en) Time sequence data management method, device, equipment and storage medium
CN115762523A (en) Fault record acquisition method and device, electronic equipment and readable storage medium
CN114138813A (en) Attribute configuration method and related device
US10839519B2 (en) Techniques to improve edge detection for images
CN110517010A (en) A kind of data processing method, system 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