Disclosure of Invention
In view of this, the embodiments of the present invention provide a data computing method and apparatus, which can satisfy the computation of data with different attribute complexity by using a general data computing method, and the method has strong logic multiplexing and is easy to maintain.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a data calculation method including:
receiving a data request, and extracting one or more request attributes and an entry parameter value in the data request;
The method comprises the steps of forming a request group by one or more request attributes, calling a data association relation table, and generating a corresponding group graph link graph by adopting a directed acyclic graph algorithm and taking the request group as a target node, wherein the group graph link graph indicates attribute identifiers to be calculated for determining the request attributes, attribute groups formed by the attribute to be calculated and dependency relations among the attribute groups;
Traversing the group graph link graph by using a directed acyclic graph algorithm, calling a corresponding calculation model based on the attribute identification to be calculated in the attribute group, further calculating the values of the one or more request attributes according to the input parameter values in the data request, and outputting the values.
Optionally, the calling the data association relation table uses a directed acyclic graph algorithm to generate a corresponding group graph link graph by using the request group as a destination node, including:
the data association relation table is called, and the dependency relation between the attributes and the attribution relation between the attributes and the groups are obtained;
for each request attribute in the request group, generating an attribute link graph of the request attribute by adopting a directed acyclic graph algorithm with the request attribute as a target node based on the dependency relationship;
and for the attributes to be calculated in all the attribute link graphs, acquiring attribute groups according to the attributes to be calculated based on the attribution relation, using the attribute groups as group nodes, and using the request groups as destination nodes to generate the group graph link graph.
Optionally, the generating a corresponding group graph link map further includes:
and constructing a parameter group according to the input parameter value in the data request to serve as a starting node of the group graph-like link graph.
Optionally, before traversing the group graph link graph using the directed acyclic graph algorithm, further comprising:
acquiring a set of routing conditions among attribute groups, determining one or more routing conditions in the set of routing conditions, and a dependent attribute group and a to-be-calculated attribute group corresponding to the routing conditions, and
And traversing the group graph link graph by using a directed acyclic graph algorithm, and terminating the corresponding route from the dependent attribute group to the attribute group to be calculated if the condition is judged not to be met according to the routing condition.
Optionally, the traversing the group graph link graph using a directed acyclic graph algorithm, invoking a corresponding calculation model based on the attribute identification to be calculated in the attribute group, including:
traversing the group graph link graph by using a directed acyclic graph algorithm, and sequentially triggering the extractors of the attribute groups;
and calling a corresponding calculation model by using the extractor according to the attribute identification to be calculated in the corresponding attribute group.
Optionally, the calculating the value of the one or more request attributes according to the value of the input parameter in the data request includes:
According to the triggering sequence of the extractor of the attribute group, taking the parameter group formed by the input parameter values as initial trigger, sequentially utilizing the extractor to access a data storage medium corresponding to the attribute group so as to read a data value for calculating the attribute to be calculated in the attribute group, and further calling a corresponding calculation model to calculate based on the data value;
Until the group graph link graph traversal is completed, values of one or more request attributes in the request group are obtained.
Optionally, when the attribute to be calculated is a native attribute, after the corresponding calculation model is called to calculate based on the data value, determining an attribute group to which the attribute to be calculated belongs according to the attribute to be calculated, calling an analysis method corresponding to the attribute group, and converting a data format of a result obtained by calculation;
When the attribute to be calculated is a composite attribute, after the corresponding calculation model is called to calculate based on the data value, determining an attribute group to which the attribute to be calculated belongs according to the attribute to be calculated, calling a merging method corresponding to the attribute group, and merging data of a result obtained by calculation.
According to still another aspect of an embodiment of the present invention, there is provided a data computing apparatus including:
the receiving module is used for receiving the data request, extracting one or more request attributes and entry parameter values in the data request;
The composition module is used for forming a request group by the one or more request attributes, calling a data association relation table, and generating a corresponding group graph link graph by adopting a directed acyclic graph algorithm by taking the request group as a target node, wherein the group graph link graph indicates an attribute identifier to be calculated for determining the request attribute, an attribute group formed by the attribute to be calculated and a dependency relation among the attribute groups;
And the calculation module is used for traversing the group graph link graph by using a directed acyclic graph algorithm, calling a corresponding calculation model based on the attribute identification to be calculated in the attribute group, further calculating the values of the one or more request attributes according to the input parameter values in the data request, and outputting the values.
Optionally, the composition module invokes the data association table, and uses a directed acyclic graph algorithm to generate a corresponding group graph link graph by using the request group as a destination node, including:
the data association relation table is called, and the dependency relation between the attributes and the attribution relation between the attributes and the groups are obtained;
for each request attribute in the request group, generating an attribute link graph of the request attribute by adopting a directed acyclic graph algorithm with the request attribute as a target node based on the dependency relationship;
and for the attributes to be calculated in all the attribute link graphs, acquiring attribute groups according to the attributes to be calculated based on the attribution relation, using the attribute groups as group nodes, and using the request groups as destination nodes to generate the group graph link graph.
Optionally, the composition module generates a corresponding group graph link map, and further includes:
and constructing a parameter group according to the input parameter value in the data request to serve as a starting node of the group graph-like link graph.
Optionally, before traversing the group graph link graph using the directed acyclic graph algorithm, further comprising:
acquiring a set of routing conditions among attribute groups, determining one or more routing conditions in the set of routing conditions, and a dependent attribute group and a to-be-calculated attribute group corresponding to the routing conditions, and
And traversing the group graph link graph by using a directed acyclic graph algorithm, and terminating the corresponding route from the dependent attribute group to the attribute group to be calculated if the condition is judged not to be met according to the routing condition.
Optionally, the computing module traverses the group graph link graph using a directed acyclic graph algorithm, invokes a corresponding computing model based on the attribute identification to be computed in the attribute group, including:
traversing the group graph link graph by using a directed acyclic graph algorithm, and sequentially triggering the extractors of the attribute groups;
and calling a corresponding calculation model by using the extractor according to the attribute identification to be calculated in the corresponding attribute group.
Optionally, the calculating module calculates the values of the one or more request attributes according to the values of the parameters in the data request, including:
According to the triggering sequence of the extractor of the attribute group, taking the parameter group formed by the input parameter values as initial trigger, sequentially utilizing the extractor to access a data storage medium corresponding to the attribute group so as to read a data value for calculating the attribute to be calculated in the attribute group, and further calling a corresponding calculation model to calculate based on the data value;
Until the group graph link graph traversal is completed, values of one or more request attributes in the request group are obtained.
Optionally, when the attribute to be calculated is a native attribute, the calculation module further includes determining an attribute group to which the attribute to be calculated belongs according to the attribute to be calculated after calling a corresponding calculation model to calculate based on the data value, calling an analysis method corresponding to the attribute group, and performing data format conversion on a result obtained by calculation;
When the attribute to be calculated is a composite attribute, the calculation module further comprises determining an attribute group to which the attribute to be calculated belongs according to the attribute to be calculated after calling a corresponding calculation model to calculate based on the data value, calling a merging method corresponding to the attribute group, and merging data of a result obtained by calculation.
According to another aspect of an embodiment of the present invention, there is provided a data computing electronic device including:
one or more processors;
Storage means for storing one or more programs,
When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the data computing method provided by the present invention.
According to still another aspect of the embodiments of the present invention, there is provided a computer-readable medium having stored thereon a computer program which, when executed by a processor, implements the data calculation method provided by the present invention.
The embodiment of the invention has the advantages that the technical means of acquiring the result of the data request when the traversing is finished is realized because the group graph link graph corresponding to the data request is constructed by adopting the directed acyclic graph algorithm based on the data association relation table according to the data request, and then the group graph link graph is traversed, so that the technical means of acquiring the result of the data request is overcome, the technical problems of low service logic multiplexing and difficult maintenance caused by formulating special individual service logic for data calculation in the prior art for data with different complex attribute types are solved, the calculation of the data with different attribute complexity is further met by a general data calculation method, and the calculation method has strong logic multiplexing and is easy to maintain.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a data calculation method according to a first embodiment of the present invention, as shown in fig. 1, including:
step S101, receiving a data request, and extracting one or more request attributes and an entry parameter value in the data request;
Step S102, forming a request group by using the one or more request attributes, calling a data association relation table, and generating a corresponding group graph link graph by using a directed acyclic graph algorithm and taking the request group as a target node, wherein the group graph link graph indicates an attribute identifier to be calculated for determining the request attribute, an attribute group formed by the attribute to be calculated and a dependency relation among the attribute groups;
Step S103, traversing the group graph link graph by using a directed acyclic graph algorithm, calling a corresponding calculation model based on the attribute identification to be calculated in the attribute group, further calculating the values of the one or more request attributes according to the input parameter values in the data request, and outputting the values.
The data request may include parameter value information, as well as the requested data attributes. The data request may be such that when X, Y conditions are satisfied, the request returns a value of data with data attribute Z, where the access parameter value may be extracted according to X, Y conditions, and information with request attribute may be extracted according to "data attribute Z" (request attribute of the request is "Z").
The data association table may be preconfigured, and may include association dependency relationships between attributes (specifically, for example, when an attribute value of a P attribute needs to be determined depending on an attribute value of a Q attribute, the P attribute may be considered to be dependent on the Q attribute), or may include a attribution relationship between an attribute and an attribute group (specifically, for an attribute of the same feature, the attribute may be classified into the same group). By configuring the data association relation table, the dependency relation between the attributes and the attribute and the attribution relation between the attributes and the attribute group can be dynamically planned, and when attribute update exists or the attribute dependency relation is updated, the data association relation table is only required to be modified, so that the method is flexibly applicable to various service scenes.
The composition is carried out by adopting a directed acyclic graph algorithm (DAG (Directed Acyclic Graph) algorithm) based on the data association relation table, so that the occurrence of annular dependence can be stopped, infinite circulation is avoided, and further, the exhaustion of system resources is avoided, and the system can not normally provide service. In the graph, the group is used as a node, the group can be used as granularity for traversing, the resource space is saved, and meanwhile, the representation of the dependency relationship among the attributes is not influenced.
The calculation model corresponding to various attributes can be pre-configured, logic operation rules, number taking rules and the like can be formulated in the calculation model, and various capabilities such as parameter analysis capability, composite attribute combining capability, attribute value conversion capability, attribute and group routing capability, group value analysis capability, number taking device routing capability and the like can be configured for invoking data calculation. The rule or the capability can be configured for a certain group, and then the rule or the capability can be used for calculating the attribute value in the group, so that each attribute does not need to be configured independently, and the effect of saving resources is achieved.
The invention can construct the group graph link diagram corresponding to the data request by adopting the directed acyclic graph algorithm based on the data association relation table according to one or more request attributes and the input parameter values in the data request, and further traverse the group graph link diagram so as to trigger the calculation method of the attributes in the group in sequence based on the input parameter values in the data request, so that the result of the data request can be obtained when the traversing is finished. The invention can meet the calculation of data with different attribute complexity by a general data calculation method, and the calculation method has strong logic reusability and is easy to maintain.
In some embodiments, the invoking the data association table uses a directed acyclic graph algorithm to generate a corresponding group graph link graph with the request group as a destination node, including:
the data association relation table is called, and the dependency relation between the attributes and the attribution relation between the attributes and the groups are obtained;
for each request attribute in the request group, generating an attribute link graph of the request attribute by adopting a directed acyclic graph algorithm with the request attribute as a target node based on the dependency relationship;
and for the attributes to be calculated in all the attribute link graphs, acquiring attribute groups according to the attributes to be calculated based on the attribution relation, using the attribute groups as group nodes, and using the request groups as destination nodes to generate the group graph link graph.
Further, in some embodiments, the generating a corresponding group graph link map further includes constructing a parameter group according to the entry parameter value in the data request as a starting node of the group graph link map.
The method can generate attribute links of each request attribute in the request group based on the dependency relationship among the attributes, then combine the attribute links based on the attribute and the attribution relationship of the group to obtain a group graph link diagram with the group as granularity, and can directly generate the group graph link diagram with the group as granularity based on the dependency relationship and the attribution relationship at the same time in some practical applications.
The directed acyclic graph algorithm (DAG (Directed Acyclic Graph) algorithm) is adopted for composition, so that the function of monitoring whether the cyclic dependency relationship exists in the data association relationship table in the composition process can be achieved, and when the cyclic dependency relationship exists, normal composition cannot be achieved, and further infinite circulation can be avoided, system resource exhaustion is avoided, and the system cannot normally provide service.
In some embodiments, before traversing the group graph link graph using the directed acyclic graph algorithm, further comprising:
acquiring a set of routing conditions among attribute groups, determining one or more routing conditions in the set of routing conditions, and a dependent attribute group and a to-be-calculated attribute group corresponding to the routing conditions, and
And traversing the group graph link graph by using a directed acyclic graph algorithm, and terminating the corresponding route from the dependent attribute group to the attribute group to be calculated if the condition is judged not to be met according to the routing condition.
Fig. 2 is a schematic diagram of a group graph link diagram in a data computing method according to a second embodiment of the present invention, where the group graph link diagram in fig. 2 is constructed by using a parameter group as a start node and a request group as a destination node, as shown in fig. 2:
Group A, group C, group E depend on parameter group, group B depends on group A, group D may depend on group C if routing conditions are met, group F depends on group C and group E, group G depends on group G, request group depends on group B, group D, group G;
wherein for group D and group C, routing to group D further triggers the fetch logic of group D only if the routing condition is met, otherwise terminating routing from group C to group D. The routing condition can be set according to a specific service scene, for example, the condition that all the attributes to be calculated in the group C are successfully valued can be set, or the condition that the current time exceeds 12:00 can be set.
In some embodiments, the traversing the group graph link graph using a directed acyclic graph algorithm invokes a corresponding computation model based on the to-be-computed attribute identifications in the attribute group, comprising:
Traversing the group graph link graph by using a directed acyclic graph algorithm, sequentially triggering the extractor of the attribute group, and calling a corresponding calculation model by using the extractor according to the attribute identifier to be calculated in the corresponding attribute group.
Further, in some embodiments, the calculating the values of the one or more request attributes from the values of the entry parameters in the data request includes:
According to the triggering sequence of the extractor of the attribute group, taking the parameter group formed by the input parameter values as initial trigger, sequentially utilizing the extractor to access a data storage medium corresponding to the attribute group so as to read a data value for calculating the attribute to be calculated in the attribute group, and further calling a corresponding calculation model to calculate based on the data value;
Until the group graph link graph traversal is completed, values of one or more request attributes in the request group are obtained.
For the constructed group graph link diagram, a DAG (DIRECTED ACYCLIC GRAPH directed acyclic graph) algorithm is used for traversing the whole link, a group execution fetcher can be triggered one by one from a parameter group in actual execution, routing capacity can be executed before actual execution fetcher, whether routing conditions of the group meet the fetcher or not is judged, and whether computing resources are started or not is further judged to execute fetcher operation;
For the group meeting the routing condition, the access capability of the preconfigured access device can be triggered to execute the access operation, the access devices of the different attribute groups can correspond to the encapsulation of access logic such as a database, a Redis cache, a remote service, a memory and the like, and in some practical applications, a general interface can be provided to shield the difference of the access logic.
Until the group graph link graph traversal is completed, all the group corresponding extractors complete the fetching operation, and the request attribute in the request group also completes the value operation, so that the value of one or more request attributes in the request group can be obtained. A result collector may be provided that, after obtaining the values of the one or more request attributes in the request group, may begin to respond to the request results of the data request, returning the values of the one or more request attributes as request results.
In some embodiments, when the attribute to be calculated is a native attribute, after the corresponding calculation model is called to calculate based on the data value, determining an attribute group to which the attribute to be calculated belongs according to the attribute to be calculated, calling an analysis method corresponding to the attribute group, and performing data format conversion on a result obtained by calculation;
When the attribute to be calculated is a composite attribute, after the corresponding calculation model is called to calculate based on the data value, determining an attribute group to which the attribute to be calculated belongs according to the attribute to be calculated, calling a merging method corresponding to the attribute group, and merging data of a result obtained by calculation.
The attribute can be divided into a primary attribute and a composite attribute, wherein the composite attribute can be obtained by combining and arranging other primary attributes or composite attributes (for example, the attribute values of the two primary attributes are connected through a symbol "/", so as to obtain an attribute value of the composite attribute). In some practical applications, specific value-taking logics of the original attribute and the composite attribute can be different, after the original attribute is taken as the value by using a calculation model, a value analysis strategy can be obtained from a group to which the original attribute belongs, and then the value-taking logic is executed according to the value analysis strategy, in some applications, after the original attribute is taken as the value, the value conversion capability can be configured, and attribute value post-processing is performed by executing the capability. After the calculation model is used for taking the value of the composite attribute, the value merging capability can be used for merging the dependent attribute values according to the merging strategy.
Fig. 3 is a schematic system architecture diagram of a data computing method according to a third embodiment of the present invention, as shown in fig. 3, including:
The interface layer is used for receiving the data request and further extracting the input parameter value and the request attribute;
a business layer for configuring a data association relation table and constructing a corresponding group graph link graph according to the information in the data request based on the data association relation table
And the data layer is used for configuring different data storage media to store various information for calculating the data attribute values.
According to the method provided by the invention, the programmable model of the original attribute, the composite attribute and the main attribute group can be provided, the programmable model can be suitable for complex service data requests, the complex problem is disassembled into a plurality of simple multi-dimensional sub-problems, and finally the service data request results are obtained according to the requirements and the sequence. The fetch frame system constructed by the method of the invention can integrate complete abstract capability sets (such as parameter analysis capability, composite attribute merging capability, attribute value conversion capability, attribute and group routing capability, group value analysis capability, fetch device routing capability, fetch device fetch capability and the like), and the capabilities carry out universal encapsulation on general logic, support high expansion and have high multiplexing.
As shown in fig. 3, the data request may include parameter values, such as specific commodity number (parameter 1), terminal type (parameter 2), and site information (parameter 3), and these parameters may be encapsulated as parameter attributes, which are attributed to parameter groups, and the attribute fields 1, 2, 3, 4, and 5 in the data request are request attributes, so as to form a request group.
The process of calculating request attribute values in a request group is illustrated in fig. 3:
for request attribute 1:
As can be seen from fig. 3, the request attribute 1 depends on the composite attribute a, the composite attribute a is composed of the native attribute a, and the composite attribute a can be considered to depend on the native attribute a, and the native attribute a belongs to the subgroup 1 in the main group 1, and the value flow of the request attribute 1 can be as follows:
Based on the parameter group, calculating to obtain the value of the original attribute a in the subgroup 1 in the main group 1, further calculating to obtain the value of the composite attribute A based on the value of the original attribute a, and calculating to obtain the value of the request attribute 1 based on the value of the composite attribute A.
Fig. 4 is a schematic diagram of main modules of a data computing device according to a fourth embodiment of the present invention, and as shown in fig. 4, a data computing device 400 includes:
a receiving module 401, configured to receive a data request, and extract one or more request attributes and an entry parameter value in the data request;
a composition module 402, configured to form a request group with the one or more request attributes, invoke a data association table, and generate a corresponding group graph link graph with the request group as a destination node by using a directed acyclic graph algorithm, where the group graph link graph indicates an attribute identifier to be calculated for determining the request attribute, an attribute group formed by the attribute to be calculated, and a dependency relationship between the attribute groups;
and the calculating module 403 is configured to traverse the group graph link graph using a directed acyclic graph algorithm, invoke a corresponding calculation model based on the attribute identifier to be calculated in the attribute group, and further calculate values of the one or more request attributes according to the input parameter values in the data request, and output the values.
The data request may include parameter value information, as well as the requested data attributes. The data request may be such that when X, Y conditions are satisfied, the request returns a value of data with data attribute Z, where the access parameter value may be extracted according to X, Y conditions, and information with request attribute may be extracted according to "data attribute Z" (request attribute of the request is "Z").
The data association table may be preconfigured, and may include association dependency relationships between attributes (specifically, for example, when an attribute value of a P attribute needs to be determined depending on an attribute value of a Q attribute, the P attribute may be considered to be dependent on the Q attribute), or may include a attribution relationship between an attribute and an attribute group (specifically, for an attribute of the same feature, the attribute may be classified into the same group). By configuring the data association relation table, the dependency relation between the attributes and the attribute and the attribution relation between the attributes and the attribute group can be dynamically planned, and when attribute update exists or the attribute dependency relation is updated, the data association relation table is only required to be modified, so that the method is flexibly applicable to various service scenes.
The composition is carried out by adopting a directed acyclic graph algorithm (DAG (Directed Acyclic Graph) algorithm) based on the data association relation table, so that the occurrence of annular dependence can be stopped, infinite circulation is avoided, and further, the exhaustion of system resources is avoided, and the system can not normally provide service. In the graph, the group is used as a node, the group can be used as granularity for traversing, the resource space is saved, and meanwhile, the representation of the dependency relationship among the attributes is not influenced.
The calculation model corresponding to various attributes can be pre-configured, logic operation rules, number taking rules and the like can be formulated in the calculation model, and various capabilities such as parameter analysis capability, composite attribute combining capability, attribute value conversion capability, attribute and group routing capability, group value analysis capability, number taking device routing capability and the like can be configured for invoking data calculation. The rule or the capability can be configured for a certain group, and then the rule or the capability can be used for calculating the attribute value in the group, so that each attribute does not need to be configured independently, and the effect of saving resources is achieved.
The invention can construct the group graph link diagram corresponding to the data request by adopting the directed acyclic graph algorithm based on the data association relation table according to one or more request attributes and the entry parameter values in the data request, and further traverses the group graph link diagram by adopting the directed acyclic graph algorithm so as to trigger the calculation method of the attributes in the group in sequence based on the entry parameter values in the data request, so that the result of the data request can be obtained when the traversing is finished. The invention can meet the calculation of data with different attribute complexity by a general data calculation method, and the calculation method has strong logic reusability and is easy to maintain.
In some embodiments, the composition module invokes a data association table, and uses a directed acyclic graph algorithm to generate a corresponding group graph link graph with the request group as a destination node, including:
The method comprises the steps of acquiring a data association relation table, acquiring a dependency relation between attributes and a attribution relation between the attributes and groups, generating an attribute link map of the request attribute by taking the request attribute as a target node based on the dependency relation by adopting a directed acyclic graph algorithm for each request attribute in the request group, acquiring an attribute group based on the attribution relation according to the attribute to be calculated in all attribute link maps, and generating a group graph link map by taking the request group as a target node.
Further, in some embodiments, the composition module generates a corresponding group graph link map, and further includes constructing a parameter group according to the entry parameter value in the data request, so as to serve as a starting node of the group graph link map.
The method can generate attribute links of each request attribute in the request group based on the dependency relationship among the attributes, then combine the attribute links based on the attribute and the attribution relationship of the group to obtain a group graph link diagram with the group as granularity, and can directly generate the group graph link diagram with the group as granularity based on the dependency relationship and the attribution relationship at the same time in some practical applications.
The directed acyclic graph algorithm (DAG (Directed Acyclic Graph) algorithm) is adopted for composition, so that the function of monitoring whether the cyclic dependency relationship exists in the data association relationship table in the composition process can be achieved, and when the cyclic dependency relationship exists, normal composition cannot be achieved, and further infinite circulation can be avoided, system resource exhaustion is avoided, and the system cannot normally provide service.
In some embodiments, before traversing the group graph link graph using the directed acyclic graph algorithm, further comprising:
acquiring a set of routing conditions among attribute groups, determining one or more routing conditions in the set of routing conditions, and a dependent attribute group and a to-be-calculated attribute group corresponding to the routing conditions, and
And traversing the group graph link graph by using a directed acyclic graph algorithm, and terminating the corresponding route from the dependent attribute group to the attribute group to be calculated if the condition is judged not to be met according to the routing condition.
For example, if group D may rely on group C if the routing condition is met, then this means that for both group D and group C, routing to group D only occurs if the routing condition is met, thereby triggering the fetch logic of group D, otherwise terminating the routing from group C to group D. The routing condition can be set according to a specific service scene, for example, the condition that all the attributes to be calculated in the group C are successfully valued can be set, or the condition that the current time exceeds 12:00 can be set.
In some embodiments, the computing module traverses the group graph link graph using a directed acyclic graph algorithm, invokes a corresponding computing model based on the to-be-computed attribute identifications in the attribute group, including:
Traversing the group graph link graph by using a directed acyclic graph algorithm, sequentially triggering the extractor of the attribute group, and calling a corresponding calculation model by using the extractor according to the attribute identifier to be calculated in the corresponding attribute group.
Further, in some embodiments, the calculating module calculates the values of the one or more request attributes from the values of the entry parameters in the data request, including:
According to the triggering sequence of the extractor of the attribute group, taking the parameter group formed by the input parameter values as initial trigger, sequentially utilizing the extractor to access a data storage medium corresponding to the attribute group so as to read a data value for calculating the attribute to be calculated in the attribute group, and further calling a corresponding calculation model to calculate based on the data value;
Until the group graph link graph traversal is completed, values of one or more request attributes in the request group are obtained.
For the constructed group graph link diagram, a DAG (DIRECTED ACYCLIC GRAPH directed acyclic graph) algorithm is used for traversing the whole link, a group execution fetcher can be triggered one by one from a parameter group in actual execution, routing capacity can be executed before actual execution fetcher, whether routing conditions of the group meet the fetcher or not is judged, and whether computing resources are started or not is further judged to execute fetcher operation;
For the group meeting the routing condition, the access capability of the preconfigured access device can be triggered to execute the access operation, the access devices of the different attribute groups can correspond to the encapsulation of access logic such as a database, a Redis cache, a remote service, a memory and the like, and in some practical applications, a general interface can be provided to shield the difference of the access logic.
Until the group graph link graph traversal is completed, all the group corresponding extractors complete the fetching operation, and the request attribute in the request group also completes the value operation, so that the value of one or more request attributes in the request group can be obtained. A result collector may be provided that, after obtaining the values of the one or more request attributes in the request group, may begin to respond to the request results of the data request, returning the values of the one or more request attributes as request results.
In some embodiments, when the attribute to be calculated is a native attribute, the calculation module further includes determining an attribute group to which the attribute to be calculated belongs according to the attribute to be calculated after invoking a corresponding calculation model to calculate based on the data value, invoking an analysis method corresponding to the attribute group, and performing data format conversion on a result obtained by calculation;
When the attribute to be calculated is a composite attribute, the calculation module further comprises determining an attribute group to which the attribute to be calculated belongs according to the attribute to be calculated after calling a corresponding calculation model to calculate based on the data value, calling a merging method corresponding to the attribute group, and merging data of a result obtained by calculation.
The attribute can be divided into a primary attribute and a composite attribute, wherein the composite attribute can be obtained by combining and arranging other primary attributes or composite attributes (for example, the attribute values of the two primary attributes are connected through a symbol "/", so as to obtain an attribute value of the composite attribute). In some practical applications, specific value-taking logics of the original attribute and the composite attribute can be different, after the original attribute is taken as the value by using a calculation model, a value analysis strategy can be obtained from a group to which the original attribute belongs, and then the value-taking logic is executed according to the value analysis strategy, in some applications, after the original attribute is taken as the value, the value conversion capability can be configured, and attribute value post-processing is performed by executing the capability. After the calculation model is used for taking the value of the composite attribute, the value merging capability can be used for merging the dependent attribute values according to the merging strategy.
According to the method provided by the invention, the programmable model of the original attribute, the composite attribute and the main attribute group can be provided, the programmable model can be suitable for complex service data requests, the complex problem is disassembled into a plurality of simple multi-dimensional sub-problems, and finally the service data request results are obtained according to the requirements and the sequence. The fetch frame system constructed by the method of the invention can integrate complete abstract capability sets (such as parameter analysis capability, composite attribute merging capability, attribute value conversion capability, attribute and group routing capability, group value analysis capability, fetch device routing capability, fetch device fetch capability and the like), and the capabilities carry out universal encapsulation on general logic, support high expansion and have high multiplexing.
Fig. 5 illustrates an exemplary system architecture 500 to which the data computing method or data computing apparatus of embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 505 via the network 504 using the terminal devices 501, 502, 503 to receive or send messages or the like. Various applications requiring data acquisition, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 501, 502, 503.
The terminal devices 501, 502, 503 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server providing support for shopping-type websites browsed by the user using the terminal devices 501, 502, 503. The background management server can analyze and process the received data such as the data calculation request and the like, and feed back the processing result to the terminal equipment.
It should be noted that, the data computing method provided in the embodiment of the present invention is generally executed by the server 505, and accordingly, the data computing device is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 6 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Connected to the I/O interface 605 are an input section 606 including a keyboard, a mouse, and the like, an output section 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like, a storage section 608 including a hard disk, and the like, and a communication section 609 including a network interface card such as a LAN card, a modem, and the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, which may be described as, for example, a processor comprising a receiving module, a patterning module, a calculating module. The names of these modules do not constitute a limitation on the module itself in some cases.
As a further aspect, the invention also provides a computer readable medium which may be comprised in the device described in the above embodiments or may be present alone without being fitted into the device. The computer readable medium carries one or more programs, when the one or more programs are executed by the device, the device comprises a step S101 of receiving data requests, extracting one or more request attributes and input parameter values in the data requests, a step S102 of forming a request group by the one or more request attributes, calling a data association relation table, adopting a directed acyclic graph algorithm to take the request group as a destination node, generating a corresponding group graph-like link graph, wherein the group graph-like link graph indicates attribute identifiers to be calculated for determining the request attributes, attribute groups formed by the attributes to be calculated and the dependency relation among the attribute groups, a step S103 of traversing the group graph-like link graph by using the directed acyclic graph algorithm, calling a corresponding calculation model based on the attribute identifiers to be calculated in the attribute groups, further calculating the values of the one or more request attributes according to the input parameter values in the data requests, and outputting the values.
According to the technical scheme of the embodiment of the invention, the technical means that the data request results can be obtained when the traversal is finished is realized because the group graph link graph corresponding to the data request is constructed by adopting the directed acyclic graph algorithm based on the data association relation table according to the data request, and then the group graph link graph is traversed, so that the technical problems of low service logic reusability and difficult maintenance caused by the data calculation of the special personalized service logic formulated for the data with different complex attribute types in the prior art are solved, the data with different attribute complexity can be calculated by adopting a general data calculation method, the calculation method has strong logic reusability, and the maintenance is easy.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.