SlideShare a Scribd company logo
1
GraphQL Introduction
Serge Huber, Jahia CTO
shuber@jahia.com
#graphql
Make some noise
WHAT IS GRAPHQL ?
…and what it isn’t.
3
WHAT IS GRAPHQL ?
I like opposites
It is not:
• A query language like SQL, JCR-SQL, etc…
• A URL specification
• A finalized standard
• A standard submitted to a standards body
• A 100% JSON standard
• A mature standard, changes are still
happening
4
WHAT IS GRAPHQL ?
A (very) quick look
Courtesy of the GraphQL.org home page
5
WHAT IS GRAPHQL ?
Some users
Courtesy of the GraphQL.org home page
See more on http://graphql.org/users
6
WHAT IS GRAPHQL ?
A quick demo
https://www.graphqlhub.com
7
WHAT IS GRAPHQL ?
Schemas
• A schema that describes:
• Objects
• Object fields
• Field arguments & directives
• Interfaces
• Unions
8
WHAT IS GRAPHQL ?
Fields, the key to understanding GraphQL !
A field may be:
• a static value
• a value resolved through code
Field may have:
• Arguments that are like
parameters to a method call
• Constraints to filter data
• Directives that make the field
conditional in the result
Don’t think of fields as variables,
think of them as methods !
9
WHAT IS GRAPHQL ?
Queries
• Queries
• Specify what fields are part of the
result
• Only fields specified in the schema
are acceptable
• Field may be the result of
computations
• Fields may specify arguments that
will constrain the results (such as
id:10)
• Directives may also be used (such as
@include)
• Variables may be used
• Fragments
• Type casts !
• Pagination (Relay schema)
10
WHAT IS GRAPHQL ?
Mutations
• Mutations
• Make it possible to write/modify
data
• Very similar syntax to queries
11
WHAT IS GRAPHQL ?
Compared to REST APIs
REST GraphQL
Specifies URL structure YES NO
Specifies request /
response body structure
NO YES
Validation NO YES
Requires a declared
schema
NO YES
Key-Value friendly YES NO
Extra (non CRUD) methods
standardized
NO YES
GRAPHQL INTEGRATION
Mapping to existing stuff
13
GRAPHQL INTEGRATION
Typical architecture
Client
Server
React / React Native
Relay
GraphQL
Data & Services
14
GRAPHQL INTEGRATION
Relay
15
GRAPHQL INTEGRATION
Angular 2 and Relay
https://tech.small-improvements.com/2016/02/25/angular-2-and-relay/
16
GRAPHQL INTEGRATION
Java Libraries
• graphql-java : Java implementation of GraphQL
• graphql-java-servlet : A relay-compatible OSGI Java
servlet
• graphql-java-annotations : Can generate GraphQL
schemas from Pojo annotations !
GRAPHQL TOOLING
What there’s tooling already ?
18
GRAPHQL TOOLING
GraphiQL
19
GRAPHQL TOOLING
GraphiQL
Features
• Auto-completion based on GraphQL schema
• Execution of GraphQL queries and mutations
• Input of variables
• Result viewer
• Built-in documentation browser
20
GRAPHQL TOOLING
GraphQLHub
A hub to test public GraphQL
services such as :
• Hacker News
• Reddit
• GitHub
• Twitter
• Giphy
• Relay-compatible Key-
Value store
But (strangely) not Facebook
(probably because of API
keys)
21
GRAPHQL TOOLING
Awesome GraphQL
Best list of tools & libraries at :
https://github.com/chentsulin/awesome-graphql
Some cool examples:
SQL Libraries
• GraphpostgresQL - GraphQL for Postgres.
• sql-to-graphql - Generate a GraphQL API based on your SQL database
structure.
• PostGraphQL - A GraphQL schema created by reflection over a PostgreSQL
schema.
DX INTEGRATION DEMO
You’re not serious are you ?
23
DX INTEGRATION DEMO
The source
Project available here:
http://www.github.com/Jahia/graphql-core-feature
• Built as a Karaf features, requires DX 7.2 to run
• Embeds GraphiQL as an administration UI !
• Extensible through other modules, they simply provide query and mutation
providers !
• Dynamic schema, re-generated every time a new mutation or query provider is
registered in the OSGi services registry
• Based on the graphql-java-servlet project, available at:
http://www.github.com/graphql/graphql-java-servlet
• Still a lot to do, just beginning
• Code is clearly a proof of concept prototype, lots of things will need cleaning up
and refactoring
• Mapping to JCR content still to be defined.
24
QUESTIONS AND ANSWERS
Ask away, don’t be shy
25
shuber@jahia.com
THANK YOU FOR LISTENING

More Related Content

PPT
Graphql presentation
PDF
Intro to GraphQL
PPTX
Introduction to GraphQL
PDF
REST vs GraphQL
PPTX
Introduction to GraphQL
PDF
GraphQL
PDF
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
PPTX
An intro to GraphQL
Graphql presentation
Intro to GraphQL
Introduction to GraphQL
REST vs GraphQL
Introduction to GraphQL
GraphQL
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
An intro to GraphQL

