0

ノードが別のノードに対して 2 つのタイプの関係を持ち、3 番目のノードに対しては 1 つのタイプだけを持っているとします。たとえば、マニュアル ( http://docs.neo4j.org/chunked/milestone/query-match.html#match-match-by-multiple-relationship-types ) で、Node7 にも Node4 との追加の関係があるとします [監督] - ダグラスは同時に「アメリカ大統領」に出演し、監督しました。

関係ACTEDのタイプのみでnode7に関連するすべてのノードを(サイファーで)見つけ、追加の関係も含むそのようなACTED関連ノードを表示しない方法は?

4

1 に答える 1

1

これはどうですか?

start n=node(3084)
match n-[r]-m                     // might want to have direction?
with collect(r) as collr, m       // collect the relationships
where length(collr) = 1           // we only want nodes with 1 relationship
  and type(head(collr)) = "ACTED" // and the one relationship needs to be ACTED (I think it's actually ACTS_IN in the example dataset)
return m;
于 2013-06-21T03:33:25.647 に答える