0

我使用 py2neo 在 neo4j 中添加节点和关系。

创建与:

asno, = graphDB.create({"name":"ASNO:"+fields[8], "ASNO":fields[8]});
asno.add_labels("Network", "ASNO", continent);

在 python 中打印:ASNO:38023


但是,当我使用密码查询时:

查询 1. match (n) where n.name = "ASNO:38023" return n;

没有回报;

查询2. match (n) where n.name = "ASNO:\u00003\u00008\u00000\u00002\u00003\u0000" return n;

返回以下内容。

{ "table": [ { "n": { "name": "ASNO:\u00003\u00008\u00000\u00002\u00003\u0000", "ASNO": "\u00003\u00008\u00000\u00002\u00003\u0000" } } ], "graph": { "nodes": [ { "name": "ASNO:\u00003\u00008\u00000\u00002\u00003\u0000", "ASNO": "\u00003\u00008\u00000\u00002\u00003\u0000", "id": "906", "type": "Network" } ], "edges": [] }, "labels": [ "Network" ] }


在查询 1 方法中运行查询时,我需要帮助。感谢并感谢您的帮助。

4

1 回答 1

0

尝试使用 str() 函数将您的名称值强制为 ASCII。

nameval = str("ASNO:" + fields[8])

asno, = graphDB.create({"name":nameval, "ASNO":fields[8]})

asno.add_labels("Network", "ASNO", continent)
于 2014-09-18T13:36:55.337 回答