What's hot (20)

PDF
Better APIs with GraphQL
PPTX
Introduction to graphQL
PDF
GraphQL: Enabling a new generation of API developer tools
PDF
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
PDF
Graphql
PPTX
Introduction to GraphQL Presentation.pptx
PDF
How to GraphQL
PDF
GraphQL Fundamentals
PDF
The Apollo and GraphQL Stack
PDF
GraphQL vs REST
PDF
React & GraphQL
PPTX
Understanding REST APIs in 5 Simple Steps
PDF
Introduction to GraphQL
PPTX
Attacking GraphQL
PPTX
GraphQL Introduction with Spring Boot
PDF
Introduction to GraphQL
PPTX
Api Testing
PDF
Java 17
PPSX
Rest api standards and best practices
PDF
How to GraphQL: React Apollo
Better APIs with GraphQL
Introduction to graphQL
GraphQL: Enabling a new generation of API developer tools
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Graphql
Introduction to GraphQL Presentation.pptx
How to GraphQL
GraphQL Fundamentals
The Apollo and GraphQL Stack
GraphQL vs REST
React & GraphQL
Understanding REST APIs in 5 Simple Steps
Introduction to GraphQL
Attacking GraphQL
GraphQL Introduction with Spring Boot
Introduction to GraphQL
Api Testing
Java 17
Rest api standards and best practices
How to GraphQL: React Apollo
Ad

Viewers also liked (9)

PDF
Jahia DX 7.2 : Bye bye felix, hello karaf
PDF
Introducing Apache Unomi - JavaOne 2015 Session
KEY
OSGi in 5 minutes
PDF
Introducing the Jahia Log Analyzer
PDF
Introduction to GraphQL
PDF
The Zero Bullshit Architecture
PDF
GraphQL Story: Intro To GraphQL
PDF
楽天のプライベートクラウドを支えるフラッシュストレージ
PDF
Java modularity: life after Java 9
Jahia DX 7.2 : Bye bye felix, hello karaf
Introducing Apache Unomi - JavaOne 2015 Session
OSGi in 5 minutes
Introducing the Jahia Log Analyzer
Introduction to GraphQL
The Zero Bullshit Architecture
GraphQL Story: Intro To GraphQL
楽天のプライベートクラウドを支えるフラッシュストレージ
Java modularity: life after Java 9
Ad

Similar to GraphQL Introduction (20)

PDF
GraphQL IndyJS April 2016
PDF
PPTX
GraphQL - The new "Lingua Franca" for API-Development
PDF
GraphQL and Relay Modern
PDF
GraphQL And Relay Modern
PDF
GraphQL And Relay Modern
PDF
Getting Started with Spring for GraphQL
PDF
A quick introduction to GraphQL
PPTX
GraphQL - Missing Link In REST
PDF
GraphQL for Native Apps
PDF
GraphQL ♥︎ GraphDB
PDF
Marco Liberati - Graph analytics
PDF
Spring GraphQL
PDF
Let's start GraphQL: structure, behavior, and architecture
PPTX
GraphQL @ Manc.JS (March 2018)
PDF
GraphQL + relay
PDF
GraphQL - A love story
PDF
Graphql usage
PPTX
GraphQL API Crafts presentation
PDF
Modern APIs with GraphQL
GraphQL IndyJS April 2016
GraphQL - The new "Lingua Franca" for API-Development
GraphQL and Relay Modern
GraphQL And Relay Modern
GraphQL And Relay Modern
Getting Started with Spring for GraphQL
A quick introduction to GraphQL
GraphQL - Missing Link In REST
GraphQL for Native Apps
GraphQL ♥︎ GraphDB
Marco Liberati - Graph analytics
Spring GraphQL
Let's start GraphQL: structure, behavior, and architecture
GraphQL @ Manc.JS (March 2018)
GraphQL + relay
GraphQL - A love story
Graphql usage
GraphQL API Crafts presentation
Modern APIs with GraphQL

More from Serge Huber (8)

PPTX
ApacheCon NA 2019 : Adding AI to customer segmentation using Apache Unomi and...
PPTX
ApacheCon NA 2019 : Customer segmentation and personalization using apache unomi
PPTX
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
PDF
DEVOXX FR 2016 We're Watching You (Apache Unomi)
PDF
UXDev Summit Keynote : A real world story of Angular and Apache Unomi integra...
PDF
Apache Unomi In Depth - ApacheCon EU 2015 Session
PPT
Webinar Présentation jahia en collaboration avec Developpez.com
PDF
Portets to composite applications
ApacheCon NA 2019 : Adding AI to customer segmentation using Apache Unomi and...
ApacheCon NA 2019 : Customer segmentation and personalization using apache unomi
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
DEVOXX FR 2016 We're Watching You (Apache Unomi)
UXDev Summit Keynote : A real world story of Angular and Apache Unomi integra...
Apache Unomi In Depth - ApacheCon EU 2015 Session
Webinar Présentation jahia en collaboration avec Developpez.com
Portets to composite applications

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
KodekX | Application Modernization Development
PDF
cuic standard and advanced reporting.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Empathic Computing: Creating Shared Understanding
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Big Data Technologies - Introduction.pptx
Review of recent advances in non-invasive hemoglobin estimation
Chapter 3 Spatial Domain Image Processing.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25 Week I
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KodekX | Application Modernization Development
cuic standard and advanced reporting.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Electronic commerce courselecture one. Pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Network Security Unit 5.pdf for BCA BBA.
Empathic Computing: Creating Shared Understanding
MIND Revenue Release Quarter 2 2025 Press Release
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Spectroscopy.pptx food analysis technology
Big Data Technologies - Introduction.pptx

