neo4jのDBaas "GrapheneDB"からCypherでデータを取得するミニマムなサーバ。グラフDBの初体験にいかがでしょう?
from bottle import route, run, HTTPResponse
from neo4jrestclient.client import GraphDatabase
username = "REST USERNAME"
password = "REST PASSWORD"
# APIのurlはユーザごと異なるかもしれません。
# APIの情報はサービスの"connection"タブに集約されています。
url = "http://{0}:{1}@ictknowledgegraph.sb10.stations.graphenedb.com:24789/db/data/".format(username, password)
gdb = GraphDatabase(url)
@route('/test')
def test():
result = gdb.query("MATCH (m)-[r]-(n) RETURN m,r,n", data_contents=True)
res = HTTPResponse(status=200, body=str(result.rows))
res.set_header('Content-Type', 'application/json')
return res
run(host='localhost', port=8080, debug=True, reloader=True)