Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-26-2020 02:22 AM
hello guys,
I want to make Neo4j the back end to one of my GUIs and I have no idea how to create a new graph or to import an existing graph.
I have tried the package "neo4jupyter" in "https://github.com/merqurio/neo4jupyter", but always get this issue: 'LabelSetView' object is not callable
then i watched a video on youtube "https://www.youtube.com/watch?v=3JMhX1sT98U&t=967s", that talks about Graph Databases for Python Users, unfortunately i still can't get it, i don't know how to install the script.vis package, so can't "from scripts.vis import draw" 😞
Thanks a lot if someone can help me !
Xido
02-26-2020 02:33 AM
HI @ichbinmei00,
If you want to store data from your GUI to neo4j then first thing you need to finalize what would be your front end and then according to that you should create connections.
we have so many drivers in neo4j to connect with neo4j.
could you please explain your use case to help better
02-26-2020 02:34 AM
emm, the problem is that, i want to show the node-graph from Neo4j to my Python GUI
02-26-2020 02:40 AM
@ichbinmei00 , as per my knowledge you can't visualize your graph with python GUI.
you can get the results from queries in python but for the visualization you need some JS libraries to visualize your data .
one of the simplest library to visualize you data in neovis.js.
You can go through the link yo understand better .
https://github.com/neo4j-contrib/neovis.js/
02-27-2020 08:30 AM
Here is a sample code you can use. I picked from the demo for neovis. It will work as long as you update the right credentials to connect.
With that you should have a visualization that may work for you.
<html>
<head>
<title>Neovis.js Simple Example</title>
<style type="text/css">
html, body {
font: 16pt arial;
}
#viz {
width: 900px;
height: 700px;
border: 1px solid lightgray;
font: 22pt arial;
}
</style>
<!-- FIXME: load from dist -->
<script src="https://rawgit.com/neo4j-contrib/neovis.js/master/dist/neovis.js"></script>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script type="text/javascript">
// define config car
// instantiate nodevis object
// draw
var viz;
function draw() {
var config = {
container_id: "viz",
server_url: "bolt://localhost:7687",
server_user: "neo4j",
server_password: "asdfgh123",
labels: {
//"Character": "name",
"Candidate": {
"caption": "name",
"size": "pagerank",
"community": "community"
//"sizeCypher": "MATCH (n) WHERE id(n) = {id} MATCH (n)-[r]-() RETURN sum(r.weight) AS c"
},
"State": {
"caption":"name",
},
"Party": {
"caption":"name",
},
"SeatID":{
"caption":"name",
"size": "votescast",
}
},
relationships: {
"CANDIDATE_OF": {
"thickness": "weight",
"caption": false
},
"IN_STATE":{
"thickness":"weight",
"caption":false
},
"PART_OF":{
"thickness":"weight",
"caption":false
},
},
initial_cypher: "match (s:SeatID)-[r:IN_STATE]-(st:State) return s,st,r"
};
viz = new NeoVis.default(config);
viz.render();
console.log(viz);
}
</script>
</head>
<body onload="draw()">
<div id="viz"></div>
Cypher query: <textarea rows="4" cols=50 id="cypher"></textarea><br>
<input type="submit" value="Submit" id="reload">
<input type="submit" value="Stabilize" id="stabilize">
</body>
<script>
$("#reload").click(function() {
var cypher = $("#cypher").val();
if (cypher.length > 3) {
viz.renderWithCypher(cypher);
} else {
console.log("reload");
viz.reload();
}
});
$("#stabilize").click(function() {
viz.stabilize();
})
</script>
</html>
02-27-2020 08:32 AM
BTW if you are using Python, you could use py2neo to connect to the neo4j db and insert / query data. buzz me if you need some sample code.
02-28-2020 01:36 PM
hi vignes,
thank u for ur code 😄
ye i use python and py2neo to make my GUI, i've already done the neo4j db
i want to show users the node-relationships-graph from neo4j direct in my gui, so i think i need a visualzation-tool to import these graph.
And i've tried "neo4jupyter" like i said above, but got always an issue, also haven't get any solution to this issue " TypeError: 'LabelSetView' object is not callable", emmm...that's why i'm so worried...
03-04-2020 12:59 AM
IF you look at the html i am using neovis.js as the visualization. You can integrate the html code in your own code to do the visualization. I can help you a bit more if you have a sample of your schema, so i can advise what would be the JS and HTML code to put in.
All the sessions of the conference are now available online