Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-12-2020 10:33 AM
Hi I am working with the visualization on eisman project. It is currently taking the data from a json file but I want to see if I can directly get the data from neo4j database which has real time data.
The following picture shows the end result.
Right now the code is pulling from json data file as mentioned above which is shown below.
There is also a function called Neo4jData which as per my understanding can get data(if provided) or get it directly from the database.
What I am trying to do is get the data directly from the neo4j database based on the query.
I have tried creating a app.js file which will use the bolt connection and graphql to connect, but it is not working and I am sure that I am doing it wrong, Is there a way to do it differently?
The following is the app.js file that I created.
Please Help!
02-13-2020 02:49 AM
What exactly isn't working? What kinds of errors are you getting?
02-14-2020 03:00 AM
Yes, You can use neo4jData
instated neo4jDataUrl. Also you can use neo4jd3.updateWithNeo4jData(newdata);
to update the existing graph. Posting you files from working example of my angular app. To get the expected data for neo4jd3.js from neo4j, you should use 'resultDataContents': ['graph']
while creating statement.
neo4jd3.component (3).txt (2.2 KB) neo4jd3.component.txt (42 Bytes)
02-14-2020 06:22 AM
Thank you so much for your help.
11-25-2020 09:59 AM
Hi, how you solve the problem? i want use neo4jdata instead of neo4jdataurl.
I using python to read data from neo4 database and send the data to javascript.
def get_movies_of(tx, name):
friends = []
result = tx.run("MATCH (a:Person{name:$name})"
"-[:ACTED_IN]->(listMovie) "
"RETURN a,listMovie as listMovies,id(a),id(listMovie)", name=name).data()
#MATCH (tom:Person {name: "Tom Hanks"})-[:ACTED_IN]->(tomHanksMovies) RETURN tom,tomHanksMovies
print(result)
for record in result:
mv.append(record["listMovies"])
return mv
@app.route("/list_movie", methods=['POST'])
def hello2():
rf=request.form
print(rf)
for key in rf.keys():
data=key
#print(data)
data_dic=json.loads(data)
print(data_dic.keys())
name_d = data_dic['name'][0]
print("Read data.....................")
print(name_d)
with driver.session() as session:
friends = session.read_transaction(get_movies_of, name_d)
jsonStr = json.dumps(friends)
#print json string
print(jsonStr)
#for friend in friends:
#print(friend)
driver.close()
resp_dic={'mov_str':jsonStr,'msg':'Success!'}
resp = jsonify(resp_dic)
resp.headers['Access-Control-Allow-Origin']='*'
print("Success process")
print(resp_dic)
return resp
All the sessions of the conference are now available online