Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-12-2020 07:07 PM
def get_nlg(graph_query):
driver = Graph("neo4j://localhost:7687", auth=("neo4j","password"))
graph_response = graph.evaluate(graph_query)
For the above code, I replaced with the driver code as below, but its not working, what is the function in neo4j driver that perform operations and provide the result as same as evaluate() function in py2neo?
evaluate(cypher, parameters=None, **kwparameters)[source]
Run a Transaction.evaluate() operation within an autocommit Transaction.
Parameters:
cypher – Cypher statement
parameters – dictionary of parameters
Returns - first value from the first record returned or None.
Below is my code that replaced evaluate() with run() function, but not getting the expected result.
def get_nlg(graph_query):
driver = GraphDatabase.driver("neo4j://localhost:7687", auth=("neo4j","password"))
with driver.session() as session:
graph_response = session.run(graph_query)
return graph_response
When the result from graph_response of 2nd code is passed to the below code, I am getting an error TypeError: <neo4j.work.result.Result object at 0x7f94cf7f31d0> is not JSON serializable
class GetBiggestComponent(Action):
def name(self):
return "action_get_biggest_component"
def run(self, dispatcher, tracker, domain):
query = None
intent = tracker.latest_message['intent']
child_comp = tracker.get_slot('component_type_child')
parent_comp = tracker.get_slot('component_type_parent')
error = None
graph_response = GenerateQuery.get_biggest_component(child_comp, parent_comp)
graph_response['intent_name'] = intent['name']
dispatcher.utter_custom_message(graph_response)
return []
the error is coming when it is passed in the line dispatcher.utter_custom_message(graph_response)
All the sessions of the conference are now available online