0
我還沒有找到關於此問題或在Neo4j手冊中發現任何評論。neo4j爲什麼在結果集中找不到起始節點?
該查詢返回起始節點:
start n = node:node_auto_index(subject_id='A1')
match (n)-[]->()<-[]-(n)
return distinct n.subject_id;
==> +--------------+
==> | n.subject_id |
==> +--------------+
==> | "A1" |
==> +--------------+
==> 1 row
但是這查詢不返回開始節點。有沒有什麼辦法讓它和其他匹配節點一起返回起始節點?
start n = node:node_auto_index(subject_id='A1')
match (n)-[]->()<-[]-(s)
where s.subject_id = 'A1'
return distinct s.subject_id;
==> +--------------+
==> | s.subject_id |
==> +--------------+
==> +--------------+
==> 0 row
只是要確定我有沒有語法正確,前面的查詢工作在比起始節點的其他節點:
start n = node:node_auto_index(subject_id='A1')
match (n)-[]->()<-[]-(s)
where s.subject_id = 'B2'
return distinct s.subject_id;
==> +--------------+
==> | s.subject_id |
==> +--------------+
==> | "B2" |
==> +--------------+
==> 1 row
謝謝,我明白了。擺脫關係觀點是具有挑戰性的。 – user3025434