# US 2012/0254835 A1 · Structural search of source code

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2012/0254835 A1
- Document ID: US20120254835A1
- Status: Published application
- Kind: A1
- Application number: 13/111,870
- Filed: 2011-05-19
- Published: 2012-10-04
- Earliest claimed: 2011-03-31
- Assignees: Infosys Technologies Limited
- Inventors: Basava Raju Muddu; Allahbaksh Mohammedali Asadullah; Jeena Vinod; Krishna Kumar Pooloth
- Web page: https://patentgrep.com/patent/US20120254835A1

## CPC

- G06F 8/75: Structural analysis for program understanding
- G06F 8/36: Software reuse
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques and tools are described for searching source code. For example, source code can be indexed, a code structure query can be received, index records that conform to the code structure query can be identified, and code structure query results that correspond to the identified index records conforming to the code structure query can be sent. Also for example, a code structure query can be sent, a list of code structure query results corresponding to index records that conform to the code structure query can be received, at least one of the code structure query results can be selected, based on the selection, a formatted source-code file and a code hierarchy can be received, a code annotation associated with the formatted source-code file can be sent, and an annotation result corresponding to the formatted source-code file can be received.

## Claims

### Claim 1

A method implemented at least in part with a computing system, the method comprising:
indexing source code, the indexing comprising creating index records for a plurality of code elements, wherein the index records for the plurality of code elements comprise structure fields and structure values that correspond to the structure fields;
receiving a code structure query comprising at least one field-value expression, wherein the at least one field-value expression comprises a field term and a value term;
identifying one or more of the index records that conform to the code structure query, wherein the identified one or more of the index records comprises identifying structure fields and structure values that correspond to the at least one field-value expression; and
sending code structure query results that correspond to the identified one or more of the index records that conform to the code structure query.

### Claim 2 (depends on 1)

The method of claim 1, wherein the indexing further comprises parsing the source code according to syntax of a programming language to extract information from code elements.

### Claim 3 (depends on 1)

The method of claim 1 further comprising:
receiving one or more selections of the code structure query results;
wherein the indexing source code further comprises generating formatted source code; and
sending formatted source code corresponding to the one or more selections of the code structure query results.

### Claim 4 (depends on 3)

The method of claim 3 wherein the code structure query and the one or more selections of the code structure query results are received from a client device searching for source code; and
wherein the code structure query results and formatted source code are sent to the client device for display in a user interface.

### Claim 5 (depends on 1)

The method of claim 1 wherein the structure fields and the structure values are based on structural attributes of the code elements.

### Claim 6 (depends on 1)

The method of claim 1 wherein the code structure query further comprises one or more Boolean operators that operate on the at least one field-value expression.

### Claim 7 (depends on 1)

The method of claim 1, wherein a code structure query result of the code structure query results is stored as a structure value of the index record of the code element.

### Claim 8 (depends on 3)

The method of claim 3, wherein the formatted source code comprises an HTML source-code file that displays source code of the code element corresponding to the one or more selections of the code structure query results, wherein the HTML source-code file includes links to referenced source code.

### Claim 9 (depends on 1)

The method of claim 1 further comprising:
generating at least one annotation record associated with at least one code element of the plurality of code elements, the at least one annotation record comprising comments about the at least one code element that are not found in the indexed source code.

### Claim 10 (depends on 6)

The method of claim 6 wherein the code structure query further comprises free text terms; and
wherein the one or more Boolean operators further operate on the free text terms.

### Claim 11 (depends on 3)

The method of claim 3 further comprising:
based on the one or more selections from the code structure query results, sending a code hierarchy to a client device for display.

### Claim 12

A computing system comprising memory storing computer executable instructions that cause the computing system to perform a method, the method comprising:
indexing source code, the indexing comprising creating index records for a plurality of code elements, wherein the index records for the plurality of code elements comprise structure fields and structure values that correspond to the structure fields;
sending, to a server, a code structure query comprising at least one field-value expression, wherein the at least one field-value expression comprises a field term and a value term;
receiving, from the server, a list of code structure query results that correspond to one or more of the index records that conform to the code structure query, wherein the one or more of the index records comprise structure fields and structure values that correspond to the at least one field-value expression;
selecting of one of the code structure query results from the list of code structure query results;
based on the selection of one of the code structure query results, receiving a code hierarchy from the server, wherein the code hierarchy comprises a list of dependencies identified from the index record for the selected one of the code structure query results;
based on the selection of one of the code structure query results, receiving, from the server, a selected HTML source-code file comprising a plurality of links to different HTML source-code files corresponding to code elements referenced in the source code of the selected HTML source-code file;
sending a code annotation associated with the selected HTML source-code file, the code annotation comprising comments provided by a user about the source-code in the selected HTML source-code file that are not found in the indexed source code; and
receiving, an annotation result corresponding to the selected HTML source-code file comprising the comments about the source code provided by the user that are not found in the indexed source code and a code structure query result corresponding to the selected HTML source-code file.

### Claim 13

