range of graph database use cases broadens and new
play

Range of graph database use cases broadens and new application - PowerPoint PPT Presentation

Range of graph database use cases broadens and new application requirements emerge One such requirement: solutions to specify rigid forms of logical schemas What does a valid instance has to look like? What constraints does it have


  1. ● Range of graph database use cases broadens and new application requirements emerge ● One such requirement: solutions to specify rigid forms of logical schemas – What does a valid instance has to look like? – What constraints does it have to satisfy? ● RDF has SHACL and ShEx ● Property Graphs? No commonly agreed-upon approach Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 1

  2. Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 2

  3. So what? ● GraphQL APIs are based on some form of schema ● Specified in a developer-friendly language Research Question: Can the GraphQL Schema Definition Language be repurposed to also define schemas for Property Graphs? Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 3

  4. Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg a , Jan Hidders b (a) Dept. of Computer and Informatjon Science, Linköping University, Sweden (b) currently unaffjliated

  5. Our Contributjons Approach to adopt the GraphQL SDL for Property Graph schemas, incl. formal definition of the approach Formalization of the notion of schema as captured by the GraphQL SDL Fundamental properties of the approach (validation problem is in AC 0 ; checking satisfiability of schemas is NP-hard and in PSPACE) Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 5

  6. GraphQL Schemas in a Nutshell

  7. GraphQL Schemas in a Nutshell declaration of an interface type declaration of an object type declaration of an object type and an implementation with its fields and their types with its fields and their types argument declaration of declaration of a union type a union type declaration of the query type (possible root fields of queries) Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 7

  8. Overview of the Approach

  9. Specifying Types of Nodes using Object Type Defjnitjons type User { … User Section } type Post { Post … } type Section { Section … User } Defines three types of nodes: nodes with the label User , ● nodes with the label Post , and nodes with the label Section We assume only one label per node – Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 9

  10. Specifying Node Propertjes using Field Defjnitjons that are based on scalar types login: "ali" type User { login: String! User Section nicknames: [String!]! } type Post { Post … } login: "bob23" type Section { Section nicknames: ["Bobby", "Bob"] … User } User nodes may have two properties, login and nicknames ● Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 10

  11. Constraints on Node Propertjes using Directjves login: "ali" type User @key(fields:["login"]) { login: String! @required User Section nicknames: [String!]! } type Post { Post … } login: "bob23" type Section { Section nicknames: ["Bobby", "Bob"] … User } User nodes may have two properties, login and nicknames ● login property required ● login property is a key (i.e., values must be unique) ● Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 11

  12. Specifying Types of Outgoing Edges using Field Defjnitjons that are based on object types login: "ali" type User @key(fields:["login"]) { login: String! @required User Section nicknames: [String!]! } author sec type Post { Post author: User! sec: [Section!]! sec } login: "bob23" type Section { Section nicknames: ["Bobby", "Bob"] … User } Post nodes may have an author edge pointing to a User node ● Post nodes may have several sec edges to Section nodes ● Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 12

  13. Constraints on Edge Types using Directjves login: "ali" type User @key(fields:["login"]) { login: String! @required User Section nicknames: [String!]! } author sec type Post { Post author: User! @required sec: [Section!]! @distinct @requiredForTarget sec } login: "bob23" type Section { Section nicknames: ["Bobby", "Bob"] … User } every Post node must have an (outgoing) author edge ● all sec edges of a Post node must point to different Section nodes ● every Section node must have at least one incoming sec edges ● Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 13

  14. Constraints on Edge Types using Directjves (cont'd) login: "ali" type User @key(fields:["login"]) { login: String! @required User Section nicknames: [String!]! } author sec type Post { Post author: User! sec: [Section!]! @distinct @requiredForTarget sec } login: "bob23" type Section { Section nicknames: ["Bobby", "Bob"] … User } @noloop : edges cannot connect a node with itself ● @uniqueForTarget : nodes that are target of a given edge type can ● have at most one incoming edge of this type Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 14

  15. Specifying Edges with Multjple Target Types using Unions name: "Alice" type Person { name: String! Person favoriteVehicle: Vehicle } favoriteVehicle … union Vehicle = Car | Motorcycle name: "Bob" Motor- Person cycle type Motorcycle { … } favoriteVehicle type Car { … } … Car Every Person node may have a favoriteVehicle edge ● pointing either to a Motorcycle node or to a Car node Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 15

  16. Specifying Edges with Multjple Target Types using Interfaces name: "Alice" type Person { name: String! Person favoriteVehicle: Vehicle } favoriteVehicle … interface Vehicle { … } name: "Bob" Motor- Person cycle type Motorcycle implements Vehicle { … } favoriteVehicle type Car implements Vehicle { … } … Car Every Person node may have a favoriteVehicle edge ● pointing either to a Motorcycle node or to a Car node Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 16

  17. Specifying Edge Propertjes using Field Argument Defjnitjons type Author { name: String! influencedBy(significance: Float): [Author!]! } name: "Bob" name: "Alice" influencedBy Author Author significance: 0.8 Every influencedBy edge (between Author nodes) may have ● a significance property with a floating point number as value Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 17

  18. Propertjes of the Approach

  19. Schema Validatjon Problem Definition: Given a Property Graph G and a GraphQL schema S , does G strongly satisfy S ? Theorem*: Under the assumption that – the set of scalar types is fixed and finite, and – the problem of deciding if a given scalar value is of a given scalar type is in AC 0 , the computational complexity of the schema validation problem is in AC 0 . *expressed more formally in the paper Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 19

  20. Not all schemas are satjsfjable type OT1 { Assume OT1 node n1 ● } n1 must have in-edge ● interface IT { from an OT2 node n2 hasOT1: OT1 @uniqueForTarget n1 must have in-edge } ● from an OT3 node n3 type OT2 implements IT { n1 can have at most hasOT1: [OT1] @requiredForTarget ● } one such in-edge type OT3 implements IT { thus, n2 = n3 , ● hasOT1: [OT1] @requiredForTarget which contradicts that } nodes can have only one label/type Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 21

  21. Object-Type Satjsfactjon Problem Definition: Given a GraphQL schema S and an object type ot in S , is there a Property Graph that strongly satisfy S and contains at least one node of type ot ? Theorem: The object-type satisfiability problem is NP-hard. Theorem: The object-type satisfiability problem is in PSPACE. Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 22

  22. Summary and Outlook

  23. Our Contributjons in a Nutshell Approach to adopt the GraphQL SDL for Property Graph schemas, incl. formal definition of the approach Formalization of the notion of schema as captured by the GraphQL SDL Fundamental properties of the approach ● validation problem is in AC 0 ● checking satisfiability of schemas is NP-hard and in PSPACE Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 24

  24. Future Work ● Characterize the computational complexity of schema satisfiability more precisely ● Approach to generate a GraphQL API based on an SDL-based Property Graph schema – Basis: the SDL-based Property Graph schema must be extended into a GraphQL API schema Defjning Property Graph Schemas by using the GraphQL Schema Defjnitjon Language Olaf Hartjg, Jan Hidders 25

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend