数据库集成查询技术
The Optics of Language-Integrated Query
摘要:
一元解析在语言集成查询(LINQ)领域占据主导地位,这是有充分理由的。事实上,解析与通用程序设计语言紧密集成,并且与常见的查询语言(如SQL)足够接近,以保证将其转换为有效的查询。解析还支持编写可重用和可组合查询的功能,例如处理嵌套数据和使用函数抽象。与这些发展并行的是,近年来光学技术已经成为编写程序的首选技术,这些程序可以操纵具有嵌套组件的复杂数据结构。光学抽象很容易组合,并且原则上允许数据访问和更新。本文试图利用LINQ作为一种高级语言,补充基于理解的方法的光学的概念。为了做到这一点,我们提升了一个受限的光学子集,即getter,仿射折叠和折叠,成为一个成熟的DSL。我们命名为Optica的光学语言的类型系统提取了它们的组成属性,而它的指称语义由标准光学给出。这种光学概念的形式化规范使得非标准光学表示的定义超越了van Laarhoven、profunctor光学等。特别地,本文证明了XQuery的一个受限子集可以被理解为光学表示;它引入了Triplets,一个非标准语义域来规范光学表达式并促进SQL查询的生成;描述了如何从光学表达式中生成基于解析的查询,从而表明这两种方法可以共存。本文还描述了S-Optica,一个使用无标记final方法的Optica的Scala实现。
英文摘要:
Monadic comprehensions reign over the realm of language-integrated query (LINQ), and for good reasons. Indeed, comprehensions are tightly integrated with general purpose programming languages and close enough to common query languages, such as SQL, to guarantee their translation into effective queries. Comprehensions also support features for writing reusable and composable queries, such as the handling of nested data and the use of functional abstractions. In parallel to these developments, optics have emerged in recent years as the technology of choice to write programs that manipulate complex data structures with nested components. Optic abstractions are easily composable and, in principle, permit both data access and updates. This paper attempts to exploit the notion of optic for LINQ as a higher-level language that complements comprehension-based approaches. In order to do this, we lift a restricted subset of optics, namely getters, affine folds and folds, into a full-blown DSL. The type system of the resulting language of optics, that we have named Optica, distills their compositional properties, whereas its denotational semantics is given by standard optics. This formal specification of the concept of optic enables the definition of non-standard optic representations beyond van Laarhoven, profunctor optics, etc. In particular, the paper demonstrates that a restricted subset of XQuery can be understood as an optic representation; it introduces Triplets, a non-standard semantic domain to normalize optic expressions and facilitate the generation of SQL queries; and it describes how to generate comprehension-based queries from optic expressions, thus showing that both approaches can coexist.The paper also describes S-Optica, a Scala implementation of Optica using the tagless-final approach.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。