The Nested Relational Calculus (NRC) has been an influential high-level query language, providing power and flexibility while still allowing translation to standard SQL queries. It has also been used as a basis for language-integrated query in programming languages such as F#, Scala, and Links. However, SQL's treatment of incomplete information, using nulls and three-valued logic, is not compatible with `standard' NRC based on two-valued logic. Nulls are widely used in practice for incomplete data, but the question of how to accommodate SQL-style nulls and incomplete information in NRC, or integrate such queries into a typed programming language, appears not to have been studied thoroughly. In this paper we consider two approaches: an explicit approach in which option types are used to represent (possibly) nullable primitive types, and an implicit approach in which types are treated as possibly-null by default. We give translations relating the implicit and explicit approaches, discuss handling nulls in language integration, and sketch extensions of normalization and conservativity results.
翻译:近距离关系计算(NRC)是一种有影响力的高层次查询语言,它提供了权力和灵活性,同时仍然允许将SQL标准查询进行翻译。它也被用作F#、Scala和Links等编程语言的语言综合查询的基础。然而,SQL使用空格和三价逻辑处理不完整信息的做法不符合基于双值逻辑的“标准”NRC。NCR的不完全数据在实践中被广泛使用,但是,如何容纳SQL式空格和不完整信息的问题,或如何将这类查询纳入某类编程语言的问题,似乎没有得到彻底研究。在本文件中,我们考虑了两种办法:一种明确的办法,即使用选择类型(可能)代表无效的原始类型,以及一种隐含的方法,即将各种类型视为可能默认的无效。我们翻译了隐含和明确的方法,讨论语言融合中的无效处理,以及正常化和保守性结果的草图扩展。