AutoQuery: Automatic Construction of Dependency Queries for Code Search

Many code search techniques have been proposed to return relevant code for a user query expressed as textual descriptions. However, source code is not mere text. It contains dependency relations among various program elements. To leverage these dependencies for more accurate code search results, tec...

Full description

Saved in:
Bibliographic Details
Main Authors: WANG, Shaowei, LO, David, JIANG, Lingxiao
Format: text
Language:English
Published: Institutional Knowledge at Singapore Management University 2016
Subjects:
Online Access:https://ink.library.smu.edu.sg/sis_research/2910
https://ink.library.smu.edu.sg/context/sis_research/article/3910/viewcontent/asej_autoquery_finaldraft.pdf
Tags: Add Tag
No Tags, Be the first to tag this record!
Institution: Singapore Management University
Language: English
id sg-smu-ink.sis_research-3910
record_format dspace
spelling sg-smu-ink.sis_research-39102020-01-23T07:28:24Z AutoQuery: Automatic Construction of Dependency Queries for Code Search WANG, Shaowei LO, David JIANG, Lingxiao Many code search techniques have been proposed to return relevant code for a user query expressed as textual descriptions. However, source code is not mere text. It contains dependency relations among various program elements. To leverage these dependencies for more accurate code search results, techniques have been proposed to allow user queries to be expressed as control and data dependency relationships among program elements. Although such techniques have been shown to be effective for finding relevant code, it remains a question whether appropriate queries can be generated by average users. In this work, we address this concern by proposing a technique, AutoQuery, that can automatically construct dependency queries from a set of code snippets. We realize AutoQuery by the following major steps: firstly, code snippets (that are not necessarily compilable) are converted into program dependence graphs (PDGs); secondly, a new graph mining solution is built to return common structures in the PDGs; thirdly, the common structures are converted to dependency queries, which are used to retrieve results by using a dependence-based code search technique. We have evaluated AutoQuery on real systems with 47 different code search tasks. The results show that the automatically constructed dependency queries retrieve relevant code with a precision, recall, and F-measure of 68.4, 72.1, and 70.2 %, respectively. We have also performed a user study to compare the effectiveness of AutoQuery with that of human generated queries. The results show that queries constructed by AutoQuery on average help to retrieve code fragments with comparable F-measures to those retrieved by human constructed queries. 2016-09-01T07:00:00Z text application/pdf https://ink.library.smu.edu.sg/sis_research/2910 info:doi/10.1007/s10515-014-0170-2 https://ink.library.smu.edu.sg/context/sis_research/article/3910/viewcontent/asej_autoquery_finaldraft.pdf http://creativecommons.org/licenses/by-nc-nd/4.0/ Research Collection School Of Computing and Information Systems eng Institutional Knowledge at Singapore Management University Code search Dependency query Query construction Graph mining Computer Sciences Databases and Information Systems Theory and Algorithms
institution Singapore Management University
building SMU Libraries
continent Asia
country Singapore
Singapore
content_provider SMU Libraries
collection InK@SMU
language English
topic Code search
Dependency query
Query construction
Graph mining
Computer Sciences
Databases and Information Systems
Theory and Algorithms
spellingShingle Code search
Dependency query
Query construction
Graph mining
Computer Sciences
Databases and Information Systems
Theory and Algorithms
WANG, Shaowei
LO, David
JIANG, Lingxiao
AutoQuery: Automatic Construction of Dependency Queries for Code Search
description Many code search techniques have been proposed to return relevant code for a user query expressed as textual descriptions. However, source code is not mere text. It contains dependency relations among various program elements. To leverage these dependencies for more accurate code search results, techniques have been proposed to allow user queries to be expressed as control and data dependency relationships among program elements. Although such techniques have been shown to be effective for finding relevant code, it remains a question whether appropriate queries can be generated by average users. In this work, we address this concern by proposing a technique, AutoQuery, that can automatically construct dependency queries from a set of code snippets. We realize AutoQuery by the following major steps: firstly, code snippets (that are not necessarily compilable) are converted into program dependence graphs (PDGs); secondly, a new graph mining solution is built to return common structures in the PDGs; thirdly, the common structures are converted to dependency queries, which are used to retrieve results by using a dependence-based code search technique. We have evaluated AutoQuery on real systems with 47 different code search tasks. The results show that the automatically constructed dependency queries retrieve relevant code with a precision, recall, and F-measure of 68.4, 72.1, and 70.2 %, respectively. We have also performed a user study to compare the effectiveness of AutoQuery with that of human generated queries. The results show that queries constructed by AutoQuery on average help to retrieve code fragments with comparable F-measures to those retrieved by human constructed queries.
format text
author WANG, Shaowei
LO, David
JIANG, Lingxiao
author_facet WANG, Shaowei
LO, David
JIANG, Lingxiao
author_sort WANG, Shaowei
title AutoQuery: Automatic Construction of Dependency Queries for Code Search
title_short AutoQuery: Automatic Construction of Dependency Queries for Code Search
title_full AutoQuery: Automatic Construction of Dependency Queries for Code Search
title_fullStr AutoQuery: Automatic Construction of Dependency Queries for Code Search
title_full_unstemmed AutoQuery: Automatic Construction of Dependency Queries for Code Search
title_sort autoquery: automatic construction of dependency queries for code search
publisher Institutional Knowledge at Singapore Management University
publishDate 2016
url https://ink.library.smu.edu.sg/sis_research/2910
https://ink.library.smu.edu.sg/context/sis_research/article/3910/viewcontent/asej_autoquery_finaldraft.pdf
_version_ 1770572733909827584