[Paper Review] Not Elimination and Witness Generation for JSON Schema
This paper presents an algebraic framework for JSON Schema that enables not-elimination and witness generation—key problems in schema reasoning. By introducing a minimal core algebra and extending it with operators to handle negation and recursion, the authors provide the first formal algorithm to eliminate negation and generate valid JSON instances for non-empty schemas, solving satisfiability and inclusion problems for the full language except for the uniqueItems keyword.
JSON Schema is an evolving standard for the description of families of JSON documents. JSON Schema is a logical language, based on a set of assertions that describe features of the JSON value under analysis and on logical or structural combinators for these assertions. As for any logical language, problems like satisfaction, not-elimination, schema satisfiability, schema inclusion and equivalence, as well as witness generation, have both theoretical and practical interest. While satisfaction is trivial, all other problems are quite difficult, due to the combined presence of negation, recursion, and complex assertions in JSON Schema. To make things even more complex and interesting, JSON Schema is not algebraic, since we have both syntactic and semantic interactions between different keywords in the same schema object. With such motivations, we present in this paper an algebraic characterization of JSON Schema, obtained by adding opportune operators, and by mirroring existing ones. We present then algebra-based approaches for dealing with not-elimination and witness generation problems, which play a central role as they lead to solutions for the other mentioned complex problems.
Motivation & Objective
- To address the lack of formal algebraic foundations for JSON Schema, which is non-algebraic due to syntactic and semantic keyword interactions.
- To solve the not-elimination problem—determining whether negation can be removed from schemas without loss of expressiveness.
- To develop a witness generation algorithm that produces valid JSON instances for non-empty schemas, enabling schema satisfiability and inclusion checks.
- To formalize and implement a solution that handles negation, recursion, and complex assertions in JSON Schema, which are known to complicate reasoning.
- To provide a foundation for reasoning about schema equivalence, inclusion, and consistency in practical data-centric applications.
Proposed method
- Introduce a core algebra based on a minimal set of JSON Schema assertions and combinators, ensuring no operator is definable from others.
- Enrich the core algebra with primitive operators to express complements of assertions that cannot be captured without negation.
- Design a not-elimination algorithm that rewrites schemas into equivalent forms without negation, using the enriched algebra.
- Develop a recursive witness generation algorithm that operates in passes over schema groups, tracking variable states (Empty, Open, Populated) to ensure termination via fixpoint convergence.
- Use monotonicity and finite state tracking to prove termination of witness generation, especially for object and array types.
- Base the witness generation process on typed groups and variable states, with detailed handling of recursive and nested structures.
Experimental results
Research questions
- RQ1Can negation be eliminated from all JSON Schema expressions without loss of expressiveness, and if not, which constructs require it?
- RQ2How can a formal, algorithmic witness generation process be defined for the full JSON Schema language, excluding only uniqueItems?
- RQ3What algebraic structure can capture the non-algebraic features of JSON Schema, such as keyword interactions and syntactic constraints?
- RQ4How can schema satisfiability and inclusion be reduced to witness generation and not-elimination?
- RQ5What formal guarantees (e.g., termination, correctness) can be provided for recursive schema reasoning in JSON Schema?
Key findings
- The paper proves that negation cannot be eliminated for all JSON Schema constructs, identifying specific assertions whose complements require negation.
- An extended algebra is proposed that includes primitive operators to express the missing complements, enabling a complete not-elimination algorithm.
- Witness generation is formally defined and proven to terminate via a minimal-fixpoint argument, ensuring correctness for all non-empty schemas except those involving uniqueItems.
- The approach reduces schema satisfiability and inclusion problems to witness generation and not-elimination, providing a unified foundation for reasoning.
- The method is formally grounded and designed for implementation, with a Java prototype currently in development.
- The approach outperforms prior work in schema normalization, which failed on 21,859 out of 23,480 real-world schemas due to unsupported recursion and negation.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.