Movatterモバイル変換


[0]ホーム

URL:


CN113779484B - A data calculation method and device - Google Patents

A data calculation method and device
Download PDF

Info

Publication number
CN113779484B
CN113779484BCN202110019733.XACN202110019733ACN113779484BCN 113779484 BCN113779484 BCN 113779484BCN 202110019733 ACN202110019733 ACN 202110019733ACN 113779484 BCN113779484 BCN 113779484B
Authority
CN
China
Prior art keywords
attribute
group
request
graph
data
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
CN202110019733.XA
Other languages
Chinese (zh)
Other versions
CN113779484A (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co LtdfiledCriticalBeijing Jingdong Century Trading Co Ltd
Priority to CN202110019733.XApriorityCriticalpatent/CN113779484B/en
Publication of CN113779484ApublicationCriticalpatent/CN113779484A/en
Application grantedgrantedCritical
Publication of CN113779484BpublicationCriticalpatent/CN113779484B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种数据计算方法和装置,涉及计算机技术领域。该方法的一具体实施方式包括:接收数据请求,提取所述数据请求中的一个或多个请求属性以及入参数值;以所述一个或多个请求属性构成请求群组,调取数据关联关系表,采用有向无环图算法以所述请求群组为目的节点,生成对应的群组图状链路图;使用有向无环图算法遍历所述群组图状链路图,基于所述属性群组中的待计算属性标识调用相应的计算模型,进而根据所述数据请求中的入参数值计算得出所述一个或多个请求属性的值,并输出。该实施方式能够以一种通用的数据计算方法满足属性复杂程度不同的数据的计算,且本方法逻辑复用性强,易于维护。

The present invention discloses a data calculation method and device, and relates to the field of computer technology. A specific implementation of the method includes: receiving a data request, extracting one or more request attributes and input parameter values in the data request; forming a request group with the one or more request attributes, calling a data association relationship table, using a directed acyclic graph algorithm with the request group as the destination node, and generating a corresponding group graph-like link graph; using a directed acyclic graph algorithm to traverse the group graph-like link graph, calling a corresponding calculation model based on the identifier of the attribute to be calculated in the attribute group, and then calculating the value of the one or more request attributes according to the input parameter value in the data request, and outputting it. This implementation can meet the calculation of data with different attribute complexity with a universal data calculation method, and the method has strong logical reusability and is easy to maintain.

Description

Data calculation method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data computing method and apparatus.
Background
The data has attribute characteristics, the data with complex attributes can be formed or calculated by the data with low-order simple attributes, and for the data with different complex attribute types, the data calculation is usually carried out by formulating proprietary personalized business logic in the prior art.
In the process of realizing the invention, the prior art has at least the following problems:
Proprietary personality business logic is low in multiplexing and difficult to maintain.
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.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a data calculation method according to a first embodiment of the present invention;
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;
FIG. 3 is a schematic diagram of a system architecture of a data computing method according to a third embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of a data computing device according to a fourth embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
Fig. 6 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
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.

Claims (9)

The method comprises the steps of traversing the group graph link graph by using a directed acyclic graph algorithm, calling a corresponding calculation model based on an attribute identifier to be calculated in the attribute group, calculating values of one or more request attributes according to input parameter values in the data request, outputting the values, calling the corresponding calculation model to calculate based on the data values when the attribute to be calculated is a primary attribute, determining an attribute group to which the attribute group belongs according to the attribute to be calculated, calling an analysis method corresponding to the attribute group, performing data format conversion on a calculated result, calling the corresponding calculation model to calculate based on the data values when the attribute to be calculated is a composite attribute, determining the attribute group to which the attribute group belongs according to the attribute to be calculated, calling a merging method corresponding to the attribute group, and merging data on the calculated result.
The computing module is used for traversing the group graph link graph by using a directed acyclic graph algorithm, calling a corresponding computing model based on an attribute identifier to be computed in the attribute group, further computing to obtain values of one or more request attributes according to input parameter values in the data request, and outputting the values, wherein when the attribute to be computed is a native attribute, the corresponding computing model is called to calculate based on the data values, the attribute group to which the attribute group belongs is determined according to the attribute to be computed, the parsing method corresponding to the attribute group is called to convert the data format of the result obtained by the computation, when the attribute to be computed is a composite attribute, the corresponding computing model is called to calculate based on the data values, the attribute group to which the attribute group belongs is determined according to the attribute to be computed, the merging method corresponding to the attribute group is called, and the data merging is carried out on the result obtained by the computation.
CN202110019733.XA2021-01-072021-01-07 A data calculation method and deviceActiveCN113779484B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202110019733.XACN113779484B (en)2021-01-072021-01-07 A data calculation method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202110019733.XACN113779484B (en)2021-01-072021-01-07 A data calculation method and device

Publications (2)

Publication NumberPublication Date
CN113779484A CN113779484A (en)2021-12-10
CN113779484Btrue CN113779484B (en)2025-04-15

Family

ID=78835425

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202110019733.XAActiveCN113779484B (en)2021-01-072021-01-07 A data calculation method and device

Country Status (1)

CountryLink
CN (1)CN113779484B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110136017A (en)*2019-04-082019-08-16复旦大学 A Group Discovery Method Based on Data Augmentation and Nonnegative Matrix Sparse Factorization
CN110415107A (en)*2019-07-262019-11-05同盾控股有限公司Data processing method, device, storage medium and electronic equipment

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US10061841B2 (en)*2015-10-212018-08-28International Business Machines CorporationFast path traversal in a relational database-based graph structure
US11194836B2 (en)*2017-09-132021-12-07International Business Machines CorporationDistributed data storage
CN108416395A (en)*2018-03-272018-08-17东北大学A kind of Interactive Decision-Making tree constructing method based on attribute loop
CN110891021B (en)*2018-09-112022-08-26中兴通讯股份有限公司Path calculation method and device and computer readable storage medium
CN112052152A (en)*2019-06-062020-12-08北京京东尚科信息技术有限公司 A method and device for simulating testing
CN112148926A (en)*2019-06-282020-12-29京东数字科技控股有限公司 A processing method, processing device and storage medium for graph data stream
CN110717076B (en)*2019-09-062024-05-28平安科技(深圳)有限公司Node management method, device, computer equipment and storage medium
CN111818605B (en)*2020-06-302022-07-15中国科学技术大学Ad hoc network dynamic route learning method based on block chain security attribute
CN112035581B (en)*2020-08-212024-06-11北京字节跳动网络技术有限公司Model-based task processing method, device, equipment and medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110136017A (en)*2019-04-082019-08-16复旦大学 A Group Discovery Method Based on Data Augmentation and Nonnegative Matrix Sparse Factorization
CN110415107A (en)*2019-07-262019-11-05同盾控股有限公司Data processing method, device, storage medium and electronic equipment

Also Published As

Publication numberPublication date
CN113779484A (en)2021-12-10

Similar Documents

PublicationPublication DateTitle
CN113485763B (en) Data processing method, device, electronic device and computer readable medium
CN109903105B (en)Method and device for perfecting target commodity attributes
CN112306984B (en) A data source routing method and device
CN114116065A (en)Method and device for acquiring topological graph data object and electronic equipment
CN111062682B (en)Work order processing method and device
WO2021023149A1 (en)Method and apparatus for dynamically returning message
CN104135507A (en)A method and a device for hotlink protection
CN113076153B (en)Interface calling method and device
CN111143408B (en)Event processing method and device based on business rule
CN113742321B (en)Data updating method and device
CN111382953A (en)Dynamic process generation method and device
CN112035581B (en)Model-based task processing method, device, equipment and medium
CN113760343B (en) A method and device for processing a service request
CN113760271B (en) A method and device for generating code for describing a page
CN113779484B (en) A data calculation method and device
CN113157276B (en)Layout file conversion method, apparatus, electronic device, and computer-readable medium
JP7413438B2 (en) Methods, devices, electronic devices and storage media for generating account intimacy
CN113377378B (en)Processing method, device, equipment and storage medium for small program
CN115048529A (en)Path processing method and device, storage medium and electronic equipment
CN116756460B (en)Combined data acquisition method and device and related equipment
CN112905427B (en)Data processing method and device
CN113283923B (en)Resource processing method and device based on block chain
CN113760900B (en)Method and device for real-time summarizing of data and interval summarizing
CN114969444B (en) Data processing method, device, electronic device and storage medium
CN115495518B (en)Method and device for generating chart

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp