Patent Description:
Software usually consists of the following components:.

The above components of software comprise a large amount of information, which needs to be organized effectively to perform functions such as automatic code generation, system reconstruction, code quality inspection, etc. based on the effectively organized information.

<CIT> relates to relates to the extraction and augmentation of knowledge graphs from program source code.

<CIT> relates to a method for determining the similarity between a source program and a test program by generating and comparing abstract syntax trees (ASTs). The process involves creating ASTs for both the source and test programs, converting them into hash vectors, and reducing the dimensionality of these vectors.

Embodiments of the present invention provide a software information organization method and device and a computer-readable medium to generate a knowledge graph for software, so that the rich information included in the software can be effectively organized, and the similarity between software can be determined based on the knowledge graph.

In a first aspect, a software information organization method is provided. The method comprises: loading first software, which comprises a code, data, resources and documents; obtaining first information from the code of the first software, and generating a first knowledge graph based on the first information; obtaining second information from the data, resources and documents of the first software, and generating a second knowledge graph based on the second information; combining the first knowledge graph and the second knowledge graph into a third knowledge graph.

In a second aspect, a software information organization device is provided, which may comprise:.

In a third aspect, a software information organization device is provided, comprising: at least one memory, configured to store computer-readable code, and at least one processor, configured to call the computer-readable code to perform the steps provided in the first aspect.

In a fourth aspect, a computer-readable medium is provided, which stores a computer-readable instruction that, when executed by a processor, causes the processor to perform the steps provided in the first aspect.

To generate a knowledge graph for software, considering the fact that both the code and non-code data comprise information related to the software and that the characteristics of the code and non-code data are different, different methods are selected for information extraction to generate separate knowledge graphs, thus accurately extracting information and generating knowledge graphs to the greatest extent. In addition, combining the information of individual software into one knowledge graph can merge the same or similar structures and contents of different software, and reduce redundant information of the entire knowledge graph, thus improving the efficiency of subsequent searching for similar software.

For any of the above aspects, optionally, the first information comprises at least one of the following information: static information of the code, abstract syntax tree (AST) data, control flow information and data stream information.

If the first information comprises the static information of the code, to obtain first information from the code of the first software and generate a first knowledge graph based on the first information, a static analysis method may be used to obtain at least two static information of the code from the code of the first software and obtain the relationship between the at least two static information of the code, and the first knowledge graph is generated based on the at least two static information of the code and the relationship between the at least two static information of the code.

If the first information comprises the AST data, to obtain first information from the code of the first software and generate a first knowledge graph based on the first information, an AST tool may be used to generate the AST data based on the code of the first software, and the first knowledge graph is generated based on the relationship between AST nodes in the AST data, the relationship between the class node and the method node among the AST nodes, and the values of the AST nodes.

If the first information comprises the control flow information, to obtain first information from the code of the first software and generate a first knowledge graph based on the first information, an AST tool may be used to generate the AST data based on the code of the first software, and the control flow information is determined based on the call relationship between AST nodes in the AST data and the method marked as the initial method; the first knowledge graph is generated based on the control flow information.

If the first information comprises the data stream information, to obtain first information from the code of the first software and generate a first knowledge graph based on the first information, data calculation points may be added to each execution scenario in the code of the first software; the data stream information is obtained according to the data calculation points; the first knowledge graph is generated based on the data stream information.

To extract the first information, different methods may be used to extract various types of information from the code, for example, data stream information, control flow information, AST data and static information of the code, and a knowledge graph is generated based on the provided information. The rich information can be effectively organized and presented in the knowledge graph, which has the advantages of good visuality and ease of search.

For any of the above aspects, optionally, to obtain second information from the data, resources and documents of the first software, for the semi-structured content in the three of data, resources and documents of the first software, the second information may be obtained by use of predefined rules; and for the unstructured content in the three of data, resources and documents of the first software, the second information may be obtained by use of natural language processing.

Specifically, different methods are used to extract information depending on the different characteristics of the semi-structured content and the unstructured content.

