Top Banner
An Introducon to GraphQL Tutorial at ISWC 2019, October 27, 2019 4. Fundamental Properes Olaf Harg a , Ruben Taelman b (a) Dept. of Computer and Informaon Science, Linköping University, Sweden (b) Ghent University – imec – IDLab, Belgium Joint work with Jorge Pérez from the Universidad de Chile Based on: O Hartig and J Pérez: Semantics and Complexity of GraphQL. In Proceedings of The Web Conference 2018 (WWW 2018).
58

4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

May 23, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

An Introduction to GraphQLTutorial at ISWC 2019, October 27, 2019

4. Fundamental PropertiesOlaf Hartiga, Ruben Taelmanb

(a) Dept. of Computer and Information Science, Linköping University, Sweden

(b) Ghent University – imec – IDLab, Belgium

Joint work with Jorge Pérezfrom the Universidad de Chile

Based on: O Hartig and J Pérez: Semantics and Complexity of GraphQL. In Proceedings of The Web Conference 2018 (WWW 2018).

Page 2: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

2An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Page 3: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

3An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Our Contributions in a Nutshell

Formal definition of the language

Study of computational complexity(the language admits really efficient evaluation methods)

Solution to the problem of large results

Page 4: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

4An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

How is the language defined in the spec?

Page 5: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

5An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

How is the language defined in the spec?

Page 6: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

6An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

How is the language defined in the spec?

Page 7: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

7An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

How is the language defined in the spec?

Page 8: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

8An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

How is the language defined in the spec?

Page 9: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

Formalization of GraphQL

Page 10: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

10An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

GraphQL Graphs (Our Formalization)

Page 11: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

11An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

GraphQL Graphs (Our Formalization)

Typed nodes

Page 12: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

12An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

GraphQL Graphs (Our Formalization)

Typed nodes

One special node

Page 13: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

13An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

GraphQL Graphs (Our Formalization)

Typed nodes

One special node

Node properties

Page 14: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

14An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

GraphQL Graphs (Our Formalization)

Typed nodes

One special node

Node properties

Edge properties

Page 15: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

15An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

GraphQL Graphs (Our Formalization)

Typed nodes

One special node

Node properties

Edge properties

We also formalize the notions of GraphQL schema and schema satisfaction based on this data model

Page 16: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

16An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

Page 17: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

17An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

⟦friends { name }⟧u =

Page 18: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

18An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

= friends: [ ]⟦friends { name }⟧u

Page 19: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

19An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

friends: [ { ⟦name⟧v} { ⟦name⟧w} ]=⟦friends { name }⟧u

Page 20: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

20An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

= friends: [ {name:R2-D2} {name:Han} ]⟦friends { name }⟧u

Page 21: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

21An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

⟦ ⟧hero[episode:EMPIRE] { friends {name} }

Page 22: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

22An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

⟦ ⟧rhero[episode:EMPIRE] { friends {name} }

Page 23: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

23An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

⟦ ⟧rhero[episode:EMPIRE] { friends {name} } = hero: { ⟦ friends {name} ⟧u }

Page 24: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

24An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Formalization of Query Evaluation Function

⟦ ⟧rhero[episode:EMPIRE] { friends {name} } = hero: { ⟦ friends {name} ⟧u }

= hero: { friends: [ {name:R2-D2} {name:Han} ] }

Page 25: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

Complexity Analysis

Evaluation Problem

Page 26: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

26An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Evaluation Problem of GraphQL

GraphQL query qGraphQL graph G

data value d

yes no

Does d occur in theresult of q over G?

Does d occur in theresult of q over G?

Page 27: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

27An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Complexity ClassesP

SP

AC

E

NP

P

Page 28: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

28An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Complexity of Evaluation ProblemsP

SP

AC

E

NP

P

Relational Algebra

SPARQL Conjunctive Queries

BGPs (SPARQL)

Page 29: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

29An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Complexity of Evaluation ProblemsP

SP

AC

E

NP

P NL

GraphQL

Relational Algebra

SPARQL Conjunctive Queries

BGPs (SPARQL)

Page 30: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

Complexity Analysis

Enumeration Problem

Page 31: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

31An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Non-Redundancy

hero {name: Lukefriends: [

{ name: R2-D2}{ name: Han}

]id: 1000name: Lukefriends: [

{ id: 2001}{ id: 1002}

]}

hero(episode: EMPIRE) {namefriends {

name}idnamefriends {

id}

}

Valid query Invalid result

Page 32: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

32An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Non-Redundancy

hero(episode: EMPIRE) {namefriends {

name}idnamefriends {

id}

}

Valid query

hero {name: Lukefriends: [

{ name: R2-D2 Id: 2001 }{ name: Han Id: 1002 }

]id: 1000

}

Fields are collected before answering

Correct result

Page 33: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

33An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Non-Redundancy

hero {name: Lukefriends: [

{ name: R2-D2 Id: 2001 }{ name: Han Id: 1002 }

]id: 1000

}

hero(episode: EMPIRE) {namefriends {

nameid

}id

}

Fields are collected before answering

Non-redundant query Correct result

Page 34: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

34An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Another Complication: Type Restrictions

hero(episode: EMPIRE) {namefriends {

on Droid { name }on Human { id }name

}}

Valid query Invalid result

hero {name: Lukefriends: [

{ name: R2-D2 name: R2-D2 }{ id: 1002 name: Han }

]}

Page 35: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

35An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Another Complication: Type Restrictions

hero(episode: EMPIRE) {namefriends {

on Droid { name }on Human { id }name

}}

Valid query Correct result

hero {name: Lukefriends: [

{ name: R2-D2 }{ id: 1002 name: Han }

]}

