Last active
August 29, 2015 14:03
-
-
Save elliottcordo/9bfd44c67863d5cfb250 to your computer and use it in GitHub Desktop.
neo4j rest client example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##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