CN113392311A - Field searching method, field searching device, electronic equipment and storage medium - Google Patents

Field searching method, field searching device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113392311A
CN113392311A CN202110674723.XA CN202110674723A CN113392311A CN 113392311 A CN113392311 A CN 113392311A CN 202110674723 A CN202110674723 A CN 202110674723A CN 113392311 A CN113392311 A CN 113392311A
Authority
CN
China
Prior art keywords
field
target
program
data
name
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
Application number
CN202110674723.XA
Other languages
Chinese (zh)
Inventor
何子南
王凯
邢培康
李炯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110674723.XA priority Critical patent/CN113392311A/en
Publication of CN113392311A publication Critical patent/CN113392311A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9532Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9027Trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/253Grammatical analysis; Style critique

Abstract

The present disclosure provides a field search method, a field search apparatus, an electronic device, and a storage medium, which can be applied to the field of computer technology and the field of finance. The field searching method comprises the following steps: acquiring a search range, wherein the search range comprises an object program package, an object program file and an object field; serializing the object package to obtain at least one object of the object structure; acquiring the names of all associated fields associated with the target field from at least one target structure object according to the name of the target field; and searching by taking the name of the target field and the names of all the associated fields as keywords.

Description

Field searching method, field searching device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technology and the field of finance, and more particularly, to a field search method, a field search apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
Background
In the process of program editing, if a field is modified, the influence of the modification of the field on the program is generally required to be combated.
In the process of implementing the disclosed concept, the inventor finds that modification of the hang-down field causes modification of the associated field of the hang-down field, and when the influence of the hang-down field on the program is combed, the associated field needs to be searched.
Disclosure of Invention
In view of the above, the present disclosure provides a field search method, a field search apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
One aspect of the present disclosure provides a field search method, including:
acquiring a search range, wherein the search range comprises an object program package, an object program file and an object field;
serializing the object package to obtain at least one object structure object;
acquiring the names of all associated fields associated with the target field from the at least one target structure object according to the name of the target field; and
and searching by taking the name of the target field and the names of all the related fields as keywords.
According to an embodiment of the present disclosure, each program file of the above object package includes a plurality of lines of definition statements and at least one data structure; the multi-line definition statements comprise at least one sequence definition statement and at least one line of structure definition statement, and the data structures correspond to the structure definition statements one by one; wherein each data structure comprises at least one row of data definition statements;
wherein the serializing the object package to obtain at least one object structure object comprises:
for each program file, processing the multi-line definition statements to acquire a program object;
for each data structure body, processing the at least one line of data definition statement to obtain a structure object;
determining a target program object from program objects according to the name of the target program file;
analyzing the target program object to obtain a structure linked list, wherein the structure linked list comprises the name of at least one data structure body; and
and determining the at least one target structure object from the structure objects according to the name of the at least one data structure body.
According to an embodiment of the present disclosure, the processing the definition statement to obtain a program object includes:
analyzing the multi-line definition statements by using a strategy chain to obtain a plurality of program type syntax trees; and
serializing the program class syntax trees to obtain the program object.
According to an embodiment of the present disclosure, the policy chain includes a plurality of program resolvers respectively established for the program definition statements and the method definition statements;
wherein, the parsing the multiple lines of definition statements using the policy chain to obtain multiple program syntax trees includes:
for each line of definition sentences, sequentially using the program resolvers to identify the definition sentences; and
and analyzing the definition sentences by using a program analyzer which successfully identifies the definition sentences so as to generate a program class syntax tree.
According to an embodiment of the present disclosure, the processing the at least one line of data definition statements to obtain the structure object includes:
analyzing the at least one line of data definition statements by using a strategy chain to obtain at least one structure type syntax tree; and
and serializing the at least one structure class syntax tree to obtain the structure object.
According to an embodiment of the present disclosure, the policy chain includes a plurality of data resolvers respectively established for each data type;
wherein, the analyzing the at least one line of data definition statements by using the policy chain to obtain at least one structure type syntax tree includes:
for each row of data definition statements, sequentially using the plurality of data resolvers to identify the data definition statements; and
and analyzing the data definition sentences by using a data analyzer which successfully identifies the data definition sentences so as to generate a structure type syntax tree.
According to an embodiment of the present disclosure, the association field includes an upper field and a lower field;
wherein, the obtaining the names of all the associated fields associated with the target field from at least one target structure object according to the names of the target fields includes:
acquiring field information of the target field from the at least one target structure object according to the name of the target field;
under the condition that the field information of the target field comprises the identification of the superior field, acquiring the field information of the superior field according to the identification of the superior field, and acquiring the name of each associated field at the superior level step by step according to the field information of the superior field; and
and under the condition that the field information of the target field comprises the identification of the lower field, acquiring the field information of the lower field according to the identification of the lower field, and gradually acquiring the name of each associated field at the lower level according to the field information of the lower field.
According to an embodiment of the present disclosure, the searching using the name of the target field and the names of all the associated fields as keywords includes:
generating a regular expression according to the name of the target field and the names of all the associated fields; and
and searching in the target program package based on the regular expression.
Another aspect of the present disclosure provides a field search apparatus, including:
the system comprises a first acquisition module, a second acquisition module and a search module, wherein the first acquisition module is used for acquiring a search range, and the search range comprises an object program package, an object program file and an object field;
a serialization module for serializing the object package to obtain at least one object structure object;
a second obtaining module, configured to obtain, according to the name of the target field, names of all associated fields associated with the target field from the at least one target structure object; and
and the determining module is used for searching by taking the name of the target field and the names of all the related fields as keywords.
Another aspect of the present disclosure provides an electronic device including: one or more processors; memory to store one or more instructions, wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement a method as described above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing the method as described above when executed.
Another aspect of the disclosure provides a computer program product comprising computer executable instructions for implementing the method as described above when executed.
According to the embodiment of the disclosure, because a technical means of acquiring the names of all fields associated with the target field in the serialized object and then searching the field names as keywords is adopted, the technical problems that the associated field of the lower hanging field is modified due to modification of the lower hanging field and the associated field needs to be searched when the influence of the lower hanging field on a program is combed are at least partially overcome, so that the workload of combing the lower hanging relation is reduced, the searching process is simplified, and the technical effect of the searching efficiency is improved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an exemplary system architecture to which field searches may be applied, according to an embodiment of the disclosure;
FIG. 2 schematically illustrates a flow diagram of a field search method according to an embodiment of the disclosure;
FIG. 3 schematically shows a scene diagram of an acquisition program object according to an embodiment of the disclosure;
FIG. 4 schematically illustrates a scene diagram of an association field according to an embodiment of the disclosure;
FIG. 5 schematically shows a block diagram of a field search apparatus according to an embodiment of the present disclosure; and
fig. 6 schematically shows a block diagram of an electronic device adapted to implement the above described method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
When a developer modifies a code, if a target field is modified, the corresponding upper-level field and the lower-level field are also modified in a linkage manner. For example, when the target field is modified, not only the influence of the modification of the target field on the system needs to be combed, but also the use conditions of the upper field and the lower field of the target field in the system need to be searched respectively.
When searching for a keyword in a certain target field, there are two search methods. One is that developers autonomously analyze the hanging structure of the target field, and then use regular expressions to search both the upper field and the lower field of the target field; the other is that the developer performs at least three searches separately for the target field and its upper and lower fields.
The data structure of a program written in Enterprise Generation Language (EGL) is complex, and the number of fields under the field is more. Every more stage hangs down, an additional search is needed. Finally, all results need to be summarized. While each search is a full-scale code search, the overall time usage also grows rapidly as the complexity of the data structure increases. If the search is completed through the regular expression, the EGL data structure must be combed in advance, and therefore developers are required to clarify the upper and lower level relations of fields.
In view of the above, embodiments of the present disclosure provide a field search method, a drop-down field search apparatus, an electronic device, a computer-readable storage medium, and a computer program product. The method comprises a process of obtaining a search range, a process of serializing the target program package, a process of obtaining names of all relevant fields relevant to the target field, and a process of searching by taking the name of the target field and the names of all relevant fields as keywords. According to the field searching method, the influence of the target field on other fields after the target field is changed can be obtained without paying attention to the hanging-down structure of the target field by a user.
It should be noted that the field search method and apparatus provided by the present disclosure may be used in the financial field, for example, a bank, or may be used in any field other than the financial field, for example, a hospital.
Fig. 1 schematically illustrates an exemplary system architecture 100 to which a field search method may be applied, according to an embodiment of the disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired and/or wireless communication links, and so forth.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, and/or social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the field search method provided by the embodiment of the present disclosure may be generally executed by the terminal device 101, 102, or 103, or may also be executed by another terminal device different from the terminal device 101, 102, or 103. Accordingly, the field search system provided by the embodiment of the present disclosure may also be provided in the terminal device 101, 102, or 103, or in another terminal device different from the terminal device 101, 102, or 103. Alternatively, the field search method provided by the embodiment of the present disclosure may also be executed by the server 105. Accordingly, the field search system provided by the embodiments of the present disclosure may be disposed in the server 105. The field search method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the field search system provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 schematically shows a flow chart of a field search method according to an embodiment of the present disclosure.
As shown in fig. 2, the field search method may include operations S201 to S204.
In operation S201, a search scope is acquired, wherein the search scope includes an object package, an object file, and an object field.
In operation S202, the object package is serialized to obtain at least one object structure object.
In operation S203, names of all associated fields associated with the target field are acquired from the at least one target structure object according to the names of the target fields.
In operation S204, a search is performed using the name of the target field and the names of all associated fields as keywords.
According to an embodiment of the present disclosure, the structure object may be a Record object, wherein the target structure object stores therein specific information of each field.
According to the embodiment of the disclosure, the target program package is serialized to obtain the target structure object, and the associated field of the target structure object is obtained from the target structure object according to the name of the target field in the search range. And searching by taking the name of the target field and the name of the associated field as keywords.
According to the embodiment of the disclosure, because a technical means of acquiring the names of all fields associated with the target field in the serialized object and then searching the field names as keywords is adopted, the technical problems that the associated field of the lower hanging field is modified due to modification of the lower hanging field and the associated field needs to be searched when the influence of the lower hanging field on a program is combed are at least partially overcome, so that the workload of combing the lower hanging relation is reduced, the searching process is simplified, and the technical effect of the searching efficiency is improved.
Fig. 3 schematically shows a scene diagram of acquiring a program object according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, each program file of the target package includes a plurality of lines of definition statements and at least one data structure; the multi-line definition statements comprise at least one sequence definition statement and at least one line of structure definition statement, and the data structures correspond to the structure definition statements one to one; wherein each data structure includes at least one row of data definition statements.
Wherein serializing the object package to obtain the at least one object structure object may comprise the following operations, as shown in fig. 3.
For each program file, processing a plurality of lines of definition statements to obtain a program object; for each data structure, processing at least one line of data definition statements to obtain a structure object; determining a target program object from the program objects according to the name of the target program file; analyzing the target program object to obtain a structure linked list, wherein the structure linked list comprises the name of at least one data structure body; and determining at least one target structure object from the structure objects according to the name of the at least one data structure.
According to the embodiment of the disclosure, each Program file in the target Program package is processed to obtain a Program object, and the Program object may be a Program object. Each data structure is processed to obtain a structure object, and the data structures may include Record structures and Dataitem structures. And determining the target program object from the program objects according to the name of the target program file in the search range. And analyzing the target program object to obtain a structure linked list. Each node of the structure linked list holds a data structure, which may include a Dataitem structure, for recording information of a specific field. And determining a target structure object from the structure objects according to the name of the data structure body.
Processing the definition statement to obtain the program object, as shown in fig. 3, may include the following operations, according to an embodiment of the present disclosure.
Analyzing a plurality of lines of definition statements by using a strategy chain to obtain a plurality of program class syntax trees; and serializing the plurality of program class syntax trees to obtain the program object.
According to an embodiment of the present disclosure, the syntax tree may include a Program syntax tree, a Record syntax tree, a Dataitem syntax tree, and the like, wherein the Program class syntax tree may be a Program syntax.
According to the embodiment of the disclosure, a plurality of program class syntax trees can be obtained by analyzing a plurality of lines of definition statements in a program file by using a policy chain. The programming objects can be obtained by serializing a plurality of program class syntax trees.
According to an embodiment of the present disclosure, a policy chain includes a plurality of program resolvers respectively established for a program definition statement and a method definition statement;
the parsing of the multiple rows of definition statements using the policy chain to obtain multiple program class syntax trees may include the following operations.
For each line of definition statements, sequentially using a plurality of program resolvers to identify the definition statements; and parsing the definitional statements using a program parser that successfully recognizes the definitional statements to generate a program class syntax tree.
According to an embodiment of the present disclosure, a policy chain may include Program resolvers and method resolvers, where the Program resolvers may include Program-define resolvers, Record-define resolvers, and Datatiem-define resolvers.
According to the embodiment of the disclosure, each line definition statement is sequentially analyzed by using a plurality of program parsers to generate a corresponding program class syntax tree.
According to the embodiment of the disclosure, in the case that a plurality of program resolvers cannot recognize a definition statement, the definition statement is serialized into a persistent object and is saved using a specific class.
According to an embodiment of the present disclosure, processing at least one line of data definition statements to obtain a structure object may include the following operations.
Analyzing at least one row of data definition statements by using a strategy chain to obtain at least one structure class syntax tree; and serializing at least one structure class syntax tree to obtain a structure object.
According to an embodiment of the present disclosure, the structure class syntax tree may include Record syntax and Dataitem syntax.
According to the embodiment of the disclosure, for a plurality of lines of data definition statements in a program file, a plurality of structure class syntax trees can be obtained by analyzing the multiple lines of data definition statements by using a policy chain. The structure object can be obtained by sequencing a plurality of structure class syntax trees.
According to an embodiment of the present disclosure, the policy chain includes a plurality of data resolvers respectively established for each data type.
The parsing at least one row of data definition statements using the policy chain to obtain at least one structure class syntax tree may include the following operations.
For each row of data definition statements, sequentially using a plurality of data resolvers to identify the data definition statements; and parsing the data definition statement using a data parser that successfully identifies the data definition statement to generate a structure class syntax tree.
According to an embodiment of the present disclosure, the policy chain may further include a data parser, which may include a Record-define parser and a DateItem-define parser.
According to the embodiment of the disclosure, each line of data definition statement is sequentially analyzed by using a plurality of data analyzers, and a corresponding structure type syntax tree is generated.
According to the embodiment of the disclosure, in the case that a plurality of data resolvers cannot recognize a definition statement, the data definition statement is serialized into a persistent object and is saved by using a specific class.
Fig. 4 schematically illustrates a scene diagram of an association field according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, as shown in fig. 4, the association field includes an upper field and a lower field.
The obtaining of the names of all associated fields associated with the target field from the at least one target structure object according to the name of the target field may include the following operations.
Acquiring field information of a target field from at least one target structure object according to the name of the target field; under the condition that the field information of the target field comprises the identification of the superior field, acquiring the field information of the superior field according to the identification of the superior field, and acquiring the name of each associated field at the superior level step by step according to the field information of the superior field; and under the condition that the field information of the target field comprises the identification of the lower field, acquiring the field information of the lower field according to the identification of the lower field, and acquiring the name of each associated field at the lower level step by step according to the field information of the lower field.
According to an embodiment of the present disclosure, a package written with a target package as EGL code is illustrated as shown in fig. 4.
Record _ Name in fig. 4 defines the Name of the data structure, and fields a1, a2, B1, B2, C1, C2, C3, C4, etc. are fields defined in the data structure according to an embodiment of the present disclosure. The fields C1 and C2 are lower fields of the B1 field, the fields C3 and C4 are lower fields of the B2 field, and the fields a1 are upper fields of the B1 and B2 fields.
According to the embodiment of the present disclosure, for example, in the case where the B1 field is a target field, names of respective associated fields of which the target field is at an upper level, such as the a1 field in fig. 4, are acquired. And meanwhile, acquiring the names of various associated fields of which the target fields are at the lower level, such as the C1 field and the C2 field in FIG. 4.
According to the embodiment of the present disclosure, when data of a target field is modified, an upper field and a lower field thereof are modified simultaneously. For example, when the B1 field is modified, the a1 field is also automatically modified, if the B1 field is modified by the first 5-bit code, the C1 field is also automatically modified, and if the B1 field is modified by the second 5-bit code, the C2 field is also automatically modified. Therefore, when performing a keyword search, it is necessary to search for an upper field and a lower field of a target field in synchronization.
According to an embodiment of the present disclosure, a package written in a target package for an enterprise generative language is exemplified.
According to the embodiment of the present disclosure, for example, if the target field is b1, field information with IDs of "a 1_ b 1", "a 1_ b1_ c 1", and "a 1_ b1_ c 2" may be acquired, from which it may be determined that the name of the upper field is "a 1", and the names of the lower fields are "c 1" and "c 2", so that the generated regular expression is "\\ b (a1| b1| c1| c2) \\ b". And searching in the target program package based on the regular expression.
According to another embodiment of the present disclosure, for example, if the target field is b1, the upper field of b1 is a1, the lower field of b1 is c1 and c2, and the lower field of c1 is d1 and d2, field information such as "a 1_ b 1", "a 1_ b1_ c 1", "a 1_ b1_ c 2", "a 1_ b1_ c1_ d 1", and "a 1_ b1_ c1_ d 2" may be obtained from the corresponding structure linked list, so that a regular expression of "\\\\ b (a1| b1| c1| c2| d1| d2) \\ b" may be generated, and a search is performed in the target package based on the regular expression. The upper field may have an upper field of the upper field, and the lower field may have a lower field of the upper field.
According to an embodiment of the present disclosure, searching for the name of the target field and the names of all the associated fields as keywords may include the following operations.
Generating a regular expression according to the name of the target field and the names of all the associated fields; and searching in the target package based on the regular expression.
According to an embodiment of the present disclosure, a regular expression is a sequence of characters that defines a search pattern. Regular expressions are used for "find" or "find and replace" operations on character strings by character string search algorithms. For example, in a regular expression, a is a literal character that only matches ' a ', and ' is a meta character that matches every character except for line breaks. Thus, the character that the regular expression matches may be 'a', 'ax', or 'a 0'. The meta-characters and the literal characters together may be used to identify the target package.
According to the embodiment of the disclosure, the names of the target fields, the names of the corresponding upper-level fields and the names of the lower-level fields are collected, and the regular expression is generated. And searching in the target program package according to the regular expression.
Fig. 5 schematically shows a block diagram of a field search apparatus according to an embodiment of the present disclosure.
As shown in fig. 5, the field search apparatus 500 includes a first obtaining module 510, a serialization module 520, a second obtaining module 530, and a determination module 540.
A first obtaining module 510, configured to obtain a search scope, where the search scope includes an object package, an object file, and an object field.
A serialization module 520 for serializing the object package to obtain at least one object structure object.
A second obtaining module 530, configured to obtain, from the at least one target structure object, names of all associated fields associated with the target field according to the name of the target field.
And a determining module 540, configured to search by using the name of the target field and the names of all associated fields as keywords.
According to the embodiment of the disclosure, because a technical means of acquiring the names of all fields associated with the target field in the serialized object and then searching the field names as keywords is adopted, the technical problem that the associated field of the lower hanging field is modified due to modification of the lower hanging field and the associated field needs to be searched when the influence of the lower hanging field on a program is combed is at least partially solved, so that the workload of combing the lower hanging relation is reduced, the searching process is simplified, and the technical effect of the searching efficiency is improved.
According to an embodiment of the present disclosure, the serialization module 520 may include a first processing sub-module, a second processing sub-module, a first determination sub-module, a parsing sub-module, and a second determination sub-module.
And the first processing submodule is used for processing the multiple lines of definition statements to acquire the program objects for each program file.
And the second processing sub-module is used for processing at least one line of data definition statements for each data structure body so as to obtain the structure object.
And the first determining submodule is used for determining the target program object from the program objects according to the name of the target program file.
And the analysis submodule is used for analyzing the target program object to obtain a structure linked list, wherein the structure linked list comprises the name of at least one data structure body.
And the second determining submodule is used for determining at least one target structure object from the structure objects according to the name of the at least one data structure body.
According to an embodiment of the present disclosure, the first processing submodule may include a first parsing unit and a first serialization unit.
And the first analysis unit is used for analyzing the multi-line definition statements by using the strategy chain to obtain a plurality of program class syntax trees.
The first serialization unit is used for serializing a plurality of program class syntax trees to obtain program objects.
According to an embodiment of the present disclosure, the first parsing unit may include a first identifying subunit and a first parsing subunit.
And the first identification subunit is used for identifying the definition sentences by using a plurality of program resolvers in sequence for each line of definition sentences.
And the first parsing subunit is used for parsing the definition statement by using the program parser which successfully identifies the definition statement so as to generate a program type syntax tree.
According to an embodiment of the present disclosure, the second processing submodule may include a second parsing unit and a second serialization unit.
And the second analysis unit is used for analyzing at least one line of data definition statements by using the strategy chain to obtain at least one structure type syntax tree.
And the second serialization unit is used for serializing at least one structure type syntax tree to obtain a structure object.
According to an embodiment of the present disclosure, the second parsing unit may include a second identifying subunit and a second parsing subunit.
And the second identification subunit is used for identifying the data definition statements by using the plurality of data resolvers in sequence for each row of data definition statements.
And a second parsing subunit, configured to parse the data definition statement using the data parser that successfully recognizes the data definition statement to generate a structure class syntax tree.
According to an embodiment of the present disclosure, the second obtaining module 530 may include a first obtaining sub-module, a second obtaining sub-module, and a third obtaining sub-module.
And the first acquisition submodule is used for acquiring the field information of the target field from at least one target structure object according to the name of the target field.
And the second obtaining submodule is used for obtaining the field information of the superior field according to the identifier of the superior field under the condition that the field information of the target field comprises the identifier of the superior field, and obtaining the name of each related field at the superior level step by step according to the field information of the superior field.
And the third obtaining submodule is used for obtaining the field information of the lower field according to the identification of the lower field under the condition that the field information of the target field comprises the identification of the lower field, and obtaining the name of each associated field at the lower level step by step according to the field information of the lower field.
According to an embodiment of the present disclosure, the determining module 540 may include a generating sub-module and a searching sub-module.
And the generation submodule is used for generating the regular expression according to the name of the target field and the names of all the associated fields.
And the searching submodule is used for searching in the target program package based on the regular expression.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any number of the first obtaining module 510, the serializing module 520, the second obtaining module 530, and the determining module 540 may be combined and implemented in one module/sub-module/unit/sub-unit, or any one of the modules/sub-modules/units/sub-units may be split into a plurality of modules/sub-modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/sub-modules/units/sub-units may be combined with at least part of the functionality of other modules/sub-modules/units/sub-units and implemented in one module/sub-module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the first obtaining module 510, the serializing module 520, the second obtaining module 530, and the determining module 540 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or may be implemented in any one of three implementations of software, hardware, and firmware, or in a suitable combination of any of them. Alternatively, at least one of the first obtaining module 510, the serializing module 520, the second obtaining module 530 and the determining module 540 may be at least partially implemented as a computer program module, which when executed, may perform a corresponding function.
It should be noted that, the field search system part in the embodiment of the present disclosure corresponds to the field search method part in the embodiment of the present disclosure, and the description of the field search system part specifically refers to the field search method part, which is not described herein again.
Fig. 6 schematically shows a block diagram of an electronic device adapted to implement the above described method according to an embodiment of the present disclosure. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, a computer electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. Processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 601 may also include onboard memory for caching purposes. Processor 601 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or RAM 603. It is to be noted that the programs may also be stored in one or more memories other than the ROM 602 and RAM 603. The processor 601 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 600 may also include input/output (I/O) interface 605, input/output (I/O) interface 605 also connected to bus 604, according to an embodiment of the disclosure. The electronic device 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program, when executed by the processor 601, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 602 and/or RAM 603 described above and/or one or more memories other than the ROM 602 and RAM 603.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method provided by the embodiments of the present disclosure, when the computer program product is run on an electronic device, the program code being adapted to cause the electronic device to carry out the field search method provided by the embodiments of the present disclosure.
The computer program, when executed by the processor 601, performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, downloaded and installed through the communication section 609, and/or installed from the removable medium 611. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, Python, C, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (12)

