A method and device for data analysis
By comparing the last analytical data information with the data information to be parsed, determining the difference information and fixing the problem of missing or omission of field data during data analysis, the problem of missing or omission of field data that often occurs during data analysis in the prior art is solved, and the problem of missing or omission of field data is realized. More accurate and stable data analysis results.
Patent Information
- Application Number
- CN201911229033.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-04
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2039-12-04
AI Technical Summary
In the prior art, the problem of missing or missing fields often occurs during data analysis, resulting in frequent and difficult-to-find exceptions or errors during program compilation.
By comparing the last parsed data information with the data information to be parsed, the difference information is determined, and the final analysis result is determined using the difference information, thereby fixing the problem of missing or missing field data during data analysis.
It effectively fixes the problem of missing or omissions in field data during data analysis, avoids compilation errors caused by missing fields, and improves the accuracy and stability of data analysis.
Smart Images

Figure CN112905182B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for data parsing. Background Art
[0002] In client development, the MVC architecture method (an architecture method that separates data model (model)-view (view)-controller (controller)) is usually used; specifically, it is necessary to receive data from the original data acquisition source (such as a data interface) and parse the required data into the data model (model), and then the data model can pass the data to the view (view), and the controller (controller) is responsible for controlling the view (view) for display.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] In the data parsing process of the prior art, the required data is usually obtained directly, that is, only simple assignment operations are performed. This direct way of obtaining data often results in problems such as missing or omitted fields. In the actual development process, it is difficult to avoid practical problems such as different habits of developers or incomplete logical judgment in writing. Based on this practical problem, problems such as missing or omitted fields often cause unpredictable exceptions or errors in the program when compiling, and these exceptions or errors are frequent and difficult to troubleshoot. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and device for data parsing, which can compare the last parsed data information with the data information to be parsed to determine the difference information, and then use the difference information to determine the final parsing result, thereby being able to repair the problem of missing or omitted field data that occurs during data parsing, and avoid compilation errors caused by missing fields.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for data parsing is provided, comprising:
[0007] Obtaining a parsing instruction; obtaining a previous parsing result according to the parsing instruction to determine the data information to be compared, and determining the data information to be parsed according to the parsing instruction;
[0008] Compare the data information to be parsed with the data information to be compared to determine difference information;
[0009] A parsing result of the parsing instruction is determined according to the difference information.
[0010] Optionally, the data information to be compared includes: data source information, attribute information of the object to be compared, and a corresponding relationship between the data source and the attribute of the object to be compared;
[0011] The data information to be parsed includes: the data source information, the attribute information of the object to be parsed, and the corresponding relationship between the data source and the attribute of the object to be parsed.
[0012] Optionally, comparing the data information to be parsed with the data information to be compared to determine difference information includes:
[0013] Determining the attributes of the object to be compared corresponding to the data source; and determining the attributes of the object to be analyzed corresponding to the data source;
[0014] Compare the attributes of the object to be compared with the attributes of the object to be analyzed that have the same data source to determine the difference information.
[0015] Optionally, the object attributes to be compared include: the name of the object attribute to be compared and the type of the object attribute to be compared; the object attributes to be parsed include: the name of the object attribute to be parsed and the type of the object attribute to be parsed;
[0016] Compare the attributes of the object to be compared with the attributes of the object to be parsed that have the same data source to determine the difference information, including:
[0017] For the same data source, in the object attribute names to be parsed corresponding to the data source, determine whether the object attribute name to be compared corresponding to the data source exists; if not, use the non-existent object attribute to be compared as the first difference information; if so,
[0018] For the same object attribute name, determine whether the object attribute type to be parsed of the object attribute name to be parsed is the same as the object attribute type to be compared of the object attribute name to be compared; and use the object attribute to be compared and the object attribute to be parsed that have different attribute types as the second difference information;
[0019] The first difference information and the second difference information are used together as the difference information.
[0020] Optionally, determining a parsing result of the parsing instruction according to the difference information includes:
[0021] According to the attribute information of the object to be compared in the first difference information, the attribute information of the object to be analyzed is supplemented to determine the analysis result; and
[0022] According to the attribute information of the object to be compared in the second difference information, the attribute information of the object to be analyzed in the second difference information is modified to determine the analysis result.
[0023] Optionally, after determining the parsing result of the parsing instruction according to the difference information, the method further includes:
[0024] The difference information is displayed for reminder.
[0025] According to another aspect of an embodiment of the present invention, a data parsing device is provided, characterized in that it includes:
[0026] An acquisition module is used to acquire a parsing instruction; acquire the last parsing result according to the parsing instruction to determine the data information to be compared, and determine the data information to be parsed according to the parsing instruction;
[0027] A comparison module, used to compare the data information to be parsed with the data information to be compared, and determine difference information;
[0028] A result determination module is used to determine the parsing result of the parsing instruction according to the difference information.
[0029] Optionally, the data information to be compared includes: data source information, attribute information of the object to be compared, and a corresponding relationship between the data source and the attribute of the object to be compared;
[0030] The data information to be parsed includes: the data source information, the attribute information of the object to be parsed, and the corresponding relationship between the data source and the attribute of the object to be parsed.
[0031] Optionally, the comparison module compares the data information to be parsed with the data information to be compared to determine difference information, including:
[0032] Determining the attributes of the object to be compared corresponding to the data source; and determining the attributes of the object to be analyzed corresponding to the data source;
[0033] Compare the attributes of the object to be compared with the attributes of the object to be analyzed that have the same data source to determine the difference information.
[0034] Optionally, the object attributes to be compared include: the name of the object attribute to be compared and the type of the object attribute to be compared; the object attributes to be parsed include: the name of the object attribute to be parsed and the type of the object attribute to be parsed;
[0035] The comparison module compares the attributes of the object to be compared and the attributes of the object to be analyzed with the same data source to determine the difference information, including:
[0036] For the same data source, in the object attribute names to be parsed corresponding to the data source, determine whether the object attribute name to be compared corresponding to the data source exists; if not, use the non-existent object attribute to be compared as the first difference information; if so,
[0037] For the same object attribute name, determine whether the object attribute type to be parsed of the object attribute name to be parsed is the same as the object attribute type to be compared of the object attribute name to be compared; and use the object attribute to be compared and the object attribute to be parsed that have different attribute types as the second difference information;
[0038] The first difference information and the second difference information are used together as the difference information.
[0039] Optionally, the determination result module determines the parsing result of the parsing instruction according to the difference information, including:
[0040] According to the attribute information of the object to be compared in the first difference information, the attribute information of the object to be analyzed is supplemented to determine the analysis result; and
[0041] According to the attribute information of the object to be compared in the second difference information, the attribute information of the object to be analyzed in the second difference information is modified to determine the analysis result.
[0042] Optionally, after determining the parsing result of the parsing instruction according to the difference information, the result determination module further includes:
[0043] The difference information is displayed for reminder.
[0044] According to another aspect of an embodiment of the present invention, there is provided an electronic device for data parsing, comprising:
[0045] one or more processors;
[0046] a storage device for storing one or more programs,
[0047] When the one or more programs are executed by the one or more processors, the one or more processors implement the data parsing method provided by the present invention.
[0048] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the data parsing method provided by the present invention is implemented.
[0049] An embodiment of the above invention has the following advantages or beneficial effects: because a technical means is adopted to compare the last parsed data information with the data information to be parsed to determine the difference information, and then use the difference information to determine the final parsing result, it overcomes the problem of program compilation errors caused by missing or omitted field data during data parsing in the prior art, thereby achieving the technical effect of being able to repair the problem of missing or omitted field data during data parsing and avoid compilation errors caused by field missing.
[0050] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0052] Figure 1 is a schematic diagram of the main process of a data parsing method according to an embodiment of the present invention;
[0053] Figure 2 This is a flowchart of the execution process of the data analysis method in a specific embodiment of the present invention.
[0054] Figure 3 is a schematic diagram of main modules of a data parsing device according to an embodiment of the present invention;
[0055] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0056] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0057] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0058] Figure 1 is a schematic diagram of the main process of a data parsing method according to an embodiment of the present invention, such as Figure 1 As shown, including:
[0059] Step S101, obtaining a parsing instruction; obtaining the last parsing result according to the parsing instruction to determine the data information to be compared, and determining the data information to be parsed according to the parsing instruction;
[0060] Step S102: Compare the data information to be analyzed with the data information to be compared to determine difference information;
[0061] Step S103: Determine a parsing result of the parsing instruction according to the difference information.
[0062] In the MVC architecture method (an architecture method that separates data model (model)-view (view)-controller (controller)), the process of the client requesting data and visualizing data information is generally as follows: the page controller (controller) first sends a data request to the server, and the server sends the corresponding original data back to the client after receiving the data request; the client creates a data model (model) based on the received original data and parses the original data into the data model (model); finally, the data model (model) with data parsing is passed to the view (view), and the controller (controller) is responsible for controlling the view (view) to display;
[0063] When the above page needs to be refreshed, the page controller will issue a new data request to refresh the current page; after the client requests new data, it usually reuses the established data model and uses the new data returned from the server to update the established data model, or update some attributes in the data model;
[0064] The parsing instruction may be an instruction generated after the client receives the original data returned by the server in the above process, and is used to parse the original data into a data model.
[0065] When the page needs to be refreshed (that is, it is not the first time for the page to request data from the server), the data information to be compared may be the data information that has been parsed last time;
[0066] The data information to be parsed may be data information in the original data used to update a data model during the current parsing process.
[0067] The present invention can compare the last parsed data information with the data information to be parsed in the current parsing process to determine the difference information, and then use the difference information to determine the final parsing result, thereby being able to repair the problem of missing or omitted field data that occurs during data parsing, and avoiding compilation errors caused by missing fields.
[0068] In some embodiments, the data information to be compared includes: data source information, attribute information of the object to be compared, and the corresponding relationship between the data source and the attribute of the object to be compared;
[0069] The data information to be parsed includes: the data source information, the attribute information of the object to be parsed, and the corresponding relationship between the data source and the attribute of the object to be parsed.
[0070] The data source can be a specific data interface, and the data interface can be represented by a data interface identifier; the object attribute can be the attribute of the data required in the parsing process, and can include the attribute name and attribute type, such as the attribute name is p1, p2, etc., and the attribute type can be a string type, a date event type, a numeric type, or other data types.
[0071] In a specific embodiment, a hash table can be used to store data source information, object attribute information, and the correspondence between data source and object attribute; specifically, the data interface identifier can be used as the key value in the hash table, and the string array can be used as the value in the hash table; one data interface identifier corresponds to one string array, and the string array may store the parsed object attribute information obtained from the interface; the string array may be named p1, p2, p3... and so on.
[0072] In some embodiments, comparing the data information to be parsed with the data information to be compared to determine difference information includes:
[0073] Determining the attributes of the object to be compared corresponding to the data source; and determining the attributes of the object to be analyzed corresponding to the data source;
[0074] Compare the attributes of the object to be compared with the attributes of the object to be analyzed that have the same data source to determine the difference information.
[0075] Since the attributes of the object to be compared can be the attribute information completed in the last analysis, and the attributes of the object to be compared can be the attribute information to be analyzed during this analysis, by comparing the attributes of the object to be compared with the attributes of the object to be analyzed with the same data source, it can be found whether there is data that was analyzed last time but not this time, or whether the data type of the last analysis is different from the data type of the current analysis; these differences can be considered as the difference information.
[0076] In some embodiments, the object attributes to be compared include: the name of the object attribute to be compared, and the type of the object attribute to be compared; the object attributes to be parsed include: the name of the object attribute to be parsed, and the type of the object attribute to be parsed;
[0077] Compare the attributes of the object to be compared with the attributes of the object to be parsed that have the same data source to determine the difference information, including:
[0078] For the same data source, in the object attribute names to be parsed corresponding to the data source, determine whether the object attribute name to be compared corresponding to the data source exists; if not, use the non-existent object attribute to be compared as the first difference information; if so,
[0079] For the same object attribute name, determine whether the object attribute type to be parsed of the object attribute name to be parsed is the same as the object attribute type to be compared of the object attribute name to be compared; and use the object attribute to be compared and the object attribute to be parsed that have different attribute types as the second difference information;
[0080] The first difference information and the second difference information are used together as the difference information.
[0081] For the same data source, you can compare the similarities and differences between the attribute names of the object to be parsed and the attribute names of the object to be compared. Specifically, you can search for the attribute names of the object to be compared in the attribute names of the object to be parsed. If you can't find it, you can think that for this data source, there is data that was parsed last time, but not parsed this time due to system problems or page update problems. Such data is prone to compilation errors.
[0082] For the data names that can be found, you can also compare whether the data type parsed last time is the same as the data type parsed this time. If the data name is the same but the data type has changed, such data is likely to cause compilation errors.
[0083] In some embodiments, determining the parsing result of the parsing instruction according to the difference information includes:
[0084] According to the attribute information of the object to be compared in the first difference information, the attribute information of the object to be analyzed is supplemented to determine the analysis result; and
[0085] According to the attribute information of the object to be compared in the second difference information, the attribute information of the object to be analyzed in the second difference information is modified to determine the analysis result.
[0086] After determining the difference information, the parsing result of the parsing instruction can be determined based on the difference information. Specifically, the data name that was parsed last time but not parsed this time can be found from the data that should be parsed this time, and the data can be updated, supplemented or corrected. For example, if the data is missing due to a system problem or a network problem, the correct data can be updated using runtime KVO technology (a key-value listening technology used to listen to changes in data models so that the corresponding views can be dynamically modified). Alternatively, if some data does disappear due to a page update, the data name can be supplemented and the value can be set to a default value (such as 0).
[0087] In some embodiments, after determining the parsing result of the parsing instruction according to the difference information, the method further includes:
[0088] The difference information is displayed for reminder.
[0089] After determining the parsing result of the parsing instruction, the relevant data attribute name can also be reported to the developer; for example, during the test development phase of the program application, the field name can be directly printed or a pop-up window can be displayed to prompt the developer to make corresponding code repairs.
[0090] The data parsing method of the present invention is described below with a specific embodiment:
[0091] A corresponding hash table can be maintained for the data model. The hash table is used to record the total number of interfaces used to update the data model. The key value of the hash table can be the data interface identifier, and the value can be a property of a string array named pNames. pNames can be used to save the field attribute names that have been parsed for the current interface. When parsing the data interface for the first time, while obtaining data, the hash table can also be updated according to each interface name when parsing the field data under the interface.
[0092] A method for extracting values from a data source that is different from the prior art can be used. For example, a value extraction function new_extractValue(functionId, data, pNames, self) can be created. Using this function method, pNames can be added to the hash table of the data model before each return data is obtained. In the above parameters, self corresponds to the data model, functionId corresponds to the data interface identifier, pNames corresponds to the field attribute name to be parsed, and data corresponds to the data content to be parsed; the pNames array is retrieved in the hash table using functionId as the key value, and then the corresponding field attribute name (such as p1) is added to pNames, and the value obtained from data is returned; a pseudo code of a parsing function that specifically implements the above process can be as follows:
[0093]
[0094] In this way, after the first round of parsing is completed, the attribute names in the data model are updated, and the hash table also has the corresponding parsed field attribute names of all interfaces.
[0095] When refreshing the page, the latest data needs to be obtained from the data interface again. After obtaining the new data, the content in the data model will also be updated. In this process, the field attribute names parsed twice by the same interface can be automatically compared to see if they are consistent. The hook method can be used to add handleBefore function and handleAfter function before and after the above parsing function (parse), so that the handleBefore function is automatically executed before the parsing function (parse) is executed, and the handleAfter function is automatically executed before and after the parsing function (parse) is executed.
[0096] Specifically, you can set the following functions in the handleBefore function:
[0097] Take out the pNames corresponding to the data interface functionId from the hash table of the data model, generate a temporary variable pNames_copy and save it; in this way, the previous parsing result can be saved before this parsing;
[0098] The following functions can be set in the handleAfter function:
[0099] Compare the similarities and differences between the current new pNames (i.e., the new data attribute information after this parsing) and pNames_copy arrays, and search for the attribute names of pNames_copy in the pNames array. If found, it means that the field has been updated; if not found, it means that the attribute corresponding to this field has not been updated; in this way, the difference information between the data parsed last time and the data parsed this time is obtained;
[0100] You can also add a flag field marker. If it is the first time to parse and establish the data model, the flag value can be 0. At this time, no comparison is performed, that is, the handleBefore function and handleAfter function mentioned above are not executed. After the parse method is executed for the first time, the flag value can be set to 1. In this way, during the second and subsequent parsing, by judging that the flag value is 1, it can be determined to execute the handleBefore function and handleAfter function mentioned above.
[0101] Finally, the final analysis result of this analysis can be determined according to the difference information. The specific operation can be as follows:
[0102] Runtime KVO technology can be used to update the values of attributes in the difference information, that is, extract the values of the corresponding fields from the original data and update them to the related attributes of the data model. For this processing method, a switch control can be sent by the server to control whether to perform the repair to avoid other problems caused by hasty repair. This way of repairing problems can, to a certain extent, make up for the situation where serious bugs occur online due to non-updated attributes.
[0103] When the application is still in the development or testing stage, the relevant field names can also be reported to the developer. For example, the field names can be directly printed or displayed in a pop-up window to prompt the developer to fix the code.
[0104] Figure 2 is a schematic diagram of the execution process of the data parsing method in the above specific embodiment, such as Figure 2 As shown, including:
[0105] Step S201: Process the existing parsing function, use the new value extraction function new_extractValue(functionId, data, pNames, self) and add handleBefore function and handleAfter function before and after the parsing function;
[0106] Step S202: executing the processed analytical function;
[0107] Step S203: Determine whether the data source is parsed for the first time; if so, jump to step S204; if not, jump to step S207;
[0108] Step S204: when parsing for the first time, a hash table corresponding to the data interface and the data attribute is established;
[0109] Step S205: Obtain the data information to be parsed; the data information to be parsed may include data attribute name, data attribute type, and data value;
[0110] Step S206: determining the parsing result according to the data to be parsed;
[0111] Step S207: when it is not the first time to parse, search the hash table to determine the data information to be compared, and obtain the data information to be parsed;
[0112] Step S208: Compare the data information to be analyzed with the data information to be compared;
[0113] Step S209: Determine whether there is difference information; if so, jump to step S206; if not, jump to step S210;
[0114] Step S210: determining a parsing result of the parsing instruction according to the difference information.
[0115] Figure 3 is a schematic diagram of main modules of a data parsing device according to an embodiment of the present invention, such as Figure 3 As shown, the data parsing device 300 includes:
[0116] The acquisition module 301 is used to acquire a parsing instruction; acquire the last parsing result according to the parsing instruction to determine the data information to be compared, and determine the data information to be parsed according to the parsing instruction;
[0117] A comparison module 302 is used to compare the data information to be parsed with the data information to be compared to determine difference information;
[0118] The result determination module 303 is used to determine the parsing result of the parsing instruction according to the difference information.
[0119] In the MVC architecture method (an architecture method that separates data model (model)-view (view)-controller (controller)), the process of the client requesting data and visualizing data information is generally as follows: the page controller (controller) first sends a data request to the server, and the server sends the corresponding original data back to the client after receiving the data request; the client creates a data model (model) based on the received original data and parses the original data into the data model (model); finally, the data model (model) with data parsing is passed to the view (view), and the controller (controller) is responsible for controlling the view (view) to display;
[0120] When the above page needs to be refreshed, the page controller will issue a new data request to refresh the current page; after the client requests new data, it usually reuses the established data model and uses the new data returned from the server to update the established data model, or update some attributes in the data model;
[0121] The parsing instruction may be an instruction generated after the client receives the original data returned by the server in the above process, and is used to parse the original data into a data model.
[0122] When the page needs to be refreshed (that is, it is not the first time for the page to request data from the server), the data information to be compared may be the data information that has been parsed last time;
[0123] The data information to be parsed may be data information in the original data used to update a data model during the current parsing process.
[0124] The present invention can compare the last parsed data information with the data information to be parsed in the current parsing process to determine the difference information, and then use the difference information to determine the final parsing result, thereby being able to repair the problem of missing or omitted field data that occurs during data parsing, and avoiding compilation errors caused by missing fields.
[0125] In some embodiments, the data information to be compared includes: data source information, attribute information of the object to be compared, and the corresponding relationship between the data source and the attribute of the object to be compared;
[0126] The data information to be parsed includes: the data source information, the attribute information of the object to be parsed, and the corresponding relationship between the data source and the attribute of the object to be parsed.
[0127] The data source can be a specific data interface, and the data interface can be represented by a data interface identifier; the object attribute can be the attribute of the data required in the parsing process, and can include the attribute name and attribute type, such as the attribute name is p1, p2, etc., and the attribute type can be a string type, a date event type, a numeric type, or other data types.
[0128] In a specific embodiment, a hash table can be used to store data source information, object attribute information, and the correspondence between data source and object attribute; specifically, the data interface identifier can be used as the key value in the hash table, and the string array can be used as the value in the hash table; one data interface identifier corresponds to one string array, and the string array may store the parsed object attribute information obtained from the interface; the string array may be named p1, p2, p3... and so on.
[0129] In some embodiments, the comparison module 302 compares the data information to be parsed with the data information to be compared to determine difference information, including:
[0130] Determining the attributes of the object to be compared corresponding to the data source; and determining the attributes of the object to be analyzed corresponding to the data source;
[0131] Compare the attributes of the object to be compared with the attributes of the object to be analyzed that have the same data source to determine the difference information.
[0132] Since the attributes of the object to be compared can be the attribute information completed in the last analysis, and the attributes of the object to be compared can be the attribute information to be analyzed during this analysis, by comparing the attributes of the object to be compared with the attributes of the object to be analyzed with the same data source, it can be found whether there is data that was analyzed last time but not this time, or whether the data type of the last analysis is different from the data type of the current analysis; these differences can be considered as the difference information.
[0133] In some embodiments, the object attributes to be compared include: the name of the object attribute to be compared, and the type of the object attribute to be compared; the object attributes to be parsed include: the name of the object attribute to be parsed, and the type of the object attribute to be parsed;
[0134] The comparison module 302 compares the attributes of the object to be compared and the attributes of the object to be analyzed with the same data source to determine the difference information, including:
[0135] For the same data source, in the object attribute names to be parsed corresponding to the data source, determine whether the object attribute name to be compared corresponding to the data source exists; if not, use the non-existent object attribute to be compared as the first difference information; if so,
[0136] For the same object attribute name, determine whether the object attribute type to be parsed of the object attribute name to be parsed is the same as the object attribute type to be compared of the object attribute name to be compared; and use the object attribute to be compared and the object attribute to be parsed that have different attribute types as the second difference information;
[0137] The first difference information and the second difference information are used together as the difference information.
[0138] For the same data source, you can compare the similarities and differences between the attribute names of the object to be parsed and the attribute names of the object to be compared. Specifically, you can search for the attribute names of the object to be compared in the attribute names of the object to be parsed. If you can't find it, you can think that for this data source, there is data that was parsed last time but not parsed this time. Such data is likely to cause compilation errors.
[0139] For the data names that can be found, you can also compare whether the data type parsed last time is the same as the data type parsed this time. If the data name is the same but the data type has changed, such data is likely to cause compilation errors.
[0140] In some embodiments, the determination result module 303 determines the parsing result of the parsing instruction according to the difference information, including:
[0141] According to the attribute information of the object to be compared in the first difference information, the attribute information of the object to be analyzed is supplemented to determine the analysis result; and
[0142] According to the attribute information of the object to be compared in the second difference information, the attribute information of the object to be analyzed in the second difference information is modified to determine the analysis result.
[0143] After determining the difference information, the parsing result of the parsing instruction can be determined based on the difference information. Specifically, the data name that was parsed last time but not parsed this time can be found from the data that should be parsed this time, and the data can be updated, supplemented or corrected. For example, if the data is missing due to a system problem or a network problem, the correct data can be updated using runtime KVO technology (a key-value listening technology used to listen to changes in data models so that the corresponding views can be dynamically modified). Alternatively, if some data does disappear due to a page update, the data name can be supplemented and the value can be set to a default value (such as 0).
[0144] In some embodiments, after determining the parsing result of the parsing instruction according to the difference information, the determination result module 303 further includes:
[0145] The difference information is displayed for reminder.
[0146] After determining the parsing result of the parsing instruction, the relevant data attribute name can also be reported to the developer; for example, during the test development phase of the program application, the field name can be directly printed or a pop-up window can be displayed to prompt the developer to make corresponding code repairs.
[0147] Figure 4 An exemplary system architecture 400 is shown to which the method for data parsing or the apparatus for data parsing according to the embodiments of the present invention may be applied.
[0148] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0149] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0150] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0151] Server 405 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using terminal devices 401, 402, and 403. The backend management server may analyze and process received data such as product information query requests, and feed back the processing results to the terminal device.
[0152] It should be noted that the data analysis method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the data analysis device is generally set in the server 405 .
[0153] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0154] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0155] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0156] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0157] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0158] It should be noted that 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 above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0159] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0160] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes an acquisition module, a comparison module, and a result determination module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the acquisition module may also be described as a "module for sending a picture acquisition request to the connected server."
[0161] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: step S101, obtaining a parsing instruction; obtaining the last parsing result according to the parsing instruction to determine the data information to be compared, and determining the data information to be parsed according to the parsing instruction; step S102, comparing the data information to be parsed with the data information to be compared to determine the difference information; step S103, determining the parsing result of the parsing instruction according to the difference information.
[0162] According to the technical solution of the embodiment of the present invention, since a technical means is adopted to compare the last parsed data information with the data information to be parsed to determine the difference information and then use the difference information to determine the final parsing result, the problem of program compilation errors caused by missing or omitted field data during data parsing in the prior art is overcome, thereby achieving the technical effect of being able to repair the problem of missing or omitted field data during data parsing and avoiding compilation errors caused by field missing.
[0163] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for data analysis, characterized in that: include: Get parsing instructions; Obtain the last parsing result according to the parsing instruction to determine the data information to be compared, and determine the data information to be parsed according to the parsing instruction; wherein the parsing instruction is an instruction for parsing the original data into the data model generated after the client receives the original data returned by the server during the process of page update; the data information to be parsed is the data information in the original data used to update the data model during the current parsing process; the data model after data parsing is passed to the view, and the controller is responsible for controlling the view to display; Compare the data information to be parsed with the data information to be compared to determine difference information; Determine a parsing result of the parsing instruction according to the difference information; Comparing the data information to be parsed with the data information to be compared to determine difference information, including: determining the attributes of the object to be compared corresponding to the data source; and determining the attributes of the object to be parsed corresponding to the data source; comparing the attributes of the object to be compared with the attributes of the object to be parsed of the same data source to determine difference information; Determining the parsing result of the parsing instruction according to the difference information includes: finding the data name that was parsed last time but not parsed this time from the data that should be parsed this time, and updating, supplementing or correcting the data.
2. The method according to claim 1, characterized in that The data information to be compared includes: data source information, attribute information of the object to be compared, and the corresponding relationship between the data source and the attribute of the object to be compared; The data information to be parsed includes: the data source information, the attribute information of the object to be parsed, and the corresponding relationship between the data source and the attribute of the object to be parsed.
3. The method according to claim 1, characterized in that The object attributes to be compared include: the name of the object attribute to be compared and the type of the object attribute to be compared; the object attributes to be parsed include: the name of the object attribute to be parsed and the type of the object attribute to be parsed; Compare the attributes of the object to be compared with the attributes of the object to be parsed that have the same data source to determine the difference information, including: For the same data source, in the object attribute names to be parsed corresponding to the data source, determine whether the object attribute name to be compared corresponding to the data source exists; if not, use the non-existent object attribute to be compared as the first difference information; if so, For the same object attribute name, determine whether the object attribute type to be parsed of the object attribute name to be parsed is the same as the object attribute type to be compared of the object attribute name to be compared; and use the object attribute to be compared and the object attribute to be parsed that have different attribute types as the second difference information; The first difference information and the second difference information are used together as the difference information.
4. The method according to claim 3, characterized in that Determining a parsing result of the parsing instruction according to the difference information includes: According to the attribute information of the object to be compared in the first difference information, the attribute information of the object to be analyzed is supplemented to determine the analysis result; and According to the attribute information of the object to be compared in the second difference information, the attribute information of the object to be analyzed in the second difference information is modified to determine the analysis result.
5. The method according to claim 4, characterized in that After determining the parsing result of the parsing instruction according to the difference information, the method further includes: The difference information is displayed for reminder.
6. A data analysis device, characterized in that: include: Acquisition module, used to obtain parsing instructions; Obtain the last parsing result according to the parsing instruction to determine the data information to be compared, and determine the data information to be parsed according to the parsing instruction; wherein the parsing instruction is an instruction for parsing the original data into the data model generated after the client receives the original data returned by the server during the process of page update; the data information to be parsed is the data information in the original data used to update the data model during the current parsing process; the data model after data parsing is passed to the view, and the controller is responsible for controlling the view to display; A comparison module, used to compare the data information to be parsed with the data information to be compared, and determine difference information; A result determination module, used for determining a parsing result of the parsing instruction according to the difference information; The comparison module is specifically used to: compare the data information to be parsed with the data information to be compared to determine the difference information, including: determining the attributes of the object to be compared corresponding to the data source; and determining the attributes of the object to be parsed corresponding to the data source; comparing the attributes of the object to be compared with the attributes of the object to be parsed of the same data source to determine the difference information; The determination result module is specifically used to find the data name that was parsed last time but not parsed this time from the data that should be parsed this time, and update, supplement or correct the data.
7. An electronic device for data analysis, characterized in that: include: one or more processors; a storage device 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 implement the method according to any one of claims 1 to 5.
8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Program version difference display method and device applied to front-end development
CN110427215A
Dynamic Test Coverage
US20100058295A1