GraphQL Introduction

  • 1. 1 GraphQL Introduction Serge Huber, Jahia CTO shuber@jahia.com #graphql Make some noise
  • 2. WHAT IS GRAPHQL ? …and what it isn’t.
  • 3. 3 WHAT IS GRAPHQL ? I like opposites It is not: • A query language like SQL, JCR-SQL, etc… • A URL specification • A finalized standard • A standard submitted to a standards body • A 100% JSON standard • A mature standard, changes are still happening
  • 4. 4 WHAT IS GRAPHQL ? A (very) quick look Courtesy of the GraphQL.org home page
  • 5. 5 WHAT IS GRAPHQL ? Some users Courtesy of the GraphQL.org home page See more on http://graphql.org/users
  • 6. 6 WHAT IS GRAPHQL ? A quick demo https://www.graphqlhub.com
  • 7. 7 WHAT IS GRAPHQL ? Schemas • A schema that describes: • Objects • Object fields • Field arguments & directives • Interfaces • Unions
  • 8. 8 WHAT IS GRAPHQL ? Fields, the key to understanding GraphQL ! A field may be: • a static value • a value resolved through code Field may have: • Arguments that are like parameters to a method call • Constraints to filter data • Directives that make the field conditional in the result Don’t think of fields as variables, think of them as methods !
  • 9. 9 WHAT IS GRAPHQL ? Queries • Queries • Specify what fields are part of the result • Only fields specified in the schema are acceptable • Field may be the result of computations • Fields may specify arguments that will constrain the results (such as id:10) • Directives may also be used (such as @include) • Variables may be used • Fragments • Type casts ! • Pagination (Relay schema)
  • 10. 10 WHAT IS GRAPHQL ? Mutations • Mutations • Make it possible to write/modify data • Very similar syntax to queries
  • 11. 11 WHAT IS GRAPHQL ? Compared to REST APIs REST GraphQL Specifies URL structure YES NO Specifies request / response body structure NO YES Validation NO YES Requires a declared schema NO YES Key-Value friendly YES NO Extra (non CRUD) methods standardized NO YES
  • 13. 13 GRAPHQL INTEGRATION Typical architecture Client Server React / React Native Relay GraphQL Data & Services
  • 15. 15 GRAPHQL INTEGRATION Angular 2 and Relay https://tech.small-improvements.com/2016/02/25/angular-2-and-relay/
  • 16. 16 GRAPHQL INTEGRATION Java Libraries • graphql-java : Java implementation of GraphQL • graphql-java-servlet : A relay-compatible OSGI Java servlet • graphql-java-annotations : Can generate GraphQL schemas from Pojo annotations !
  • 17. GRAPHQL TOOLING What there’s tooling already ?
  • 19. 19 GRAPHQL TOOLING GraphiQL Features • Auto-completion based on GraphQL schema • Execution of GraphQL queries and mutations • Input of variables • Result viewer • Built-in documentation browser
  • 20. 20 GRAPHQL TOOLING GraphQLHub A hub to test public GraphQL services such as : • Hacker News • Reddit • GitHub • Twitter • Giphy • Relay-compatible Key- Value store But (strangely) not Facebook (probably because of API keys)
  • 21. 21 GRAPHQL TOOLING Awesome GraphQL Best list of tools & libraries at : https://github.com/chentsulin/awesome-graphql Some cool examples: SQL Libraries • GraphpostgresQL - GraphQL for Postgres. • sql-to-graphql - Generate a GraphQL API based on your SQL database structure. • PostGraphQL - A GraphQL schema created by reflection over a PostgreSQL schema.
  • 22. DX INTEGRATION DEMO You’re not serious are you ?
  • 23. 23 DX INTEGRATION DEMO The source Project available here: http://www.github.com/Jahia/graphql-core-feature • Built as a Karaf features, requires DX 7.2 to run • Embeds GraphiQL as an administration UI ! • Extensible through other modules, they simply provide query and mutation providers ! • Dynamic schema, re-generated every time a new mutation or query provider is registered in the OSGi services registry • Based on the graphql-java-servlet project, available at: http://www.github.com/graphql/graphql-java-servlet • Still a lot to do, just beginning • Code is clearly a proof of concept prototype, lots of things will need cleaning up and refactoring • Mapping to JCR content still to be defined.
  • 24. 24 QUESTIONS AND ANSWERS Ask away, don’t be shy