Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-17-2021 06:34 AM
Hello all,
I am a new user in the neo4j community. I have been wondering is there a way i could use java in the neo4j interface? I know i can use neo4j-driver and use neo4j in the java, but i would ideally want it the other way around.
I am using a remote graph database and i am applying graph algorithms. I want to modify the java graph algorithms source code, use the my updated code in neo4j browser or neuler.
Any help will be much appreciated
Thanks in advance, Andreas.
Solved! Go to Solution.
06-21-2021 06:41 AM
Hi,
about the remote database: Do you have access to the plugins folder of that remote database? If so, everything should work fine. If not, I don't know.
Concerning the steps:
Step 3 would be "replace the gds plugin in the 'plugins' folder of your database with your modified gds plugin" (this is replace the .jar file)
The rest is correct. Once you have replaced the plugin your modified procedure will be called when you call the louvain function.
In Neo4j Desktop you can open the plugins folder of your database like that:
06-18-2021 11:52 AM
Hi Andreas,
welcome to Neo4j!
To your question: Yes, this is possible. You can write your own user-defined procedures and functions or modify the existing algorithms. Let me give you some links on how to do that:
If you have any further questions, let me know
Regards,
Elena
06-21-2021 05:32 AM
So i am using the driver. For now i have managed to connect with database and apply very simple queries and obtain results in the java interface in type String. Is there a way i can see the results in visuals as well? Additionally i know where i can find the GDS algorithms, however is there a way i can run modified versions of them in neuler? My goal is to modify the Louvain algorithm and run my personal modified one and visualise the results.
06-21-2021 06:06 AM
Hi Andreas,
using the driver is not getting you where you want to go, I guess. What you are doing now, is probably something like:
try( Session session = driver.session()) {
String name = session.run("MATCH (a:Node {id: 4}) RETURN a.name AS name").single().get( "name").asString();
}
From here you are not able to deploy any user defined functions.
What you should do:
I am not sure if you are able to deploy it in NEuler...
06-21-2021 06:24 AM
Hey elena,
I am working with a remote database. Is this still a way to do it?
So if i understood correctly my goal can be done by applying the following steps:
If i understood the process correct and this is feasible. Then for me that i am working with the a remote database and not with one on my local system, is this still a solution and do where do i need to replace the GDS code?
06-21-2021 06:41 AM
Hi,
about the remote database: Do you have access to the plugins folder of that remote database? If so, everything should work fine. If not, I don't know.
Concerning the steps:
Step 3 would be "replace the gds plugin in the 'plugins' folder of your database with your modified gds plugin" (this is replace the .jar file)
The rest is correct. Once you have replaced the plugin your modified procedure will be called when you call the louvain function.
In Neo4j Desktop you can open the plugins folder of your database like that:
06-21-2021 05:16 AM
For GDS, and algorithms specifically, we actually offer a simplified API for implementing algorithms yourself: Pregel API - Neo4j Graph Data Science
If you want to look at the GDS source code, check out GitHub - neo4j/graph-data-science: Source code for the Neo4j Graph Data Science library of graph alg...
06-21-2021 05:34 AM
Is Pregel a way i write java scripts and then use it as a plugin? What i want to do is to modify an already existing algorithm (Louvain Modularity) and then run the modified algorithm in neuler and obtain and also visualise the results. Can i have some general guidance how to do this? I would prefer is their a video tutorial offered somewhere.
06-21-2021 08:22 AM
We have some video walk throughs of writing your own algorithms with Pregel: https://youtu.be/dBhj9IsTGfQ , as well as examples in our docs.
However, if your focus is on Louvain, it's easier to clone our library and modify the java code, then compile your own version of the plug in. The code sits here.
If you overwrite the existing Louvain procedure and don't change the signature (inputs or outputs), so you just have a different version of the GDS plug in, it should work with NEuler, but we don't guarantee that.
As @elena.kohlwey said above, though, you will need access to the plug ins folder for your instance to be able to deploy your modified version of GDS.
All the sessions of the conference are now available online