A multi-dimensional object data statistics method based on annotation configuration

By configuring the @StateStatistic annotation on object properties to define statistical rules, and using a statistical calculator to perform calculations automatically, the problem of non-reusable code and difficult maintenance in existing technologies is solved, and efficient, accurate statistics and easy maintenance of multi-dimensional objects are achieved.

CN115756395BActive Publication Date: 2026-02-17FUJIAN FUJITSU COMM SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211491984.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-25
Publication Date
2026-02-17
Estimated Expiration
2042-11-25

AI Technical Summary

Technical Problem

Existing technologies for system data statistics suffer from problems such as non-reusable code, cumbersome development process, excessive code duplication, susceptibility to errors, and difficulty in later maintenance.

Method used

A multidimensional object data statistics method based on annotation configuration is adopted. Statistical rules are defined by configuring the @StateStatistic annotation on object properties, and the statistical calculator is used to perform calculations automatically. It supports built-in and custom rules and reduces hard coding.

Benefits of technology

It improves the efficiency and accuracy of statistics for multi-dimensional objects, has a clear code structure, is easy to maintain, and supports the extension of personalized statistical rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115756395B_ABST
    Figure CN115756395B_ABST
Patent Text Reader

Abstract

The application discloses a multi-dimensional object data statistical method based on annotation configuration. For the object with complex and numerous attributes, corresponding annotation information is configured on the object attribute, the statistical rule is defined, the statistical result is automatically output by the operation framework, and additional hard code does not need to be written again. The method class of the rule class can be realized and expanded through the self-defined method, and the code structure is clear and high in maintainability. The application improves the statistical efficiency and accuracy of multi-dimensional objects, adopts the annotation configuration mode to define the attribute statistical method, and reduces code writing and redundancy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network technology and security, and in particular to a method for statistical analysis of multidimensional object data based on annotation configuration. Background Technology

[0002] In everyday application systems, data statistics across various dimensions are the most frequent and important needs of users. Data statistics are characterized by numerous object attributes, diverse types, and different statistical rules.

[0003] The current common practice in R&D is to traverse all dimensions of data and write specific code to perform statistical calculations according to the rules for each data point. This results in non-reusable code, a cumbersome development process, a lot of repetitive code, and a high risk of errors and omissions. It also increases the difficulty and cost of later-stage dimension calculations. Summary of the Invention

[0004] The purpose of this invention is to provide a multidimensional object data statistics method based on annotation configuration. By using a configuration-based approach, it accurately matches object statistical rules, abstracts and merges repetitive statistical rules, making the statistical algorithm structure clearer, the statistical values ​​more accurate, the later maintenance easier, and the code decoupling better.

[0005] The technical solution adopted in this invention is:

[0006] A method for statistical analysis of multidimensional object data based on annotation configuration includes the following steps:

[0007] Step 1: Configure the annotation @StateStatistic(method = operation rule class) on the property of object A that needs to be statistically calculated;

[0008] Step 2: Query and retrieve the collection object LA that needs to be statistically analyzed. Then, merge and analyze multiple objects A within collection object LA according to attribute dimensions to obtain collection A'. The specific steps are as follows:

[0009] Step 1: Configure the annotation @StateStatistic(method = operation rule class) on the Class A property that needs to perform statistical calculations;

[0010] Step 2: Query and retrieve the collection object LA that needs to be statistically analyzed. Then, merge and analyze multiple Class A objects within collection object LA according to attribute dimensions to obtain collection A'. The specific steps are as follows:

[0011] Step 2-1: Create a new instance A' for statistical results;

[0012] Step 2-2: Define a StatisticHandler. The StatisticHandler has a merge method that takes a collection of statistical objects LA and outputs the results to A'.

[0013] Step 2-3: The merge method iterates through the object collection LA, obtains one of the A objects that needs to be statistically calculated as the current object to be counted A1, and proceeds to step 2-3.

[0014] Steps 2-4: Use reflection to obtain all the attributes of the structural description A of A1, and use one of the attributes as the current attribute S1;

[0015] Steps 2-5: Obtain the operation rule type of the annotation configuration for the current attribute S1;

[0016] Steps 2-6: Pass the value of the current attribute S1 into the calculation rule class for statistical calculation;

[0017] When the operation rule class is accumulation, the S1 property of A' is added to the S1 property of A1, and the result of the statistical operation is loaded into the S1 property of A' through reflection.

[0018] When the operation rule class is concatenation, the S1 property of A' is taken and concatenated with the S1 property of A1, and the statistical operation result is loaded into the S1 property of A' through reflection method;

[0019] When the operation rule class is AND or OR, the S1 property of A' is compared with the S1 property of A1 using a Boolean rule, and the statistical operation result is loaded into the S1 property of A' through reflection.

[0020] Step 2-7: Determine if all attributes of the current object A1 have been traversed; if so, end the attribute traversal and execute step 2-7; otherwise, obtain the next attribute of the current object A1 as the current attribute S1 and execute step 2-4.

