Skip to content

Instantly share code, notes, and snippets.

@elliottcordo
Last active August 29, 2015 14:03
Show Gist options
  • Save elliottcordo/9bfd44c67863d5cfb250 to your computer and use it in GitHub Desktop.
Save elliottcordo/9bfd44c67863d5cfb250 to your computer and use it in GitHub Desktop.
neo4j rest client example
##http://neo4j-rest-client.readthedocs.org/en/latest/info.html
import string
from neo4jrestclient.client import GraphDatabase
gdb = GraphDatabase("http://localhost:7474/db/data/")
items = open("/Users/elliottcordo/Downloads/ml-100k/u.item")
for row in items:
row = filter(lambda x: x in string.printable, row) #there are special characters that will screw things up
records = row.strip().split("|")
#print records[0], records [1]
gdb.nodes.create(id = 'i'+str(records[0]),name = records[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment