CodeKernel: A Graph Kernel based Approach to the Selection of API Usage Examples

被引:22
|
作者
Gu, Xiaodong [1 ,3 ]
Zhang, Hongyu [2 ]
Kim, Sunghun [1 ,3 ]
机构
[1] Hong Kong Univ Sci & Technol, Hong Kong, Peoples R China
[2] Univ Newcastle, Callaghan, NSW, Australia
[3] NAVER Corp, Clova AI Res, Seongnam Si, South Korea
关键词
CLASSIFICATION;
D O I
10.1109/ASE.2019.00061
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Developers often want to find out how to use a certain API (e.g., FileReader.read in JDK library). API usage examples are very helpful in this regard. Over the years, many automated methods have been proposed to generate code examples by clustering and summarizing relevant code snippets extracted from a code corpus. These approaches simplify source code as method invocation sequences or feature vectors. Such simplifications only model partial aspects of the code and tend to yield inaccurate examples. We propose CodeKernel, a graph kernel based approach to the selection of API usage examples. Instead of approximating source code as method invocation sequences or feature vectors, CodeKernel represents source code as object usage graphs. Then, it clusters graphs by embedding them into a continuous space using a graph kernel. Finally, it outputs code examples by selecting a representative graph from each cluster using designed ranking metrics. Our empirical evaluation shows that CodeKernel selects more accurate code examples than the related work (MUSE and EXOADOCS). A user study involving 25 developers in a multinational company also confirms the usefulness of CodeKernel in selecting API usage examples.
引用
收藏
页码:602 / 613
页数:12
相关论文
共 50 条
  • [41] A Cooperative Approach for Combining Client-based and Library-based API Usage Pattern Mining
    Saied, Mohamed Aymen
    Sahraoui, Houari
    2016 IEEE 24TH INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION (ICPC), 2016,
  • [42] Web API evolution patterns: A usage-driven approach
    Koci, Rediana
    Franch, Xavier
    Jovanovic, Petar
    Abello, Alberto
    JOURNAL OF SYSTEMS AND SOFTWARE, 2023, 198
  • [43] Mining Complex Temporal API Usage Patterns: An Evolutionary Approach
    Huppe, Samuel
    Saied, Mohamed Aymen
    Sahraoui, Houari
    PROCEEDINGS OF THE 2017 IEEE/ACM 39TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING COMPANION (ICSE-C 2017), 2017, : 274 - 276
  • [44] KG2Code: Correct Code Examples Mining Service Based on Knowledge Graph for Fixing API Misuses
    Zhang, Yangqi
    Kuai, Zhirui
    Yao, Wenjin
    Zhang, Zhiyang
    Kuang, Li
    SERVICE-ORIENTED COMPUTING (ICSOC 2021), 2021, 13121 : 875 - 882
  • [45] Detecting and Ranking API Usage Pattern in Large Source Code Repository: A LFM Based Approach
    Zhao, Jitong
    Liu, Yan
    MACHINE LEARNING AND KNOWLEDGE EXTRACTION, CD-MAKE 2017, 2017, 10410 : 41 - 56
  • [46] Graph neural network based on graph kernel: A survey
    Xu, Lixiang
    Peng, Jiawang
    Jiang, Xiaoyi
    Chen, Enhong
    Luo, Bin
    PATTERN RECOGNITION, 2025, 161
  • [47] API Usage Recommendation Via Multi-View Heterogeneous Graph Representation Learning
    Chen, Yujia
    Gao, Cuiyun
    Ren, Xiaoxue
    Peng, Yun
    Xia, Xin
    Lyu, Michael R.
    IEEE Transactions on Software Engineering, 2023, 49 (05): : 3289 - 3304
  • [48] PAMOGK: a pathway graph kernel-based multiomics approach for patient clustering
    Tepeli, Yasin Ilkagan
    Unal, Ali Burak
    Akdemir, Furkan Mustafa
    Tastan, Oznur
    BIOINFORMATICS, 2021, 36 (21) : 5237 - 5246
  • [49] Kernel-Based Feature Selection Techniques for Transport Proteins Based on Star Graph Topological Indices
    Fernandez-Lozano, Carlos
    Gestal, Marcos
    Pedreira-Souto, Nieves
    Postelnicu, Lucian
    Dorado, Julian
    Robert Munteanu, Cristian
    CURRENT TOPICS IN MEDICINAL CHEMISTRY, 2013, 13 (14) : 1681 - 1691
  • [50] PAMOGK: a pathway graph kernel-based multiomics approach for patient clustering
    Tepeli, Yasin Ilkagan
    Unal, Ali Burak
    Akdemir, Furkan Mustafa
    Tastan, Oznur
    BIOINFORMATICS, 2020, 36 (21) : 5237 - 5246