Goblin

Goblin - Python Object Graph Mapper for the TinkerPop3 Gremlin Server

As Gremlin approached The TinkerPop, mogwai felt left behind and the closer he got, the more his world dissolved. He realized that all that he realized was just a realization and that all realized realizations are just as real as the need to evolve into something else - goblin was born...

Releases

The latest release of Goblin is 0.2.1 (coming soon).

Requirements

Goblin uses gremlinclient to communicate with the Gremlin Server, and can use a variety of client/library combinations that work with different versions of Python. See the gremlinclient docs for more information.

Tornado

  • Python 2.7+

aiohttp

  • Python 3.4+

Tornado w/Asyncio

  • Python 3.3+

Tornado w/Trollius

  • Python 2.7

Goblin aims to provide full support for all TinkerPop3 enabled graph databases; however, it is currently only tested against Titan:db 1.x. This project is under active development, and early releases should be considered alpha as the API is not yet entirely stable.

Installation

Install using pip:

$ pip install goblin

Getting Started

A simple example using the default Tornado client with Python 2.7+:

from tornado import gen
from tornado.ioloop import IOLoop
from goblin import properties
from goblin import connection
from goblin.models import Vertex, Edge, V


class User(Vertex):
    name = properties.String()


class Follows(Edge):
    pass


@gen.coroutine
def go():
    goblin = yield User.create(name="Goblin")
    gremlin = yield User.create(name="Gremlin")
    gob_follows_grem = yield Follows.create(goblin, gremlin)
    # Find Gremlin's followers
    stream = yield V(gremlin).in_step().get()  # `in` is a reserved word
    followers = yield stream.read()
    return followers


connection.setup("ws://localhost:8182")
loop = IOLoop.current()
try:
  followers = loop.run_sync(go)
finally:
  loop.close()
  connection.tear_down()

Indices and tables