For any of the above aspects, optionally, the following method may be used to obtain similar software:
Loading second software, which comprises a code, data, resources and documents; obtaining third information from the code of the second software, and generating a fourth knowledge graph based on the third information; obtaining fourth information from the data, resources and documents of the second software, and generating a fifth knowledge graph based on the fourth information; comparing the fourth knowledge graph and the fifth knowledge graph with the third knowledge graph, to determine software similar to the second software.

Or, third software may be loaded, which comprises a code, data, resources and documents; third information is obtained from the code of the third software and/or fourth information is obtained from the data, resources and documents of the third software; first key information for software similarity comparison is determined from the obtained information; the third knowledge graph is searched based on the first key information, to determine software meeting the key information.

Or, second key information for describing software characteristics is determined; the third knowledge graph is searched based on the second key information, to determine software meeting the second key information.

For determining the similarity between software, a plurality of optional implementation methods are provided. Specified software may be compared with a knowledge graph, to determine software similar to the specified software among the software marked by the knowledge graph. It is also possible to specify key information and to search a knowledge graph for software meeting the key information. The implementation is more flexible, and the search result better meets user needs.

The subject matter described herein will now be discussed by referring to some exemplary implementations. It should be understood that the discussion of these implementations is only intended to enable those skilled in the art to better understand and realize the subject matter described herein, and is not intended to limit the scope, applicability, or examples set forth in the claims. The functions and arrangement of the discussed elements may be changed without departing from the scope of embodiments of the present invention. Various processes or components may be deleted, replaced or added in each example as needed. For example, the method described herein may be executed in a sequence different from the described sequence, and various steps may be added, omitted, or combined. In addition, the features described in relation to some examples may also be combined in other examples.

As used herein, the term "comprising" and its variations is an open term that means "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" or "an embodiment" means "at least one embodiment". The term "another embodiment" means "at least one other embodiment". The term "first", "second", etc. may refer to different or the same objects. Other definitions, either explicit or implicit, may be included below. Unless clearly indicated in the context, the definition of a term is consistent throughout the description.

Some embodiments of the present invention are described in detail below by referring to the drawings.

<FIG> is a schematic structural diagram of the software information organization device <NUM>.

The software information organization device <NUM> provided by the embodiments of the present invention may be implemented as a network of computer processors, to execute the software information organization method <NUM> in the embodiments of the present invention. The software information organization device <NUM> may also be a single computer as shown in <FIG>, which comprises at least one memory <NUM> comprising a computer-readable medium, for example, a random access memory (RAM). The device <NUM> further comprises at least one processor <NUM> coupled to the at least one memory <NUM>. A computer-executable instruction is stored in the at least one memory <NUM>, and, when executed by the at least one processor <NUM>, can cause at least one processor <NUM> to perform the steps described herein. The at least one processor <NUM> may be a microprocessor, an application specific integrated circuit (ASIC), a digital signal processor (DSP), a central processing unit (CPU), a graphics processing unit (GPU), a state machine, etc. Examples of the computer-readable medium include, but are not limited to, a floppy disk, CD-ROM, magnetic disk, memory chip, ROM, RAM, ASIC, configured processor, all-optical medium, all magnetic tape or another magnetic medium, or any other medium from which a computer processor can read instructions. In addition, various other forms of computer-readable media can transmit or carry instructions to a computer, including routers, private or public networks, or other wired and wireless transmission devices or channels. The instructions may include a code in any computer programming language, including C, C++, C language, Visual Basic, java, and JavaScript.

When executed by the at least one processor <NUM>, the at least one memory <NUM> shown in <FIG> may contain a software information organization program <NUM>, so that the at least one processor <NUM> executes the software information organization method <NUM> described in the embodiments of the present invention. The software information organization program <NUM> may comprise:.

Optionally, the device <NUM> may also comprise a software similarity comparison module <NUM>, configured to compare the similarity between the first software and another piece of software or search the third knowledge graph for software meeting key information.

It should be mentioned that embodiments of the present invention may include devices having different architectures than that shown in <FIG>. The above architecture is only exemplary, and is used to explain the method <NUM> provided by the embodiments of the present invention. For example, the device <NUM> may also be implemented as the structure shown in <FIG>.

In addition, the above modules may also be regarded as functional modules implemented by hardware, which are used to implement various functions that are involved when the software information organization device <NUM> executes the software information organization method. For example, the control logics of the processes involved in the method are burnt into a chip such as a field-programmable gate array (FPGA) or a complex programmable logic device (CPLD), and these chips or devices perform the functions of the above modules. The specific implementation method can be determined according to the engineering practice.

As shown in <FIG>, one exemplary method <NUM> according to an embodiment of the present invention comprises the following steps:.

Specifically, the first information may comprise at least one of the following information:.

For example, if the first information comprises static information of the code, to perform step S202 to obtain the first information from the code of the first software <NUM> and generate a first knowledge graph based on the first information, specifically, as shown in <FIG>, the sub-step S2021 may be performed, wherein a static analysis method is used to obtain at least two static information of the code from the code and obtain the relationship between the at least two static information of the code, and the first knowledge graph is generated based on the at least two static information of the code and the relationship between the at least two static information of the code.

Static code analysis collects software characteristic data by scanning the source code of the software. Characteristic data of software may include a program name, a program description, name of the code file, a package structure, the number of lines of the code in each file, etc. In addition, a static code analysis can be used to build an index of the source code, and the index can be used to aid a data stream analysis and a control flow analysis.

A knowledge graph is a network of entities, semantic types of entities, attributes, and relationships between entities. In a knowledge graph, a graph structure is used to present knowledge, store entities and relationships between entities. In a knowledge graph, entities are represented by nodes, and the relationships between entities are represented by lines between nodes. <FIG> is a knowledge graph obtained based on a static code analysis. In the figure, node <NUM> "NGINX" and node <NUM> "KAFKA" are both programs, and thus they are all connected to node <NUM> "program". Line <NUM> from node <NUM> to node <NUM> represents "is one", and line <NUM> from node <NUM> to node <NUM> also represents "is one", which means that both node <NUM> and node <NUM> are examples of node <NUM>. Node <NUM> "NGINX" "comprises" (<NUM>) node <NUM> "NGINX project information", node <NUM> "NGINX project information" comprises (<NUM>) node <NUM> "root directory", and node <NUM> "root directory" comprises subdirectories (<NUM> and <NUM>), being respectively node <NUM> "subdirectory src" and node <NUM> "subdirectory conf". Node <NUM> "subdirectory src" further comprises a subdirectory (<NUM>), being node <NUM> "subdirectory core". Node <NUM> "subdirectory core" comprises a subfile (<NUM>), being "subfile nginx. c", while node <NUM> "subdirectory conf" comprises a subfile (<NUM>), being node <NUM> "subfile fastcgi.

In the process of generating a knowledge graph, the knowledge graph is stored in a knowledge graph library, and may be transmitted between different devices, apparatuses or modules as needed. In the embodiments of the present invention, the JavaScript Object Notation format may be used as an intermediate data format to represent knowledge graphs, defined as follows:
<IMG>.

Specifically, "node" represents a node in a knowledge graph, "link" represents a line in a knowledge graph, "source" represents the starting node of a line in a knowledge graph, "target" represents the ending node of a line in a knowledge graph, "weight" represents the weight of a line, and "group" represents the type of a node.

As another example, if the first information comprises AST data, to perform step S202 to obtain first information from the code of the first software <NUM> and generate a first knowledge graph based on the first information, specifically, as shown in <FIG>, sub-step S2022 may be performed, wherein an AST tool is used to generate the AST data based on the code of the first software <NUM>, and the first knowledge graph is generated based on the relationship between AST nodes in the AST data, the relationship between the class node and the method node among the AST nodes, and the values of the AST nodes.

The abstract syntax tree (AST) represents the abstract syntactic structure of a source code written in a programming language in the form of a tree. Each node of the tree represents a construct that occurs in the source code. The programming language used is not considered when the AST data structure is used to represent the abstract syntactic structure of a source code. Specifically, program elements are represented as package definitions or imports, variable assignments, conditions, logical branches, etc. Knowledge generated based on AST can be used for similarity matching of software codes. Since it is an abstraction of the source code logic or syntax, AST data is barely affected by code obfuscation. <FIG> is a knowledge graph obtained based on AST data.