[0021] Step 2-8: Determine whether all objects in the object collection LA have been traversed; if yes, end the object traversal and execute step 2-9; otherwise, obtain the next A object as the current object A1 and execute step 2-4.

[0022] Steps 2-9: Complete all calculations and output the result A'.

[0023] Specifically, the A' object has the same structure as the A object. It is the result of the operation of the various dimensions of the attributes of all objects in the LA collection. The operation result values ​​in steps 2-6 above are filled into the A' object. For example, if there are A1, A2, and A3 in LA, then A' is A1+A2+A3.

[0024] Furthermore, in step 1, the configuration annotation @StateStatistic is defined on the object property that needs to be statistically analyzed, and the statistical rule class of the property is defined, which includes built-in rules such as accumulation rule executor, concatenation rule executor, and AND / OR rule executor.

[0025] Furthermore, in step 1, when the object attribute statistics rule is not in the built-in rule executor, a custom rule implementation class can be defined to implement the interface method StatisticMethod.execute, and then the custom implementation class can be configured on the configuration annotation.

[0026] Furthermore, in steps 2-6, when the operation rule class is a custom rule, the custom rule for taking the S1 attribute of A' and the S1 attribute of A1 is compared, and the statistical operation result is loaded into the S1 attribute of A' through reflection.

[0027] This invention employs the above technical solution. For objects with complex and numerous attributes, it defines statistical rules by configuring corresponding annotation information on the object attributes. The computational framework automatically outputs the statistical results without requiring additional hard-coded code. For needs with customized statistical rules, extensions can be achieved through custom rule class methods. The code structure is clear and highly maintainable. This invention improves the statistical efficiency and accuracy of multi-dimensional objects by defining attribute statistical methods through annotation configuration, reducing code writing and redundancy. This invention provides an extensible custom statistical rule method to handle various personalized rule statistics. Attached Figure Description

[0028] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments;

[0029] Figure 1 This is a schematic diagram illustrating the principle of a multidimensional object data statistics method based on annotation configuration according to the present invention. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0031] To perform statistical operations on a collection object, one typically needs to analyze which method to use for merging each attribute. Some require accumulation, some concatenation, and others AND / OR comparisons. This invention uses attribute definition annotations to configure the statistical rules for the attributes of the entity object. A statistical calculator then performs rule-based calculations on the collection object. Currently, it has abstracted annotations for accumulation, character concatenation, and AND / OR merging operations, and also supports extensible custom operation annotations.

[0032] like Figure 1 As shown, this invention discloses a method for statistical analysis of multidimensional object data based on annotation configuration, which includes the following steps:

[0033] Step 1: Configure the annotation @StateStatistic(method = operation rule class) on the property of object A that needs to be statistically calculated;

[0034] Step 2: Query and retrieve the collection object LA that needs to be statistically analyzed. Then, merge and analyze multiple objects A within collection object LA according to attribute dimensions to obtain collection A'. The specific steps are as follows:

[0035] Step 1: Configure the annotation @StateStatistic(method = operation rule class) on the Class A property that needs to perform statistical calculations;

[0036] Step 2: Query and retrieve the collection object LA that needs to be statistically analyzed. Then, merge and analyze multiple Class A objects within collection object LA according to attribute dimensions to obtain collection A'. The specific steps are as follows:

[0037] Step 2-1: Create a new instance A' for statistical results;

[0038] Step 2-2: Define a StatisticHandler. The StatisticHandler has a merge method that takes a collection of statistical objects LA and outputs the results to A'.

[0039] Step 2-3: The merge method iterates through the object collection LA, obtains one of the A objects that needs to be statistically calculated as the current object to be counted A1, and proceeds to step 2-3.

[0040] Steps 2-4: Use reflection to obtain all the attributes of the structural description A of A1, and use one of the attributes as the current attribute S1;

[0041] Steps 2-5: Obtain the operation rule type of the annotation configuration for the current attribute S1;

[0042] Steps 2-6: Pass the value of the current attribute S1 into the calculation rule class for statistical calculation;

[0043] When the operation rule class is accumulation, the S1 property of A' is added to the S1 property of A1, and the result of the statistical operation is loaded into the S1 property of A' through reflection.

[0044] When the operation rule class is concatenation, the S1 property of A' is taken and concatenated with the S1 property of A1, and the statistical operation result is loaded into the S1 property of A' through reflection method;

[0045] When the operation rule class is AND or OR, the S1 property of A' is compared with the S1 property of A1 using a Boolean rule, and the statistical operation result is loaded into the S1 property of A' through reflection.

[0046] Step 2-7: Determine if all attributes of the current object A1 have been traversed; if so, end the attribute traversal and execute step 2-7; otherwise, obtain the next attribute of the current object A1 as the current attribute S1 and execute step 2-4.

[0047] Step 2-8: Determine whether all objects in the object collection LA have been traversed; if yes, end the object traversal and execute step 2-9; otherwise, obtain the next A object as the current object A1 and execute step 2-4.

