{"title":"强规范化高阶关系查询","authors":"W. Ricciotti, J. Cheney","doi":"10.46298/lmcs-18(3:23)2022","DOIUrl":null,"url":null,"abstract":"Language-integrated query is a powerful programming construct allowing\ndatabase queries and ordinary program code to interoperate seamlessly and\nsafely. Language-integrated query techniques rely on classical results about\nthe nested relational calculus, stating that its queries can be algorithmically\ntranslated to SQL, as long as their result type is a flat relation. Cooper and\nothers advocated higher-order nested relational calculi as a basis for\nlanguage-integrated queries in functional languages such as Links and F#.\nHowever, the translation of higher-order relational queries to SQL relies on a\nrewrite system for which no strong normalization proof has been published: a\nprevious proof attempt does not deal correctly with rewrite rules that\nduplicate subterms. This paper fills the gap in the literature, explaining the\ndifficulty with a previous proof attempt, and showing how to extend the\n$\\top\\top$-lifting approach of Lindley and Stark to accommodate duplicating\nrewrites. We also show how to extend the proof to a recently-introduced\ncalculus for heterogeneous queries mixing set and multiset semantics.","PeriodicalId":314387,"journal":{"name":"Log. Methods Comput. Sci.","volume":"82 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2020-11-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"7","resultStr":"{\"title\":\"Strongly Normalizing Higher-Order Relational Queries\",\"authors\":\"W. Ricciotti, J. Cheney\",\"doi\":\"10.46298/lmcs-18(3:23)2022\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Language-integrated query is a powerful programming construct allowing\\ndatabase queries and ordinary program code to interoperate seamlessly and\\nsafely. Language-integrated query techniques rely on classical results about\\nthe nested relational calculus, stating that its queries can be algorithmically\\ntranslated to SQL, as long as their result type is a flat relation. Cooper and\\nothers advocated higher-order nested relational calculi as a basis for\\nlanguage-integrated queries in functional languages such as Links and F#.\\nHowever, the translation of higher-order relational queries to SQL relies on a\\nrewrite system for which no strong normalization proof has been published: a\\nprevious proof attempt does not deal correctly with rewrite rules that\\nduplicate subterms. This paper fills the gap in the literature, explaining the\\ndifficulty with a previous proof attempt, and showing how to extend the\\n$\\\\top\\\\top$-lifting approach of Lindley and Stark to accommodate duplicating\\nrewrites. We also show how to extend the proof to a recently-introduced\\ncalculus for heterogeneous queries mixing set and multiset semantics.\",\"PeriodicalId\":314387,\"journal\":{\"name\":\"Log. Methods Comput. Sci.\",\"volume\":\"82 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2020-11-26\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"7\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Log. Methods Comput. Sci.\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.46298/lmcs-18(3:23)2022\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Log. Methods Comput. Sci.","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.46298/lmcs-18(3:23)2022","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
Language-integrated query is a powerful programming construct allowing
database queries and ordinary program code to interoperate seamlessly and
safely. Language-integrated query techniques rely on classical results about
the nested relational calculus, stating that its queries can be algorithmically
translated to SQL, as long as their result type is a flat relation. Cooper and
others advocated higher-order nested relational calculi as a basis for
language-integrated queries in functional languages such as Links and F#.
However, the translation of higher-order relational queries to SQL relies on a
rewrite system for which no strong normalization proof has been published: a
previous proof attempt does not deal correctly with rewrite rules that
duplicate subterms. This paper fills the gap in the literature, explaining the
difficulty with a previous proof attempt, and showing how to extend the
$\top\top$-lifting approach of Lindley and Stark to accommodate duplicating
rewrites. We also show how to extend the proof to a recently-introduced
calculus for heterogeneous queries mixing set and multiset semantics.