In the figure, node <NUM> "NGINX", node <NUM> "BinaryC" and node <NUM> "KAFKA" are all examples of node <NUM> "program", and therefore lines <NUM>, <NUM> and <NUM> from them to node <NUM> all represent "is one". Node <NUM> "BinaryC" comprises node <NUM> "AST", and line <NUM> from node <NUM> to node <NUM> represents "comprises". Node <NUM> "AST" is connected to node <NUM> "package", node <NUM> "types" and node <NUM> "imports" respectively, and lines <NUM>, <NUM> and <NUM> to these nodes all represent "comprises". Node <NUM> "package" is connected to node <NUM> "astsample" and node <NUM> "com. sie", and lines <NUM> and <NUM> to the two nodes represent "comprises". Node <NUM> "types" is connected to node <NUM> "Type definition", and line <NUM> represents "comprises". Node <NUM> "type definition" is connected to node <NUM> "binary code", and line <NUM> represents "comprises". Node <NUM> "type definition" is also connected to node <NUM> "program body definition", and line <NUM> represents "comprises". Node <NUM> "program body definition" is respectively connected to node <NUM> "binary file" and node <NUM> "main program body", and lines <NUM> and <NUM> both represent "comprises a method". Node <NUM> "binary file" is connected to nodes <NUM> "string", <NUM> "block", <NUM> "static" and <NUM> "public" respectively, and lines <NUM>, <NUM>, <NUM> and <NUM> respectively represent "return value type", "program body", "modifier" and "modifier". Node <NUM> "main program body" is connected to nodes <NUM> "public", <NUM> "static", <NUM> "block" and <NUM> "no type" respectively, and lines <NUM>, <NUM>, <NUM> and <NUM> respectively represent "modifier", "modifier", "program body" and "return value type". Node <NUM> "block" is connected to nodes <NUM> "variable", <NUM> "expression" and <NUM> "return value" respectively, and lines <NUM>, <NUM> and <NUM> all represent "declares". Node <NUM> "variable" is connected to node <NUM> "expression", line <NUM> represents "program body next step", node <NUM> "expression" is connected to node <NUM> "return value", and line <NUM> represents "program body next step". Node <NUM> "block" is connected to node <NUM> "for status", and line <NUM> represents "declares".

In brief, a piece of software comprises a code, and each code file has its corresponding AST nodes. An AST node defines child nodes such as PACKAGE, TYPES and IMPORTS. The AST node "type" defines the class-level attribute, and it has child nodes that define each method. An AST node corresponding to a class and an AST node corresponding to a method are connected via the relationship "INCLUDE_METHOD". The code specific values are also included in the knowledge graph described above.

As another example, if the first information comprises control flow information, to perform step S202 to obtain first information from the code of the first software <NUM> and generate a first knowledge graph based on the first information, specifically, as shown in <FIG>, sub-step S2023 may be performed, wherein an AST tool is used to generate the AST data based on the code of the first software <NUM> (here, if AST data has been generated in a previous step, the generated AST data may be used directly to determine the control flow information), the control flow information is determined based on the call relationship between AST nodes in the AST data and the method marked as the initial method, and the first knowledge graph is generated based on the control flow information. For example, in sub-step S2023, the call relationships between AST nodes may be collected to enrich the knowledge graph. Based on the AST data, the AST nodes corresponding to the method have a call relationship. In addition, the initial method is usually marked as "Start_Method". With the control flow information, the execution process and call relationship of the software can be established.

As another example, if the first information comprises data stream information, to perform step S202 to obtain first information from the code of the first software <NUM> and generate a first knowledge graph based on the first information, specifically, as shown in <FIG>, sub-step S2024 may be performed, wherein data calculation points are added to each execution scenario in the code of the first software <NUM>, the data stream information is obtained according to the data calculation points, and the first knowledge graph is generated based on the data stream information. In the process, an execution scenario is a task with a starting point and an ending point, for example, uploading data to a database. Through sub-step S2024, various program execution declaration data can be added to the knowledge graph.

Optionally, to obtain the second information from the data, resources and documents of the first software <NUM> in step S203, specifically, semi-structured content and structured content may be distinguished and processed separately. For example, for the semi-structured content in the three of data, resources and documents of the first software <NUM>, the second information is obtained by use of predefined rules; for unstructured content in the three of data, resources and documents of the first software <NUM>, natural language processing is used to obtain the second information, wherein a document understanding algorithm may be used to understand the content of the documents; then a natural language processing algorithm may be used to analyze, understand and derive entities and relationships.

