论文标题
Python兼容运行时环境与域知识图的冲突感知的推断
Conflict-aware Inference of Python Compatible Runtime Environments with Domain Knowledge Graph
论文作者
论文摘要
代码共享和重用是软件工程中广泛使用的实践。尽管在许多在线平台上可以访问大量的开源Python代码,但程序员通常会发现很难恢复成功的运行时环境。先前的研究验证了使用预先建立的知识库对Python依赖性的自动推断。但是,这些研究并不涵盖足够的知识来准确匹配Python代码,也忽略了其推断依赖性之间的潜在冲突,从而导致推理成功率低。在本文中,我们提出了Pycre,这是一种新方法,可以自动推断Python与域知识图(KG)自动兼容的运行时环境。具体而言,我们为Python第三方套餐设计了一个特定领域的本体,并在Python 2和Python 3中为10,000多个受欢迎的包装构建了KGS。Pycre发现了通过测量已知的库与目标代码中的第三方资源之间的匹配度来发现候选库。对于依赖性解决方案的NP完整问题,我们提出了一种启发式图形遍历算法,以有效保证包装之间的兼容性。 Pycre在现实世界数据集上实现了卓越的性能,并且有效地解决了与以前的方法相比,进口错误近一半。
Code sharing and reuse is a widespread use practice in software engineering. Although a vast amount of open-source Python code is accessible on many online platforms, programmers often find it difficult to restore a successful runtime environment. Previous studies validated automatic inference of Python dependencies using pre-built knowledge bases. However, these studies do not cover sufficient knowledge to accurately match the Python code and also ignore the potential conflicts between their inferred dependencies, thus resulting in a low success rate of inference. In this paper, we propose PyCRE, a new approach to automatically inferring Python compatible runtime environments with domain knowledge graph (KG). Specifically, we design a domain-specific ontology for Python third-party packages and construct KGs for over 10,000 popular packages in Python 2 and Python 3. PyCRE discovers candidate libraries by measuring the matching degree between the known libraries and the third-party resources used in target code. For the NP-complete problem of dependency solving, we propose a heuristic graph traversal algorithm to efficiently guarantee the compatibility between packages. PyCRE achieves superior performance on a real-world dataset and efficiently resolves nearly half more import errors than previous methods.