[英]neo4j driver functions equivalent to py2neo functions
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 equivalent to evaluate() function in py2neo?对于上面的代码,我用下面的驱动程序代码替换,但它不起作用,neo4j驱动程序中的函数相当于py2neo中的evaluate()函数是什么?
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当第二个代码的graph_response结果传递给下面的代码时,我收到一个错误
TypeError: <neo4j.work.result.Result object at 0x7f94cf7f31d0> is not JSON serializable类型错误:<neo4j.work.result.Result 对象在 0x7f94cf7f31d0> 不是 JSON 可序列化的
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)
There is no direct equivalent.没有直接的等价物。 You will need to run
a query and then select the first value from the first record returned.您需要run
查询,然后从返回的第一条记录中选择第一个值。 That is all that evaluate
does behind the scenes.这就是evaluate
在幕后所做的一切。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.