Querying Graphs with GraphQL

  • Published on
    18-Mar-2018

  • View
    165

  • Download
    5

DESCRIPTION

neo4j.com/developer Property Graph Model CAR name: âDanâ born: May 29, 1970 twitter: â@danâ name: âAnnâ born: Dec 5, 1975 since: Jan 10, 2011 brand: âVolvoâ model:…

Transcript

neo4j.com/developer Property Graph Model CAR name: âDanâ born: May 29, 1970 twitter: â@danâ name: âAnnâ born: Dec 5, 1975 since: Jan 10, 2011 brand: âVolvoâ model: âV70â LOVES LOVES LIVES WITH PERSON PERSON Whiteboard Model Is the Physical Model Cypher: Powerful & Expressive Graph Query Language MATCH (:Person { name:âDanâ} ) -[:LOVES]-> (:Person { name:âAnnâ} ) LOVES Dan Ann LABEL PROPERTY NODE NODE LABEL PROPERTY Use Neo4j like a regular backing database https://launchpad.graphql.com/3wzp7qnjv Or ... turn Neo4j into a native GraphQL backend 1. take GraphQL query 2. transform to Cypher 3. execute against graph 4. return results Based on ... what? Schema! Which schema? Neo4j is schema-free, so: [x] Use GraphQL Schema Neo4j is open source & extensible Letâs build an extension How hard can it be? Transform + project Query / Results Thank you! Introducing: neo4j-graphql Whatâs in the box? Basics Endpoint with basic auth host:port/graphql POST schema file run queries with params project results Cool Features generate & run single graph query auto generated mutations for types first, offset, orderBy, @relation lookup by any field fragments, unlimited nesting Power Up: @cypher computed fields custom mutations & queries parameter support Cool! How can I use it? npm install -g neo4j-graphql-cli neo4j-graphql [my.schema] movies.schema add superpower type Actor { totalMovies:Int @cypher(statement: "RETURN size( (this)-[:ACTED_IN]->(:Movie) ) as total") ... type Movie { similar:[Movie] @cypher(statement: "MATCH (this)-->(:Genre) github.com/neo4j-graphql graphql.communitygraph.org

Recommended

View more >