Page 36: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

36An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Another Complication: Type Restrictions

hero(episode: EMPIRE) {namefriends {

on Droid { name }on Human { id name }

}}

Valid query Correct result

hero {name: Lukefriends: [

{ name: R2-D2 }{ id: 1002 name: Han }

]}

Page 37: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

37An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Ground-Typed Normal Form

hero(episode: EMPIRE) {namefriends {

on Droid { name }on Human { id name }

}}

Ground-typed query Correct result

hero {name: Lukefriends: [

{ name: R2-D2 }{ id: 1002 name: Han }

]}

Page 38: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

38An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Eliminating Redundancies

Rewriting rules for queries

Every GraphQL query q can be rewritteninto a query q’ that is i) non-redundant andii) in ground-typed normal form, such that q ≡ q’

Advantage: field collection is not needed for non-redundant queries in ground-typed NF

Page 39: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

39An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Now to the Enumeration Problem

Let q be i) non-redundant andii) in ground-typed normal form

Result of q can be produced symbol by symbol with only constant time between symbols

Time to produce the complete query resultdepends linearly on the size of this result

hero { friends: [ { name:R2-D2} ] }

Page 40: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

Complexity Analysis

Result Size

Page 41: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

41An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Results of GraphQL queries can be huge

start { knows { knows { … { knows { name } }… } } }

Alice appears 2N times in the result

2N times

Page 42: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

42An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Huge results in practice: Github’s GraphQL API

Owners of first five repos that user “danbri” contributes to, and the owners of first five repos that they contribute to, and so on...

Page 43: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

43An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result sizes can be computed efficiently!!!

Let q be i) non-redundant andii) in ground-typed normal form

Time to compute the size of the resultof q over a graph G depends linearly onthe product (size of q) × (size of G)

We provide an algorithm thatachieves this complexity bound

Page 44: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

44An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Proposal for GraphQL Servers

First, compute the size of the result.

If too big, reject query.

Else, inform the size to the client, and

Send the result byte by byte.

(or use the size as basis of a billing model)

Page 45: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

Summary

Page 46: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

46An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Our Results in a Nutshell

Formal definition of the language● Property Graph-like data model● Formal query semantics

Study of computational complexity(the language admits really efficient evaluation methods)

● Evaluation problem is NL-complete● Enumeration of results is linear

Solution to the problem of large results● Efficient algorithm to compute result size

Olaf Hartig and Jorge Pérez: Semantics and Complexity of GraphQL. In The Web Conference 2018.

Page 47: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

www.liu.se

Page 48: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

Backup Slides

Page 49: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

49An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

q2 q3

start: { … … }

Result:

Page 50: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

50An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

size(q2 ,u) = size(q3 ,u) =

q3q2

Page 51: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

51An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

q3

size(q2 ,u) = 4 + size(q4 ,v) size(q3 ,u) =

q4

q2

Page 52: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

52An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

q3

size(q2 ,u) = 4 + size(q4 ,v) size(q3 ,u) =

q5

size(q4 ,v) = 4 + size(q5 ,w)

q4

q2

Page 53: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

53An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

q3

size(q2 ,u) = 4 + size(q4 ,v) size(q3 ,u) =

q5

size(q4 ,v) = 4 + size(q5 ,w)

q4

size(q5 ,w) = 3

size(q5) = 3

q2

Page 54: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

54An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

q3

size(q2 ,u) = 4 + size(q4 ,v) size(q3 ,u) =

q5

size(q4 ,v) = 4 + size(q5 ,w) = 4 + 3 = 7

q4

size(q5 ,w) = 3

size(q4) = 7 size(q5) = 3

q2

Page 55: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

55An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

q3

size(q2 ,u) = 4 + size(q4 ,v) = 11 size(q3 ,u) =

q5

size(q4 ,v) = 4 + size(q5 ,w) = 4 + 3 = 7

q4

size(q5 ,w) = 3

size(q4) = 7 size(q5) = 3

size(q2) = 11

q2

Page 56: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

56An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

q3

size(q2 ,u) = 4 + size(q4 ,v) = 11 size(q3 ,u)= 4 + size(q4 ,v)

q5

size(q4 ,v) = 4 + size(q5 ,w) = 4 + 3 = 7

q4

size(q5 ,w) = 3

size(q4) = 7 size(q5) = 3

size(q2) = 11q4

q2

Page 57: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

57An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u)

q3

size(q2 ,u) = 4 + size(q4 ,v) = 11 size(q3 ,u)= 4 + size(q4 ,v) = 4 + 7 = 11

q5

size(q4 ,v) = 4 + size(q5 ,w) = 4 + 3 = 7

q4

size(q5 ,w) = 3

size(q4) = 7 size(q5) = 3

q4

size(q2) = 11size(q3) = 11

q2

Page 58: 4. Fundamental Properties · An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query Language Tutorial at ISWC 2019, October 27, 2019 Olaf Hartig ... Github’s

58An Introduction to GraphQL 4. Fundamental Properties of the GraphQL Query LanguageTutorial at ISWC 2019, October 27, 2019 Olaf Hartig

Result-Size Computation

start { advisor { univ { name } } friend { univ { name } } }

size(q, r) = 4 + size(q2 ,u) + size(q3 ,u) = 26

q3

size(q2 ,u) = 4 + size(q4 ,v) = 11 size(q3 ,u)= 4 + size(q4 ,v) = 4 + 7 = 11

q5

size(q4 ,v) = 4 + size(q5 ,w) = 4 + 3 = 7

q4

size(q5 ,w) = 3

size(q4) = 7 size(q5) = 3

size(q2) = 11size(q3) = 11 q4

q2

11 11