1. A field search method, comprising:
acquiring a search range, wherein the search range comprises an object program package, an object program file and an object field;
serializing the object package to obtain at least one object of the object structure;
acquiring the names of all associated fields associated with the target field from the at least one target structure object according to the name of the target field; and
and searching by taking the name of the target field and the names of all the associated fields as keywords.
2. The method of claim 1, wherein each program file of the target package comprises a plurality of lines of definition statements and at least one data structure; the multi-line definition statements comprise at least one sequence definition statement and at least one line of structure definition statements, and the data structures correspond to the structure definition statements one to one; wherein each data structure comprises at least one row of data definition statements;
wherein the serializing the object package to obtain at least one object structure object comprises:
for each program file, processing the multiple lines of definition statements to obtain a program object;
for each data structure, processing the at least one line of data definition statements to obtain a structure object;
determining a target program object from program objects according to the name of the target program file;
analyzing the target program object to obtain a structure linked list, wherein the structure linked list comprises the name of at least one data structure body; and
and determining the at least one target structure object from the structure objects according to the name of the at least one data structure body.
3. The method of claim 2, wherein said processing said definitional statement to obtain a program object comprises:
analyzing the multi-line definition statements by using a strategy chain to obtain a plurality of program class syntax trees; and
and serializing the plurality of program class syntax trees to obtain the program object.
4. The method of claim 3, wherein the policy chain includes a plurality of program parsers built separately for program definition statements and method definition statements;
wherein the parsing the multiple rows of definition statements using a policy chain to obtain multiple program class syntax trees comprises:
for each line of definition statements, sequentially using the plurality of program resolvers to identify the definition statements; and
the definition statements are parsed using a program parser that successfully identifies the definition statements to generate a program class syntax tree.
5. The method of claim 2, wherein said processing said at least one line of data definition statements to obtain a fabric object comprises:
analyzing the at least one line of data definition statements by using a strategy chain to obtain at least one structure class syntax tree; and
and serializing the at least one structure class syntax tree to obtain the structure object.
6. The method of claim 5, wherein the policy chain includes a plurality of data resolvers established separately for each data type;
wherein the parsing the at least one line of data definition statements using the policy chain to obtain at least one structure class syntax tree comprises:
for each row of data definition statements, sequentially using the plurality of data resolvers to identify the data definition statements; and
parsing the data definition statement using a data parser that successfully identifies the data definition statement to generate a structure class syntax tree.
7. The method of claim 1, wherein the association field comprises an upper field and a lower field;
wherein, the obtaining the names of all associated fields associated with the target field from at least one target structure object according to the name of the target field comprises:
according to the name of the target field, acquiring field information of the target field from the at least one target structure object;
under the condition that the field information of the target field comprises the identification of the superior field, acquiring the field information of the superior field according to the identification of the superior field, and acquiring the name of each associated field at the superior level step by step according to the field information of the superior field; and
and under the condition that the field information of the target field comprises the identification of the subordinate field, acquiring the field information of the subordinate field according to the identification of the subordinate field, and acquiring the name of each associated field at the subordinate stage step by step according to the field information of the subordinate field.
8. The method of claim 1, wherein the searching for the name of the target field and the names of all associated fields as keywords comprises:
generating a regular expression according to the name of the target field and the names of all the associated fields; and
and searching in the target program package based on the regular expression.
9. A field search apparatus, comprising:
the system comprises a first acquisition module, a second acquisition module and a search module, wherein the first acquisition module is used for acquiring a search range, and the search range comprises an object program package, an object program file and an object field;
a serialization module for serializing the object package to obtain at least one object structure object;
a second obtaining module, configured to obtain, according to the name of the target field, names of all associated fields associated with the target field from the at least one target structure object; and
and the determining module is used for searching by taking the name of the target field and the names of all the associated fields as keywords.
10. An electronic device, comprising:
one or more processors;
a memory to store one or more instructions that,
wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8.
11. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 8.
12. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 8 when executed.
CN202110674723.XA 2021-06-17 2021-06-17 Field searching method, field searching device, electronic equipment and storage medium Pending CN113392311A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110674723.XA CN113392311A (en) 2021-06-17 2021-06-17 Field searching method, field searching device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110674723.XA CN113392311A (en) 2021-06-17 2021-06-17 Field searching method, field searching device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113392311A true CN113392311A (en) 2021-09-14

Family

ID=77621865

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110674723.XA Pending CN113392311A (en) 2021-06-17 2021-06-17 Field searching method, field searching device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113392311A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114579573A (en) * 2022-03-03 2022-06-03 北京百度网讯科技有限公司 Information retrieval method, information retrieval device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114579573A (en) * 2022-03-03 2022-06-03 北京百度网讯科技有限公司 Information retrieval method, information retrieval device, electronic equipment and storage medium
CN114579573B (en) * 2022-03-03 2022-12-09 北京百度网讯科技有限公司 Information retrieval method, information retrieval device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US9817910B2 (en) Restful service description language
CN113032244A (en) Interface testing method, device, computer system and computer readable storage medium
US9953093B1 (en) Mapping system for a browser history stack and a browser page state
CN113138757B (en) Front-end code automatic generation method, device, server, system and medium
CN113392311A (en) Field searching method, field searching device, electronic equipment and storage medium
CN110795331A (en) Software testing method and device
CN111158777A (en) Component calling method and device and computer readable storage medium
CN113419740A (en) Program data stream analysis method and device, electronic device and readable storage medium
CN113918864A (en) Website page testing method, testing system, testing device, electronic equipment and medium
CN113032256A (en) Automatic test method, device, computer system and readable storage medium
CN114169318A (en) Process identification method, apparatus, device, medium, and program
CN116401319B (en) Data synchronization method and device, electronic equipment and computer readable storage medium
CN113032586B (en) Method and device for extracting time information in text and electronic equipment
CN113392199A (en) Keyword search method, keyword search device, electronic device, and storage medium
CN116382703B (en) Software package generation method, code development method and device, electronic equipment and medium
CN112860259B (en) Interface processing method, device, electronic equipment and storage medium
CN113110947B (en) Program call chain generation method, system, electronic device and medium
CN113378517A (en) Data dictionary generation method and device, electronic equipment and storage medium
CN113515326B (en) Data conversion method, device, electronic equipment and storage medium
CN113392623A (en) Service data object generation method, generation device, electronic device and storage medium
CN113392112A (en) Data analysis method, data analysis device, electronic device, and storage medium
CN116775618A (en) Code processing method, service processing method, device, electronic equipment and medium
CN116661857A (en) Data extraction method, device, equipment and storage medium
CN116243961A (en) Version file processing method and device, electronic equipment and storage medium
CN116755708A (en) Data processing method, device, equipment and storage medium

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