Skip to content

GraphQL

Peter Selby edited this page Jun 6, 2024 · 7 revisions

Table of Contents

Documentation

Pros and Cons

  • Cost to setup

    • Depends on technology stack - code generators can help but the development implies a lot of work if you don't use Zendro or Apollo already
    • Node.js package universe requires frequent maintenance
    • Security requires extra thought (Zendro comes with oauth2 and role-based authorization)
  • Pros

    • Spread data load
    • partial backups; integrate data; etc.
    • Zendro is available to generate code
    • GraphQL is good at solving the problems: data definition and data standardization; data integration from multiple diverse sources
    • supports MongoDB, Relational Databases, Amazon S3/Apache Hadoop File Clouds, Neo4J, Presto
    • generates interactive scientific plots when using the web interface
  • Cons

    • Challenges with finding and sorting data.
    • Not good at: non data centric web servers
    • Development is hard if you don't use code generators such as zendro (similar to scaffolding functions in ruby on rails etc.)
    • Space complexity for multi record read (or write) requests
    • Time complexity

Example use cases

  • Use Case

    • Use Case

FAIR Principles

  • Findability - Metadata and data should be easy to find for both humans and computers.

    • F1 - (Meta)data are assigned a globally unique and persistent identifier

      Uses Internationalized Resource Identifier (IRI) per node. It works for all types of network topology. The combination of physical location of the node in the data cloud + internal identifier (who are you/where do you live) = unique string pointing to the server. It also supports Global Object Identification for the data.

    • F4 - (Meta)data are registered or indexed in a searchable resource

      Data in each node must be sorted separately using cursor based pagination for read access

  • Accessibility - Once the user finds the required data, it should be clear how the data can be fully accessed.

    • A1 - (Meta)data are retrievable by their identifier using a standardized communications protocol

      Zendro provides a GraphQL API web interface, called GraphiQL, which is a Web Browser tool for writing, validating, and testing GraphQL queries.

    • A1.1 - The protocol is open, free, and universally implementable

      GraphQL services can be written in any language. Since we can't rely on a specific programming language syntax, like JavaScript, to talk about GraphQL schemas, we'll define our own simple language. We'll use the ""GraphQL schema language"" - it's similar to the query language, and allows us to talk about GraphQL schemas in a language-agnostic way. Existing support for different programming languages like Java Script, Go, PHP, Python, Scala, Ruby, Rust, etc. https://graphql.org/code/. The GraphQL API Queries are written in the GraphQL language, and the result (the data) is given back in JSON format.

  • Interoperability - The data should easily interoperate with other data, as well as applications for analysis, storage, and processing.

  • Reusability - Metadata and data should be well-described so that they can be replicated and/or combined in different settings.

    • R1 - (Meta)data are richly described with a plurality of accurate and relevant attributes

      The schema supports the detail description of edges, relations, etc