CN115756395A - Multi-dimensional object data statistical method based on annotation configuration - Google Patents
Multi-dimensional object data statistical method based on annotation configuration Download PDFInfo
- Publication number
- CN115756395A CN115756395A CN202211491984.9A CN202211491984A CN115756395A CN 115756395 A CN115756395 A CN 115756395A CN 202211491984 A CN202211491984 A CN 202211491984A CN 115756395 A CN115756395 A CN 115756395A
- Authority
- CN
- China
- Prior art keywords
- attribute
- statistical
- rule
- class
- current
- 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.)
- Pending
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a multidimensional object data statistical method based on annotation configuration, aiming at the object with complex and various attributes, corresponding annotation information is configured on the object attributes, the statistical rule is defined, an operation frame can automatically output the statistical result without additionally compiling hard codes, the expansion of the rule class can be realized by self-defining the requirement of the existing individual statistical rule, and the code structure is clear and has high maintainability. The invention improves the statistical efficiency and accuracy of the multi-dimensional object, defines the attribute statistical method by adopting the annotation configuration mode and reduces code compiling and redundancy.
Description
Technical Field
The invention relates to the field of network technology and security, in particular to a multidimensional object data statistical method based on annotation configuration.
Background
In a daily application system, data statistics of each dimension of the system is the most common and most concerned requirement of a user, and the data statistics has the characteristics of multiple object attributes, various types and different statistical rules.
At present, the common practice of research and development is to customize and write specific codes for statistical calculation by traversing all dimension data according to the rule of each data statistic, so that the development codes cannot be reused, the development process is complicated, the repeated codes are more, the situations of modern code error writing, missing writing and the like are easy to occur, and the dimension difficulty and the cost in the later period are higher.
Disclosure of Invention
The invention aims to provide a multidimensional object data statistical method based on annotation configuration, which accurately matches object statistical rules in a configuration mode, and abstracts and merges repeated statistical rules, so that a statistical algorithm structure is clearer, statistical values are more accurate, later maintenance is easier, and decoupling performance of codes is better.
The technical scheme adopted by the invention is as follows:
a multi-dimensional object data statistical method based on annotation configuration comprises the following steps:
step 1, configuring annotation @ StateStateStatistic (method = operation rule class) on an object A attribute needing statistical calculation;
step 2, inquiring and acquiring a set object LA needing to be counted, and counting, combining and outputting a plurality of objects A in the set object LA according to attribute dimensions to obtain a set A'; the method comprises the following specific steps:
step 1, configuring annotation @ StateStateStatistic (method = operation rule Class) on a Class A attribute needing statistical calculation;
step 2, inquiring and acquiring a set object LA needing to be counted, counting a plurality of Class A objects in the set object LA according to attribute dimensions, merging and outputting to obtain a set A'; the method comprises the following specific steps:
step 2-1, newly building an instance A' for counting results;
step 2-2, defining a statistical calculator (staticiHandler) which has a merge method (merge) receiving the statistical object set LA and outputting the result to A'.
Step 2-3, a merging method (merge) traverses the object set LA, obtains one of the objects A needing to be counted and calculated as the current object A1 to be counted, and enters the step 2-3;
2-4, reflecting to obtain all attributes of the structure description A of the A1, and taking one of the attributes as a current attribute S1;
step 2-5, obtaining the operation rule type of the annotation configuration of the current attribute S1;
step 2-6, transmitting the value of the current attribute S1 into an operation rule class for statistical operation;
when the operation rule class is accumulation, the S1 attribute of A 'and the S1 attribute of A1 are taken to carry out value addition, and the statistical operation result is loaded into the S1 attribute of A' by a reflection method;
when the operation rule class is splicing, splicing the character string by taking the S1 attribute of A 'and the S1 attribute of A1, and loading the statistical operation result into the S1 attribute of A' by a reflection method;
when the operation rule class is AND or, the S1 attribute of A 'and the S1 attribute of A1 are taken to carry out Boolean rule judgment, and the statistical operation result is loaded into the S1 attribute of A' by a reflection method;
step 2-7, judging that all attributes of the current object A1 are traversed; if yes, ending the attribute traversal and executing the step 2-7; otherwise, acquiring the next attribute of the current object A1 as the current attribute S1 and executing the step 2-4;
step 2-8, judging whether the objects in the object set LA are traversed or not; if yes, ending the object traversal and executing the steps 2-9; otherwise, acquiring the next A object as the current object A1 and executing the step 2-4;
and 2-9, finishing all operation operations and outputting a result A'.
Specifically, the a ' object has the same structure as the a object, and is a dimension attribute operation result object of all objects in the LA set, and the operation result values in the foregoing steps 2-6 are filled in the a ' object, for example, there are A1, A2, and A3 in LA, and a ' is A1+ A2+ A3.
Further, in step 1, a configuration annotation @ StateStateStatitistic is defined on the object attribute to be counted, and a statistical rule class of the attribute is defined, wherein the built-in rule comprises an accumulation rule actuator, a splicing rule actuator and an OR rule actuator.
Further, in step 1, when the object attribute statistical rule is not in the built-in rule executor, the rule implementation class may be customized to implement the interface method stateicmethod.
Further, in step 2-6, when the operation rule class is a custom rule, the S1 attribute of a 'and the S1 attribute of A1 are taken to judge the custom rule, and the statistical operation result is loaded into the S1 attribute of a' by a reflection method.
By adopting the technical scheme, aiming at the object with complex and various attributes, the statistical rules are defined by configuring the corresponding annotation information on the object attributes, the statistical result can be automatically output by the operation framework without additionally compiling hard codes, the expansion can be realized by self-defining the rule class methods for the requirement of the existence of the individual statistical rules, and the code structure is clear and has high maintainability. The invention improves the statistical efficiency and accuracy of the multi-dimensional object, defines the attribute statistical method by adopting the annotation configuration mode and reduces code compiling and redundancy. The invention provides an extensible custom statistical rule method which can be used for counting various personalized rules.
Drawings
The invention is described in further detail below with reference to the accompanying drawings and the detailed description;
FIG. 1 is a schematic diagram illustrating a multi-dimensional object data statistics method based on annotation configuration according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
Generally, a set object needs to be subjected to statistical operation, and it is first analyzed which way each attribute of the object needs to be combined, some need to be accumulated, some need to be spliced, and some need to be and or judged. The invention defines annotation configuration on the attribute of an entity object, defines statistical rules of the attribute, and carries out rule operation statistics on a set object through a statistical calculator, and accumulated operation annotations, character splicing operation annotations, and or combined operation annotations and the like are abstracted through analysis at present, and expandable custom operation annotations are supported.
As shown in FIG. 1, the invention discloses a multidimensional object data statistical method based on annotation configuration, which comprises the following steps:
step 1, configuring annotation @ StateStateStatistic (method = operation rule class) on an object A attribute needing statistical calculation;
step 2, inquiring and acquiring a set object LA needing to be counted, and counting, combining and outputting a plurality of objects A in the set object LA according to attribute dimensions to obtain a set A'; the method comprises the following specific steps:
step 1, configuring annotations @ StateStateStatitestic (method = operation rule Class) on a Class A attribute needing statistical calculation;
step 2, inquiring and acquiring a set object LA needing to be counted, counting a plurality of Class A objects in the set object LA according to attribute dimensions, merging and outputting to obtain a set A'; the method comprises the following specific steps:
step 2-1, building a new example A' for counting the result;
step 2-2, defining a statistical calculator (staticiHandler) which has a merge method (merge) receiving the statistical object set LA and outputting the result to A'.
Step 2-3, a merging method (merge) traverses the object set LA, obtains one object A needing statistical calculation as a current object A1 to be counted, and enters step 2-3;
2-4, reflecting to obtain all attributes of the structure description A of the A1, and taking one of the attributes as a current attribute S1;
step 2-5, obtaining the operation rule type of the annotation configuration of the current attribute S1;
step 2-6, transmitting the value of the current attribute S1 into an operation rule class for statistical operation;
when the operation rule class is accumulation, the S1 attribute of A 'and the S1 attribute of A1 are taken to carry out value addition, and the statistical operation result is loaded into the S1 attribute of A' by a reflection method;
when the operation rule class is splicing, splicing the character string by taking the S1 attribute of A 'and the S1 attribute of A1, and loading the statistical operation result into the S1 attribute of A' by a reflection method;
when the operation rule class is AND or, the S1 attribute of A 'and the S1 attribute of A1 are taken to carry out Boolean rule judgment, and the statistical operation result is loaded into the S1 attribute of A' by a reflection method;
step 2-7, judging that all attributes of the current object A1 are traversed; if yes, ending the attribute traversal and executing the step 2-7; otherwise, acquiring the next attribute of the current object A1 as the current attribute S1 and executing the step 2-4;
step 2-8, judging whether the objects in the object set LA are traversed or not; if yes, ending the object traversal and executing the steps 2-9; otherwise, acquiring the next A object as the current object A1 and executing the step 2-4;
and 2-9, finishing all operation operations and outputting a result A'.
Specifically, the a ' object has the same structure as the a object, and is a dimension attribute operation result object of all objects in the LA set, and the operation result values in the foregoing steps 2-6 are filled in the a ' object, for example, there are A1, A2, and A3 in LA, and a ' is A1+ A2+ A3.
Further, in step 1, a configuration annotation @ StateStateStatitistic is defined on the object attribute to be counted, and a statistical rule class of the attribute is defined, wherein the built-in rule comprises an accumulation rule actuator, a splicing rule actuator and an OR rule actuator.
Further, in step 1, when the object attribute statistical rule is not in the built-in rule executor, the rule implementation class may be customized to implement the interface method stateicmethod.
Further, in step 2-6, when the operation rule class is a custom rule, the S1 attribute of a 'and the S1 attribute of A1 are taken to judge the custom rule, and the statistical operation result is loaded into the S1 attribute of a' by a reflection method.
By adopting the technical scheme, aiming at the object with complex and various attributes, the statistical rule is defined by configuring corresponding annotation information on the object attributes, the statistical result is automatically output by the operation framework without additionally compiling hard codes, the requirement of the existing individual statistical rule can be expanded by a method class of self-defining realization rule classes, and the code structure is clear and has high maintainability. The invention improves the statistical efficiency and accuracy of the multi-dimensional object, and adopts the annotation configuration mode to define the attribute statistical method, thereby reducing code writing and redundancy. The invention provides an extensible custom statistical rule method which can be used for counting various personalized rules.
It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. The embodiments and features of the embodiments in the present application may be combined with each other without conflict. The components of the embodiments of the present application, as generally described and illustrated in the figures herein, could be arranged and designed in a wide variety of different configurations. Thus, the detailed description of the embodiments of the present application is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Claims (4)
1. A multi-dimensional object data statistical method based on annotation configuration is characterized in that: which comprises the following steps:
step 1, configuring annotation @ StateStateStatistic (method = operation rule Class) on a Class A attribute needing statistical calculation;
step 2, inquiring and acquiring a set object LA needing to be counted, counting a plurality of Class A objects in the set object LA according to attribute dimensions, merging and outputting to obtain a set A'; the method comprises the following specific steps:
step 2-1, newly building an instance A' for counting results;
step 2-2, defining a statistical calculator (staticiHandler), wherein the statistical calculator has a merging method (merge), and the merging method receives a statistical object set LA and outputs a result to A';
step 2-3, a merging method (merge) traverses the object set LA, obtains one object A needing statistical calculation as a current object A1 to be counted, and enters step 2-3;
2-4, reflecting to obtain all attributes of the structure description A of the A1, and taking one of the attributes as a current attribute S1;
step 2-5, obtaining the operation rule type of the annotation configuration of the current attribute S1;
step 2-6, transmitting the value of the current attribute S1 into an operation rule class for statistical operation;
when the operation rule class is accumulation, the S1 attribute of A 'and the S1 attribute of A1 are taken to carry out value addition, and the statistical operation result is loaded into the S1 attribute of A' by a reflection method;
when the operation rule class is splicing, splicing the character string by taking the S1 attribute of A 'and the S1 attribute of A1, and loading the statistical operation result into the S1 attribute of A' by a reflection method;
when the operation rule class is AND or, the S1 attribute of A 'and the S1 attribute of A1 are taken to carry out Boolean rule judgment, and the statistical operation result is loaded into the S1 attribute of A' by a reflection method;
step 2-7, judging that all attributes of the current object A1 are traversed; if yes, ending the attribute traversal and executing the step 2-7; otherwise, acquiring the next attribute of the current object A1 as the current attribute S1 and executing the step 2-4;
step 2-8, judging whether the object in the object set LA is traversed; if yes, ending the object traversal and executing the steps 2-9; otherwise, acquiring the next A object as the current object A1 and executing the step 2-4;
and 2-9, finishing all operation operations and outputting a result A'.
2. The method according to claim 1, wherein the method comprises: in step 1, the built-in rules of the statistical rule class of the configuration annotation @ StateStateStatistic definition attribute are defined on the object attribute to be counted, and comprise an accumulation rule executor, a splicing rule executor and an OR rule executor.
3. The method according to claim 1, wherein the method comprises: in step 1, when the object attribute statistical rule is not in the built-in rule executor, the rule implementation class can be customized to implement the interface method stateicmethod.
4. The method of claim 3, wherein the annotation based on the multidimensional object data statistical method comprises: and 2-6, when the operation rule class is a custom rule, judging the S1 attribute of A 'and the S1 attribute custom rule of A1, and loading the statistical operation result into the S1 attribute of A' by a reflection method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211491984.9A CN115756395A (en) | 2022-11-25 | 2022-11-25 | Multi-dimensional object data statistical method based on annotation configuration |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211491984.9A CN115756395A (en) | 2022-11-25 | 2022-11-25 | Multi-dimensional object data statistical method based on annotation configuration |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115756395A true CN115756395A (en) | 2023-03-07 |
Family
ID=85338131
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211491984.9A Pending CN115756395A (en) | 2022-11-25 | 2022-11-25 | Multi-dimensional object data statistical method based on annotation configuration |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115756395A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116795426A (en) * | 2023-08-21 | 2023-09-22 | 智慧眼科技股份有限公司 | Data processing method and system |
-
2022
- 2022-11-25 CN CN202211491984.9A patent/CN115756395A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116795426A (en) * | 2023-08-21 | 2023-09-22 | 智慧眼科技股份有限公司 | Data processing method and system |
CN116795426B (en) * | 2023-08-21 | 2023-11-10 | 智慧眼科技股份有限公司 | Data processing method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101499599B1 (en) | Data logging in graph-based computations | |
US8166000B2 (en) | Using a data mining algorithm to generate format rules used to validate data sets | |
US20140006010A1 (en) | Parsing rules for data | |
CN103176974A (en) | Method and device used for optimizing access path in data base | |
CN112181430B (en) | Code change statistical method, device, electronic equipment and storage medium | |
CN115756395A (en) | Multi-dimensional object data statistical method based on annotation configuration | |
CN115827436A (en) | Data processing method, device, equipment and storage medium | |
CN116911240B (en) | Command configuration method, device, equipment and medium of electronic automation design software | |
CN103077080B (en) | Based on parallel program performance collecting method and the device of high performance platform | |
CN114398394A (en) | Data blood margin analysis method, device, equipment and storage medium | |
US11157267B1 (en) | Evaluation of dynamic relationships between application components | |
CN113778849A (en) | Method, apparatus, device and storage medium for testing code | |
CN115345600B (en) | RPA flow generation method and device | |
US20180300126A1 (en) | Program analysis device, program analysis method, and recording medium storing analysis program | |
CN115048913A (en) | Command processing method and device and electronic equipment | |
CN114676047A (en) | Unmanned aerial vehicle software security property analysis and verification method based on fault mode library | |
CN109710538B (en) | Static detection method for state-related defects in large-scale system | |
CN114356430A (en) | DAG (demand oriented architecture) dependency configuration tool based on airflow scheduling system | |
WO2021133448A1 (en) | Edge table representation of processes | |
CN111427571A (en) | Data verification method and device | |
CN113076237B (en) | Memory performance testing method and system and computer readable storage medium | |
US20170132278A1 (en) | Systems and Methods for Inferring Landmark Delimiters for Log Analysis | |
CN112051987B (en) | Service data processing method, device and equipment, program generating method and device | |
CN111324434B (en) | Configuration method, device and execution system of computing task | |
CN116909542B (en) | System, method and storage medium for dividing automobile software modules |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |