论文标题

J-Logic:查询JSON的逻辑

J-Logic: a Logic for Querying JSON

论文作者

Hidders, Jan, Paredaens, Jan, Bussche, Jan Van den

论文摘要

我们提出了一个基于Datalog的逻辑框架,以研究查询JSON数据的基础。我们称为J-Logic的方法的主要特征是对路径的重视。路径是键的序列,用于访问嵌套JSON对象的树结构。 J-Logic还具有``包装''的手段,以从路径或子路径生成新键。带有递归的J-Logic在计算上是完整的,但是许多查询可以在没有递归(例如深层平等)的情况下表达。我们给出了必要的条件,即可在没有递归的情况下表达查询。我们的大多数结果都集中在JSON对象的确定性上,作为从键到值的部分函数。但是,由J-Logic程序定义的谓词可能无法正确描述对象。尽管如此,我们表明,J-Logic中的每个对象转换都可以使用中间结果中的对象来定义。此外,我们表明,当给出对象作为输入时,是否总是返回对象,这是可以决定的。关于包装,我们表明,如果输出不需要新密钥,则不需要打包。最后,我们展示了查询遏制对积极的非叙事J-Logic程序的可决定性。

We propose a logical framework, based on Datalog, to study the foundations of querying JSON data. The main feature of our approach, which we call J-Logic, is the emphasis on paths. Paths are sequences of keys and are used to access the tree structure of nested JSON objects. J-Logic also features ``packing'' as a means to generate a new key from a path or subpath. J-Logic with recursion is computationally complete, but many queries can be expressed without recursion, such as deep equality. We give a necessary condition for queries to be expressible without recursion. Most of our results focus on the deterministic nature of JSON objects as partial functions from keys to values. Predicates defined by J-Logic programs may not properly describe objects, however. Nevertheless we show that every object-to-object transformation in J-Logic can be defined using only objects in intermediate results. Moreover we show that it is decidable whether a positive, nonrecursive J-Logic program always returns an object when given objects as inputs. Regarding packing, we show that packing is unnecessary if the output does not require new keys. Finally, we show the decidability of query containment for positive, nonrecursive J-Logic programs.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源