0

Hi i'm very new to neo4j i need to know how to create nodes and properties of graph using html forms by using py2neo and neo4j and how to add auto id's to the nodes

from flask import Flask,render_template,request,url_for,json,jsonify
from py2neo import neo4j,Graph,Node,Relationship,cypher
from neo4jrestclient.client import GraphDatabase


app = Flask(__name__)
gdb = GraphDatabase("http://neo4j:duke@localhost:7474/db/data")
graph=Graph("http://neo4j:duke@localhost:7474/db/data")
@app.route('/')
def index():
    results = graph.cypher.execute("MATCH (n:Person) RETURN n")
'''print "gyktdjxdhgfcvkjbljkfr",result'''
    return results.json
@app.route('/hello')
def create():
    return "f"


if __name__ == '__main__':
app.run()
gokul
  • 133
  • 1
  • 9
  • What have you tried so far? Have you searched Google for relevant articles or tutorials? Do you have some code you've already put together that you need help with? – Mar Jun 17 '15 at 18:28
  • i tried creating nodes,properties and relationships via console and i have written some python code to view all the nodes but i cant view the nodes in browser by using return cmd but i print all nodes in terminal using print i have used flask server – gokul Jun 17 '15 at 18:53
  • Can you edit your question to add the code you have so far, please? Your question as it stands can't be answered. – Mar Jun 17 '15 at 19:13

1 Answers1

2

Check out this blog post by Nicole for some insight:

http://neo4j.com/blog/building-python-web-application-using-flask-neo4j/

code is on github:

https://github.com/nicolewhite/neo4j-flask

You don't need auto-incrementing id's like in a relational database. Just use the person's login for that and use MERGE

See. http://neo4j.com/developer/cypher

Michael Hunger
  • 41,339
  • 3
  • 57
  • 80