A computing system comprising memory storing computer executable instructions that cause the computing system to perform a method, the method comprising:
indexing source code, the indexing comprising creating index records for a plurality of code elements, wherein the index records for the plurality of code elements comprise structure fields and structure values that correspond to the structure fields;
receiving a code structure query comprising at least one field-value expression, wherein the at least one field-value expression comprises a field term and a value term;
identifying one or more of the index records that conform to the code structure query, wherein the identified one or more of the index records comprise structure fields and structure values that correspond to the at least one field-value expression; and
sending a list of code structure query results that correspond to the identified one or more of the index records that conform to the code structure query.

### Claim 14 (depends on 13)

The computing system of claim 13 further comprising:
receiving one or more selections from the list of code structure query results;
wherein the indexing code elements further comprises generating formatted source code; and
sending formatted source code corresponding to the one or more selections from the list of code structure query results.

### Claim 15 (depends on 13)

The computing system of claim 13, wherein the code structure query and the one or more selections from the list of code structure query results are received from a user searching for source code; and
wherein the list of code structure query results and formatted source code are sent to a client device for display.

### Claim 16 (depends on 13)

The computing system of claim 13, wherein the structure fields and the structure values are based on structural attributes of the code elements.

### Claim 17 (depends on 13)

The computing system of claim 13, wherein the code structure query further comprises one or more Boolean operators that operate on the at least one field-value expression.

### Claim 18 (depends on 17)

The computing system of claim 17, wherein the code structure query further comprises free text terms; and
wherein the one or more Boolean operators further operate on the free text terms.

### Claim 19 (depends on 14)

The computing system of claim 14 further comprising:
based on the one or more selections from the list of code structure query results, sending a code hierarchy to a client device for display.

### Claim 20 (depends on 13)

The computing system of claim 13 further comprising:
generating at least one annotation record associated with at least one code element of the plurality of code elements, the at least one annotation record comprising comments about the at least one code element that are not found in the indexed source-code;
sending at least one annotation result comprising the comments about the at least one code element that are not found in the indexed source code and a code structure query result corresponding to the at least one code element.

### Claim 21

A method implemented at least in part with a computing system, the method comprising:
sending, to a server, a code structure query comprising at least one field-value expression, wherein the at least one field-value expression comprises a field term and a value term;
receiving, from the server, a list of code structure query results that correspond to one or more index records that conform to the code structure query;
selecting at least one of the code structure query results from the list of code structure query results;
based on the selected at least one of the code structure query results, receiving, from the server, a selected formatted source-code file comprising a plurality of links to different formatted source-code files corresponding to code elements referenced in the source code of the selected formatted source-code file;
sending a code annotation associated with the selected formatted source-code file, the code annotation comprising comments provided by a user about the source code in the selected formatted source-code file that are not found in the selected formatted source-code file; and
receiving, an annotation result corresponding to the selected formatted source-code file comprising the comments about the source code provided by the user that are not found in the selected formatted source-code file and a code structure query result for the selected formatted source-code file.

### Claim 22 (depends on 21)

The method of claim 21 further comprising:
indexing source code at least by parsing the source code according to syntax of a programming language to create the one or more index records for one or more code elements, wherein the index records for the one or more code elements comprise structure fields and structure values that correspond to the structure fields; and
based on the selected at least one of the code structure query results, receiving a code hierarchy from the server, wherein the code hierarchy comprises a list of dependencies identified from the index record for the selected one of the code structure query results.

### Claim 23

A computer readable storage medium storing computer-executable instructions that cause a computer to perform a method, the method comprising:
indexing a plurality of source-code files, the indexing the plurality of source code files comprising:
creating HTML source-code files from the plurality of source-code files; and
creating index documents for the plurality of source-code files by parsing source code according to syntax of a programming language, wherein the index documents for the plurality of source-code files comprise structure fields and structure values that correspond to the structure fields;
receiving, from a client device, a code structure query comprising a plurality of field-value expressions, wherein a field-value expression of the plurality of field-value expressions comprises a field term and a value term;
identifying one or more of the index documents that conform to the code structure query, wherein the identified the one or more of the index documents comprises identifying structure fields and structure values that correspond to the plurality of field-value expressions;
sending, to the client device, a list of code structure query results that correspond to the identified one or more of the index documents that conform to the code structure query;
receiving, from the client device, a selection of one of the code structure query results from the list of code structure query results;
based on the selection of one of the code structure query results, sending a code hierarchy to the client device, wherein the code hierarchy comprises a list of dependencies identified from the index document for the selected one of the code structure query results;
sending, to the client device, a selected HTML source-code file corresponding to the selected one of the code structure query results, the selected HTML source-code file comprising a plurality of links to different HTML source-code files corresponding to code elements referenced in the source code of the selected HTML source-code file;
creating an annotation record associated with the selected HTML source-code file, the annotation record comprising comments provided by a user about the source code in the selected HTML source-code file that are not found in the indexed source code; and
sending, to the client device, an annotation result comprising the comments about the source code provided by the user that are not found in the indexed source code and code structure query results corresponding to the selected HTML source-code file.
