Giter Site home page Giter Site logo

game-of-thrones's Introduction

Game of Graphs

Creating a Neo4j Graph Database (and more) based on Game of Thrones (A Song of Ice and Fire) data.

Data Source

Westeros data can be retrieved from An API of Ice And Fire by Joakim Skoog.

The repository contains the original JSON files, so we can use them directly.

GraphQL Setup

Schema

See got-schema.graphql

  • Person (name, titles, houses, ...)
  • House (name, allies, follows, followers, founder, words, ...)
  • Seat (name)
  • Region (name)

Spin up a Neo4j Sandbox with the data and push our schema file.

npm install -g neo4j-graphql-cli
neo4j-graphql got-schema.graphql

Data Import

Either run the content of the import scripts got-import.cypher in Neo4j Browser or via cypher-shell

# one of these
apt-get install cypher-shell

brew install cypher-shell

# and then
cypher-shell -a bolt://<sandbox-ip>:<bolt-port> -u neo4j -p <password> < got-import.cypher

# or using Docker

docker run -ti -p `pwd`:/import neo4j /bin/sh -c '/var/lib/neo4j/bin/cypher-shell -a bolt://<sandbox-ip>:<bolt-port> -u neo4j -p <password> < /import/got-import.cypher'

Queries

Via GraphiQL, instructions below copied from Neo4j Sandbox:

  1. Your GraphQL endpoint is available at https://<10-0-1-...-.....>.neo4jsandbox.com/graphql/. We use HTTP Basic Auth, so be sure to set an auth header: Authorization: Basic xYXcXCCXCXCXCXCXCXCXCXCX=

  2. Explore your GraphQL API with our hosted GraphiQL IDE.

Example GraphQL Query

{
  House(name: "House Stark of Winterfell") {
    name
    words
    founder {
      name
    }
    seats {
      name
    }
    region {
      name
    }
    follows {
      name
    }
    followers(first:10) {
      name
      seats { name }
    }
  }
}

  1. Visit the Neo4j Browser. You'll automatically be authenticated.

Example Cypher queries:

MATCH path = (p:Person {name:"Steffon Baratheon"})-[:PARENT_OF*]->()
RETURN path

Other Datasources

game-of-thrones's People

Contributors

jexp avatar

Stargazers

Aaron Gauthier avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.