In step S204, the first knowledge graph and the second knowledge graph of the first software <NUM> are combined into a general knowledge graph, so that when there is new software, the knowledge points and the relationships between knowledge points in the third knowledge graph can be continuously expanded and enriched, and knowledge points can be mined deeper. Each component of the third knowledge graph is marked with a corresponding software identification, so that the corresponding similar software can be determined when the degree of similarity between new software and known software is subsequently determined. Compared with generating an independent knowledge graph for each software, generating a general knowledge graph with rich information and knowledge point correlations makes it convenient to deeply mine the relationships and connections between software, thereby making the system information of the entire knowledge graph more complete.

The steps S201 to S204 above generate and perfect the third knowledge graph. In the steps below, the degree of similarity between software can be determined based on knowledge graphs. There are various implementation methods, which include but are not limited to:.

For method <NUM>, specifically, the method <NUM> may further comprise the following steps:.

Only one or both of steps S210 and S211 may be performed, depending on the software search requirements.

In the above process, during the search for software with the key information in the third knowledge graph, the key information may be matched according to the information of each node and the lines between the nodes in the knowledge graph to find target software. Since the software identification corresponding to each component is marked when the third knowledge graph is generated, the corresponding software can be found by matching the key information.

<FIG> is another structure of the software information organization device <NUM> provided by an embodiment of the present invention. This structure may be regarded as a further refinement of the structure shown in <FIG>.

As shown in <FIG>, the software loading module <NUM> loads first software <NUM>. As previously described, the first software may comprise a code <NUM>, data <NUM>, resources <NUM> and documents <NUM>. In one aspect, the software loading module <NUM> sends the code <NUM> to the first information obtaining module <NUM>, and the static code analyzer <NUM> in the first information obtaining module <NUM> performs a static analysis based on the code <NUM> to obtain static information of the code; the AST builder <NUM> in the first information obtaining module <NUM> generates AST data based on the code <NUM>; the control flow analyzer <NUM> in the first information obtaining module <NUM> determines the control flow information based on the AST data; and the data stream analyzer <NUM> in the first information obtaining module <NUM> obtains data stream information based on the code <NUM>. The first information obtaining module <NUM> generates a first knowledge graph based on the information and sends it to the knowledge collecting module <NUM>. In another aspect, the software loading module <NUM> sends the data <NUM>, resources <NUM> and documents <NUM> to the second information obtaining module <NUM>, and the second information obtaining module <NUM> obtains the second information therefrom, generates a second knowledge graph based on the second information, and sends it to the knowledge collecting module <NUM>. In this process, the second information obtaining module <NUM> may use predefined rules to obtain the second information for the semi-structured content in the data <NUM>, resources <NUM> and documents <NUM> in the first software <NUM> and may use the natural language processing method to obtain the second information for the unstructured content in the data <NUM>, resources <NUM> and documents <NUM> in the first software <NUM>.

The knowledge collector <NUM> in the knowledge collecting module <NUM> receives the first knowledge graph and the second knowledge graph, combines the first knowledge graph and the second knowledge graph into a third knowledge graph, and stores it in the knowledge graph library <NUM>. The device <NUM> may also provide a query/configuration API <NUM> as an interface with the operator <NUM> for use by the operator <NUM> to configure rules and perform software similarity queries, and the configured rules may be used to generate knowledge graphs for software and perform software similarity comparison. The query/configuration API <NUM> receives a command from the operator <NUM> and sends it to the rule manager <NUM>, and the rule manager <NUM> configures the first information obtaining module <NUM>, the second information obtaining module <NUM> and the knowledge manager <NUM>, respectively.

For example, the operator <NUM> may configure the first information obtaining module <NUM> to change its behavior of obtaining the first information from the code <NUM>. In addition, the operator <NUM> may also configure the first information obtaining module <NUM> to use a different method to obtain the first information. For another example, the operator <NUM> may configure the rules for the second information obtaining module <NUM> to obtain the second information from the documents, and the parameters of the natural language processing algorithm used thereby. For another example, the operator <NUM> may configure the rule manager <NUM> to change the algorithm for determining software similarity.