[0048] Steps 2-9: Complete all calculations and output the result A'.

[0049] Specifically, the A' object has the same structure as the A object. It is the result of the operation of the various dimensions of the attributes of all objects in the LA collection. The operation result values ​​in steps 2-6 above are filled into the A' object. For example, if there are A1, A2, and A3 in LA, then A' is A1+A2+A3.

[0050] Furthermore, in step 1, the configuration annotation @StateStatistic is defined on the object property that needs to be statistically analyzed, and the statistical rule class of the property is defined, which includes built-in rules such as accumulation rule executor, concatenation rule executor, and AND / OR rule executor.

[0051] Furthermore, in step 1, when the object attribute statistics rule is not in the built-in rule executor, a custom rule implementation class can be defined to implement the interface method StatisticMethod.execute, and then the custom implementation class can be configured on the configuration annotation.

[0052] Furthermore, in steps 2-6, when the operation rule class is a custom rule, the custom rule for taking the S1 attribute of A' and the S1 attribute of A1 is compared, and the statistical operation result is loaded into the S1 attribute of A' through reflection.

[0053] This invention employs the above technical solution. For objects with complex and numerous attributes, it defines statistical rules by configuring corresponding annotation information on the object attributes. The computational framework automatically outputs the statistical results without requiring additional hard-coded code. For needs with customized statistical rules, extensions can be achieved through custom rule class methods. The code structure is clear and highly maintainable. This invention improves the statistical efficiency and accuracy of multi-dimensional objects by defining attribute statistical methods through annotation configuration, reducing code writing and redundancy. This invention provides an extensible custom statistical rule method to handle various personalized rule statistics.

[0054] Obviously, the described embodiments are only a part of the embodiments of this application, not all of them. Without conflict, the embodiments and features in the embodiments of this application can be combined with each other. The components of the embodiments of this application described and illustrated herein can generally be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of this application is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

Claims

1. A method for statistical analysis of multidimensional object data based on annotation configuration, characterized in that: It includes the following steps: Step 1: Configure the annotation @StateStatistic(method) on the property of the Class A object that needs to perform statistical calculations. The method is the operation rule class. The built-in rule executors of the operation rule class of the property include the accumulation rule executor, the concatenation rule executor, and the AND-OR rule executor. Step 2: Query and obtain the set of statistical objects LA that need to be statistically analyzed. Then, merge multiple Class A objects within the set LA according to their attribute dimensions to obtain set A'. The specific steps are as follows: Step 2-1: Create a new set A' for statistical results; Step 2-2: Define a statistical calculator called StatisticHandler. The statistical calculator has a merge method that takes a set of statistical objects LA and outputs the results to a set A'. Step 2-3: The merge method iterates through the collection of statistical objects LA, obtains one of the Class objects A that need to be statistically calculated as the current object to be statistically calculated A1, and proceeds to step 2-4. Steps 2-4: Use reflection to obtain all attributes of the structural description of A1, and use one of the attributes as the current attribute S1; Steps 2-5: Obtain the operation rule class of the annotation configuration for the current attribute S1; Steps 2-6: Pass the value of the current attribute S1 into the calculation rule class for statistical calculation; When the operation rule class is accumulation, the S1 property of A' is added to the S1 property of A1, and the result of the statistical operation is loaded into the S1 property of A' through reflection. When the operation rule class is concatenation, the S1 property of A' is taken and concatenated with the S1 property of A1, and the statistical operation result is loaded into the S1 property of A' through reflection method; When the operation rule class is AND or OR, the S1 property of A' is compared with the S1 property of A1 using a Boolean rule, and the statistical operation result is loaded into the S1 property of A' through reflection. Step 2-7: Determine whether all attributes of the current object A1 to be counted have been traversed; if yes, end the attribute traversal and execute step 2-8; otherwise, obtain the next attribute of the current object A1 to be counted as the current attribute S1 and execute step 2-5. Step 2-8: Determine whether all objects in the collection LA of objects to be counted have been traversed; if yes, end the object traversal and execute step 2-9; otherwise, obtain the next Class A object as the current object to be counted A1 and execute step 2-4. Steps 2-9: Complete all operations and output set A'.

2. The method for statistical analysis of multidimensional object data based on annotation configuration according to claim 1, characterized in that: In step 1, if the object attribute operation rule class is not in the built-in rule executor, a custom rule implementation class is defined to implement the interface method StatisticMethod.execute, and then the custom rule implementation class is configured on the configuration annotation.

3. The method for statistical analysis of multidimensional object data based on annotation configuration according to claim 2, characterized in that: In steps 2-6, when the operation rule class is a custom rule implementation class, the S1 attribute of A' and the S1 attribute of A1 are used to perform custom rule judgment, and the statistical operation result is loaded into the S1 attribute of A' through reflection method.

Citation Information

Patent Citations

  • Automatic log point burying method and system based on AOP and AspectJ for Android terminal

    CN106970789A

  • Text data-based data management system and method

    CN109992645A