GithubHelp home page GithubHelp logo

adventure-time's Introduction

adventure-time

Install Cayley for Linux Destro

curl -L https://github.com/google/cayley/releases/download/v0.4.1/cayley_0.4.1_linux_amd64.tar.gz | tar xz
sudo cp cayley_0.4.1_linux_amd64/cayley /usr/local/bin/
rm -r cayley_0.4.1_linux_amd64

Install Cayley from source

mkdir -p ~/cayley && cd ~/cayley
export GOPATH=`pwd`
export PATH=$PATH:~/cayley/bin
mkdir -p bin pkg src/github.com/google
cd src/github.com/google
git clone https://github.com/google/cayley
cd cayley
go get github.com/tools/godep
godep restore
go build ./cmd/cayley
cp ./cayley /usr/local/bin

Run

cayley init --config=cayley.cfg
cayley load --config=cayley.cfg --quads=db.nq
cayley repl --config=cayley.cfg
cayley http --config=cayley.cfg

Queries

Find everyone that Ice King has a crush on

g.V("character:ice-king").Out("has a crush on").All()

{
  "result": [ {
      "id": "character:marceline-abadeer"
    },
    {
    "id": "character:princess-bubblegum"
    }
  ]
}

Find everyone that have a crush on Princess Bubblegum

g.V("character:princess-bubblegum").In("has a crush on").All()

{
  "result": [ {
      "id": "character:ice-king"
    }
  ]
}

Find all the haters

g.V().In("hates").All()

{
  "result": [
    {
    "id": "character:lumpy-space-princess",
    },
    {
    "id": "character:bmo",
    },
    {
    "id": "character:marceline-abadeer",
    },
    {
    "id": "character:finn",
    },
    {
    "id": "character:lady-rainicorn",
    },
    {
    "id": "character:princess-bubblegum",
    },
    {
    "id": "character:jake",
    }
  ]
}

Find all the haters (and tag who they hate)

g.V().Tag("name").In("hates").All()

{
"result": [
  {
  "id": "character:lumpy-space-princess",
  "name": "character:ice-king"
  },
  {
  "id": "character:bmo",
  "name": "character:ice-king"
  },
  {
  "id": "character:marceline-abadeer",
  "name": "character:ice-king"
  },
  {
  "id": "character:finn",
  "name": "character:ice-king"
  },
  {
  "id": "character:lady-rainicorn",
...

Who hates Ice King?

g.V().Has("hates", "character:ice-king"").All()

{
  "result": [
    {
    "id": "character:lumpy-space-princess"
    },
    {
    "id": "character:bmo"
    },
    {
    "id": "character:marceline-abadeer"
    },
    {
    "id": "character:finn"
    },
    {
    "id": "character:lady-rainicorn"
    },
    {
    "id": "character:princess-bubblegum"

Find all haters that lives with BMO

haters = g.V().In("hates")
lives_with_bmo = g.V("character:bmo").In("lives with")
haters.And(lives_with_bmo).All()

{
  "result": [
    {
    "id": "character:finn"
    },
    {
    "id": "character:jake"
    }
  ]
}

adventure-time's People

Contributors

oren avatar

Watchers

 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.