The process <NUM> of generating a knowledge graph and determining similar software by the device shown in <FIG> will be described by referring to <FIG> below. As shown in <FIG>, the process may comprise the following steps:.

Specifically, at step S407, the static code analyzer <NUM> in the first information obtaining module <NUM> obtains static information of the code from the code <NUM> by use of a static analysis method, obtains the relationships between the static information of the code, and generates the first knowledge graph based on the two information. Refer to step S2021 described above for details.

At step S408, the AST builder <NUM> in the first information obtaining module <NUM> uses an AST tool to generate AST data based on the code <NUM> and generates the first knowledge graph based on the relationships between AST nodes in the AST data, the relationships between the class nodes and the method nodes in the AST nodes, and the values of the AST nodes. Refer to step S2022 described above for details.

At step S409, the control flow analyzer <NUM> in the first information obtaining module <NUM> may use an AST tool to generate AST data based on the code <NUM>, determine the control flow information based on the call relationships between AST nodes in the AST data and the method marked as the initial method, and generate the first knowledge graph based on the control flow information. Refer to step S2023 described above for details.

At step S410, the data stream analyzer <NUM> in the first information obtaining module <NUM> may add data calculation points to each execution scenario in the code <NUM>, obtain data stream information according to the data calculation points, and generate the first knowledge graph based on the data stream information. Refer to step S2024 described above for details.

Specifically, the static code analyzer <NUM>, the AST builder <NUM>, the control flow analyzer <NUM> and the data stream analyzer <NUM> may generate knowledge graphs separately based on the code <NUM>, which are later combined into the first knowledge graph. They may also send the knowledge graph generated separately to the knowledge collector <NUM>, and the knowledge collector <NUM> or a subsequent device completes the combination of the knowledge graphs.

S411: The first information obtaining module <NUM> sends the first knowledge graph to the knowledge collector <NUM>.

S412: The knowledge collector <NUM> stores the first knowledge graph in the knowledge graph library <NUM>.

S413: The software loading module <NUM> sends a message to the knowledge manager <NUM>, triggering the knowledge manager <NUM> to load the first knowledge graph and the second knowledge graph from the knowledge graph library <NUM>, and to merge the first knowledge graph and the second knowledge graph into the third knowledge graph. Specifically, to combine knowledge graphs, knowledge of the same or similar methods or classes may be combined. When the same or similar methods of different software are merged into the same node, the performance and accuracy of the decision on software similarity can be improved.

S414: The knowledge manager <NUM> sends a message to the knowledge graph library <NUM>, to obtain the first knowledge graph and the second knowledge graph from the knowledge graph library <NUM>.

S415: The knowledge graph library <NUM> responds to the message sent by the knowledge manager <NUM>, and returns the first knowledge graph and the second knowledge graph to the knowledge manager <NUM>.

S416: The knowledge manager <NUM> combines the first knowledge graph and the second knowledge graph into the third knowledge graph library <NUM>.

S417: The knowledge graph library <NUM> stores the combined third knowledge graph in the knowledge graph library <NUM>.

The operator <NUM> may configure the rules of software information obtaining, knowledge graph generation and knowledge graph combination through the following steps S418 to S426, specifically:.

Specifically, steps S418 to S426 may be performed before step S401, or during the process when steps S401 to S417 are performed, or after step S417 is performed, so that the rules can be modified flexibly.

In the following steps S427 to S438, the user <NUM> uses the software information organization device <NUM> provided by the embodiments of the present invention to search for software similar to the second software <NUM>. In the steps below, method <NUM> for determining the similarity between software described above is used.

S427: The user <NUM> sends an instruction to the query/configuration API <NUM>, requesting to search for software similar to the second software <NUM>.

S428: The query/configuration API <NUM> forwards the instruction to the software similarity comparison module <NUM>, requesting to search for software similar to the second software <NUM>.

S429: The software similarity comparison module <NUM> sends the second software <NUM> to the second information obtaining module <NUM>, or it may only send the data, resources and documents in the second software <NUM>.

