arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2402.02642cs.SEcs.DBcs.PL
收藏

对象图编程

Object Graph Programming

Aditya Thimmaiah, Leonidas Lampropoulos, Christopher J. Rossbach, Milos Gligoric

AI总结:

本文提出对象图编程(OGO),通过声明式查询将对象堆视为图数据库,利用Cypher语言实现查询与修改,适用于集合查询、运行时内省和断言,并在Java中实现两种原型,验证于大型开源项目。

摘要:

我们引入了对象图编程(OGO),它能够通过声明式查询来读取和修改对象图(即对象堆的整个状态)。OGO将堆中的对象及其关系建模为对象图,从而将堆视为图数据库:图中的每个节点是一个对象(例如,类的实例或元数据类的实例),每条边是对象之间的关系(例如,一个对象的字段引用另一个对象)。我们利用Cypher(图数据库最流行的查询语言)作为OGO的查询语言。与LINQ(使用集合(如List)作为数据源)不同,OGO将整个对象图视为一个单一的“集合”。OGO非常适合查询集合(就像LINQ一样)、内省运行时系统状态(例如,查找给定类的所有实例或通过反射访问字段),以及编写能够访问整个程序状态的断言。我们以两种方式为Java实现了OGO原型:(a)将对象图转换为Neo4j数据库,并在其上运行Cypher查询;(b)实现我们自己的内存图查询引擎,直接查询对象堆。我们使用OGO将大型开源项目中的数百条语句重写为OGO查询。我们报告了我们的经验以及原型的性能。

英文摘要:

We introduce Object Graph Programming (OGO), which enables reading and modifying an object graph (i.e., the entire state of the object heap) via declarative queries. OGO models the objects and their relations in the heap as an object graph thereby treating the heap as a graph database: each node in the graph is an object (e.g., an instance of a class or an instance of a metadata class) and each edge is a relation between objects (e.g., a field of one object references another object). We leverage Cypher, the most popular query language for graph databases, as OGO's query language. Unlike LINQ, which uses collections (e.g., List) as a source of data, OGO views the entire object graph as a single "collection". OGO is ideal for querying collections (just like LINQ), introspecting the runtime system state (e.g., finding all instances of a given class or accessing fields via reflection), and writing assertions that have access to the entire program state. We prototyped OGO for Java in two ways: (a) by translating an object graph into a Neo4j database on which we run Cypher queries, and (b) by implementing our own in-memory graph query engine that directly queries the object heap. We used OGO to rewrite hundreds of statements in large open-source projects into OGO queries. We report our experience and performance of our prototypes.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