XCoS: Explainable Code Search Based on Query Scoping and Knowledge Graph

Author:

Wang Chong1ORCID,Peng Xin1ORCID,Xing Zhenchang2ORCID,Zhang Yue1ORCID,Liu Mingwei1ORCID,Luo Rong1ORCID,Meng Xiujie1ORCID

Affiliation:

1. Fudan University

2. CSIRO’s Data61 & Australian National University

Abstract

When searching code, developers may express additional constraints (e.g., functional constraints and nonfunctional constraints) on the implementations of desired functionalities in the queries. Existing code search tools treat the queries as a whole and ignore the different implications of different parts of the queries. Moreover, these tools usually return a ranked list of candidate code snippets without any explanations. Therefore, the developers often find it hard to choose the desired results and build confidence on them. In this article, we conduct a developer survey to better understand and address these issues and induct some insights from the survey results. Based on the insights, we propose XCoS, an explainable code search approach based on query scoping and knowledge graph. XCoS extracts a background knowledge graph from general knowledge bases like Wikidata and Wikipedia. Given a code search query, XCoS identifies different parts (i.e., functionalities, functional constraints, nonfunctional constraints) from it and use the expressions of functionalities and functional constraints to search the codebase. It then links both the query and the candidate code snippets to the concepts in the background knowledge graph and generates explanations based on the association paths between these two parts of concepts together with relevant descriptions. XCoS uses an interactive user interface that allows the user to better understand the associations between candidate code snippets and the query from different aspects and choose the desired results. Our evaluation shows that the quality of the extracted background knowledge and the concept linkings in codebase is generally high. Furthermore, the generated explanations are considered complete, concise, and readable, and the approach can help developers find the desired code snippets more accurately and confidently.

Funder

National Natural Science Foundation of China

Publisher

Association for Computing Machinery (ACM)

Subject

Software

Reference84 articles.

1. Internet Archive. 2021. Stack Overflow Data Dump Version from March 4 2021. Retrieved September 4 2021 from https://archive.org/download/stackexchange/.

2. Wikimedia. 2021. Wikidata Data Dump Version from November 24 2021. Retrieved November 24 2021 from https://dumps.wikimedia.org/wikidatawiki/entities/.

3. Wikimedia. 2021. Wikipedia Data Dump Version from December 20 2021. Retrieved December 20 2021 from https://dumps.wikimedia.org/enwiki/.

4. Elastic Stack. 2022. Elasticsearch. Retrieved March 5 2022 from https://www.elastic.co/elasticsearch/.

5. GitHub. 2022. Javalang. Retrieved March 5 2022 from https://github.com/c2nes/javalang.

Cited by 6 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. KG4CraSolver: Recommending Crash Solutions via Knowledge Graph;Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering;2023-11-30

2. Mining Resource-Operation Knowledge to Support Resource Leak Detection;Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering;2023-11-30

3. Recommending Analogical APIs via Knowledge Graph Embedding;Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering;2023-11-30

4. Knowledge Graph based Explainable Question Retrieval for Programming Tasks;2023 IEEE International Conference on Software Maintenance and Evolution (ICSME);2023-10-01

5. Generating Variable Explanations via Zero-shot Prompt Learning;2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE);2023-09-11

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3