【问题标题】:Neo4j: get index property 'name' in cypher query as a return valueNeo4j:在密码查询中获取索引属性“名称”作为返回值
【发布时间】:2013-05-12 16:36:14
【问题描述】:

您好,我是 neo4j 和 cypher 的新手。我已经建立了我的数据库,以便您可以从图表中的多个深度开始。在我的示例中,图是一棵树,根节点是索引,第 4 级的节点是索引。我正在使用 py2neo 开发图形,并按照以下方式使用 get_or_create_indexed_node 方法:py2neo documentation

patient_node = graph_db.get_or_create_indexed_node('patients', 'name',
patients[patient_id])

但是当我运行密码查询以使我登陆索引节点时,我只能获取 id。例如,当我这样做时:

start n=node:rootnode(name='root'), p=node:patients('name:*')
match n-[:chrm]-()-[:pos]-()-[:patient]-p-[:variant]->vars 
where (has(vars.mutations))  return p.name"

我收到错误消息: 节点上不存在属性“名称”[84361]

我做错了什么?

【问题讨论】:

    标签: neo4j cypher py2neo


    【解决方案1】:

    您没有提到要向从get_or_create_indexed_node 返回的节点添加任何属性。函数是get_or_create_indexed_node(index, key, value, properties=None),所以你提供的值只有索引名、键和值。

    你需要像这样创建节点:

    node = graph_db.get_or_create_indexed_node('patients', 
                                               'name', patients[patient_id], 
                                               patient_properties)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-22
      • 1970-01-01
      • 2012-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-18
      • 1970-01-01
      相关资源
      最近更新 更多