cid b2d1ec6fc80033d2885efb29ed0630000a5170abde7e3f8e80f622c452d01ac6 · original · open access · via openalex
Title: Semantics and Complexity of GraphQL Authors: Olaf Hartig; Jorge Eduardo Pérez Pérez Venue: International World Wide Web Conference (WWW) Year: 2018 Canonical: doi:10.1145/3178876.3186014 URL: https://doi.org/10.1145/3178876.3186014 Collector: openalex OA: true ABSTRACT GraphQL is a recently proposed, and increasingly adopted, conceptual framework for providing a new type of data access interface on the Web. The framework includes a new graph query language whose semantics has been specified informally only. This has prevented the formal study of the main properties of the language. We embark on the formalization and study of GraphQL. To this end, we first formalize the semantics of GraphQL queries based on a labeled-graph data model. Thereafter, we analyze the language and show that it admits really efficient evaluation methods. In particular, we prove that the complexity of the GraphQL evaluation problem is NL-complete. Moreover, we show that the enumeration problem can be solved with constant delay. This implies that a server can answer a GraphQL query and send the response byte-by-byte while spending just a constant amount of time between every byte sent. Despite these positive results, we prove that the size of a GraphQL response might be prohibitively large for an internet scenario. We present experiments showing that current practical implementations suffer from this issue. We provide a solution to cope with this problem by showing that the total size of a GraphQL response can be computed in polynomial time. Our results on polynomial-time size computation plus the constant-delay enumeration can help developers to provide more robust GraphQL interfaces on the Web.