使用SET执行多个Cypher MATCH语句

时间:2017-01-25 05:34:34

标签: neo4j

请告诉我如何使用SET执行多个Cypher MATCH语句,供您参考我与您分享我的Cypher语句。

Match (XYZ_Security:MODEL { NodeID: 'd0401381-c1db-41e9-bf08-da686242b988' }) SET XYZ_Security.Name = 'XYZ_Security', XYZ_Security.IsLookup = 'False'
Match (CUSIP:FIELD { NodeID: 'b6210beb-8fa1-44dc-bd5d-53404dbbed83' }) SET CUSIP.Name = 'CUSIP', CUSIP.IsKeyMember = 'False', CUSIP.IsValueMember = 'False', CUSIP.DataType = 'string', CUSIP.LookupItem = '', CUSIP.ValidationExpressionText = 'CUSIP != null', CUSIP.ValidationExpressionValue = 'true'

Match (Sedol:FIELD { NodeID: 'cd5c972d-7ae9-4e03-ad52-20375261f8ef' }) SET Sedol.Name = 'Sedol', Sedol.IsKeyMember = 'False', Sedol.IsValueMember = 'False', Sedol.DataType = 'string', Sedol.LookupItem = '', Sedol.ValidationExpressionText = 'Sedol != null', Sedol.ValidationExpressionValue = 'true'

提前致谢。 问候, Shafeeque

1 个答案:

答案 0 :(得分:0)

除非用SET子句将它们分开,否则写操作(如MATCH)不能跟随读操作(如WITH)。所以,这会起作用(注意WITH子句如何传递被忽略的值,因为没有值需要传递):

MATCH (XYZ_Security:MODEL { NodeID: 'd0401381-c1db-41e9-bf08-da686242b988' })
SET
  XYZ_Security.Name = 'XYZ_Security',
  XYZ_Security.IsLookup = 'False'
WITH 1 AS ignored
MATCH (CUSIP:FIELD { NodeID: 'b6210beb-8fa1-44dc-bd5d-53404dbbed83' })
SET
  CUSIP.Name = 'CUSIP',
  CUSIP.IsKeyMember = 'False',
  CUSIP.IsValueMember = 'False',
  CUSIP.DataType = 'string',
  CUSIP.LookupItem = '',
  CUSIP.ValidationExpressionText = 'CUSIP != null',
  CUSIP.ValidationExpressionValue = 'true'
WITH 1 AS ignored
MATCH (Sedol:FIELD { NodeID: 'cd5c972d-7ae9-4e03-ad52-20375261f8ef' })
SET
  Sedol.Name = 'Sedol',
  Sedol.IsKeyMember = 'False',
  Sedol.IsValueMember = 'False',
  Sedol.DataType = 'string',
  Sedol.LookupItem = '',
  Sedol.ValidationExpressionText = 'Sedol != null',
  Sedol.ValidationExpressionValue = 'true'

或者,您可以先放置所有MATCH子句,然后放入所有SET子句。