S430: The second information obtaining module <NUM> extracts the fourth information from the received data, resources and documents in the second software <NUM>, generates a fifth knowledge graph based on the fourth information (in the same process for obtaining information or generating the knowledge graph for the first software <NUM>, which is not detailed here), and returns it to the software similarity comparison module <NUM>.

S431: The software similarity comparison module <NUM> sends the second software <NUM> to the first information obtaining module <NUM>, or it may only send the code in the second software <NUM>.

S432: The first information obtaining module <NUM> extracts the third information from the received code in the second software <NUM>, generates a fourth knowledge graph based on the third information (in the same process for obtaining information or generating the knowledge graph for the first software <NUM>, which is not detailed here), and returns it to the software similarity comparison module <NUM>.

S433: The software similarity comparison module <NUM> sends a message to the knowledge manager <NUM>, requesting to obtain the third knowledge graph, i.e., the combined general knowledge graph stored in the knowledge graph library <NUM>.

S434: The knowledge manager <NUM> sends a message to the knowledge graph library <NUM>, requesting to obtain the third knowledge graph.

S435: The knowledge graph library <NUM> responds to the message and returns the third knowledge graph to the knowledge manager <NUM>.

S436: The knowledge manager <NUM> returns the third knowledge graph to the software similarity comparison module <NUM>.

S437: The software similarity comparison module <NUM> compares the fourth knowledge graph and the fifth knowledge graph with the third knowledge graph to determine software similar to the second software <NUM> (for example, software whose similarity is greater than a preset similarity threshold). The similar software determined by the software similarity comparison module <NUM> or the information of the software is returned to the query/configuration API <NUM>.

S438: The query/configuration API <NUM> returns the similar software or software information received to the user <NUM>.

In addition, embodiments of the present invention also provide a computer-readable medium storing a computer-readable instruction, which, when executed by a processor, causes the processor to perform the software information organization method described above. Examples of the computer-readable medium include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, and DVD+RW), magnetic tapes, volatile memory cards and ROMs. Optionally, the computer-readable instruction may be downloaded from a server computer or a cloud via a communication network.

In summary of the above, the embodiments of the present invention provide a software information organization method and device and a computer-readable medium to generate a knowledge graph for software, so that the rich information included in the software can be effectively organized, and the degree of similarity between software can be determined based on the knowledge graph.

When knowledge graphs are generated for software, information of different software is combined to generate one knowledge graph, and the software identifications are marked in the corresponding parts of the knowledge graph, so that the same or similar structures and contents of different software can be combined, reducing redundant information of the entire knowledge graph, and the software identifications are marked in the knowledge graph, facilitating subsequent search for similar software, and improving the efficiency of the calculation of software similarity (with more efficient searching since redundant information is removed from the knowledge graph and only one knowledge graph is searched).

For determining the degree of similarity between software, a plurality of optional implementation methods are provided. Specified software may be compared with a knowledge graph to determine software similar to the specified software among the software marked by the knowledge graph. It is also possible to specify key information and to search a knowledge graph for software meeting the key information. The implementation is more flexible, and the search result better meets user needs.

Claim 1:
A software information organization method (<NUM>), comprising:
- loading (S201) first software (<NUM>), which comprises a code, data, resources and documents;
- obtaining (S202) first information from the code of the first software (<NUM>), and generating a first knowledge graph based on the first information;
- obtaining (S203) second information from the data, resources and documents of the first software (<NUM>), and generating a second knowledge graph based on the second information;
- combining (S204) the first knowledge graph and the second knowledge graph into a third knowledge graph;
- storing the third knowledge graph in a knowledge graph library;
- receiving a user instruction to search for software similar to a second software;
- loading (S205) the second software (<NUM>), which comprises a code, data, resources and documents;
- obtaining (S206) third information from the code of the second software (<NUM>), and generating a fourth knowledge graph based on the third information;
- obtaining (S207) fourth information from the data, resources and documents of the second software (<NUM>), and generating a fifth knowledge graph based on the fourth information;
- comparing (S208) the fourth knowledge graph and the fifth knowledge graph with one or more knowledge graphs stored in the knowledge graph library, to determine software similar to the second software (<NUM>).