Closed merric closed 7 years ago
Hi @merric
Thanks for your interest in our modules.
In order to provide you an accurate answer, can you specify if you use SDN on your application side or does it run embedded on the neo4j server ?
It runs on the application side. I had no idea you can run spring embedded on the database server. But for our purpose all the app code is running and hits both a neo4j server and a mySql server that are remote. They are all installed on the same box and wired with docker.
Thanks @merric
So, basically the node object can be built dynamically, if you look at the recommendations app example : https://github.com/graphaware/recommendations-meetup/blob/master/src/main/java/com/graphaware/meetup/web/RecommendationController.java#L30
We create an http endpoint on the neo4j server itself, to which you can pass a parameter, can be a user name or a user id or whatever.
From this parameter we retrieve a node corresponding to it in the database pass this node to the recommendation engine
This means that on your application side, you would use an http client calling this endpoint and getting the recommendations results.
There is no built-in implementation with SDN4 though but since Neo4j 3.0, it is easily doable, the idea would be to replace the http endpoint by a stored procedure, and in SDN you could use a custom Cypher query making use of this stored procedure and mapping the query result to domain entities.
http://graphaware.com/neo4j/2016/04/06/mapping-query-entities-sdn.html
If you have a look at other open source modules we offer, like neo4j-timetree or neo4j-uuid we provide both http endpoints and store procedures sharing the same logic. It wouldn't make sense to provide a procedure in neo4j-reco because it is up to the user to create the recommendation logic.
I'm happy to share in the next days an example of an application running with SDN4 combined with a neo4j server providing recommendations via a stored procedure.
Also, you can share with us (publicly or privately) an exact use case and maybe more informations so we can help you better (christophe at graphaware dot com).
Cheers
Chris
@merric I already implemented an example of writing a procedure for calling the recommendation engine : https://github.com/graphaware/recommendations-meetup/pull/4/files
Thanks so much for your prompt replies @ikwattro,
Just so I have it cleared it seems like you must 'deploy' the recommendation engine app to the neo4j instance itself. That app will expose an endpoint with something like SpringMVC returning the results of the recommendations. Then my actual buisness app will make a call over the wire to the neo4j server hosting the recommender app?
Exactly ! I would recommend though to use the procedures way. You can then benefit of then combining it with sdn4.
Perfect! We'll get to work figuring that out. Doing a hackathon at work to try to green-light some new functionality and trying this stack out for our eCommerce platform. Really appreciate the help.
Hey @ikwattro ,
I was wondering if we could run this using the embedded SDN driver and somehow get the database from SDN to grab the node. Not enough experience with neo4j and today was the last day of the hackathon so was hoping to cobble something functional together. So far it seems like SDN removed all access to the database directly.
As you said, SDN4 doesn't provide access to the database service. But this is not a problem, you can use the same idea I explained by creating a procedure and using this procedure in your SDN custom query.
how do i get the procedure working if I am working with one .war? Does spring/neo4j pick up the @Procedure if everything is in one set of app code?
I don't really know regarding .war deployments, you best ask this on StackOverflow for example where Neo4j people can answer.
@merric Now that I think of it
If you use embedded, you have access anyway to the graph database service as you need to start / stop the embedded server manually.
So you can register the procedure after the start, like I do here in the demo :
Hey All,
I have neo4j running as a remote server and was trying to hook up your library to produce recommendations from that remote server. I'm using spring data neo4j to populate the data. Now trying to hook up the new engine I wrote I see I need to pass in Nodes, but I can not for the life of me figure out how to access the actual nodes or even where the configuration for the neo4j server is actually done. How does the recommendation engine take the Node object and get other nodes from the remote server?