我正在使用 NEO4J apoc.refactor.setType 更改关系的 rel 类型,但运气不好
I am using NEO4J apoc.refactor.setType to change the rel type of a relationship with no luck
I am trying to change the rel type of a relationship as outlined below and getting the following error:
Neo.ClientError.Statement.SyntaxError: Procedure call inside a query does not support naming results implicitly (name explicitly using `YIELD` instead) (line 4, column 22 (offset: 224))
" call apoc.refactor.setType(r, 'OWNED')"
如果添加 YIELD 是答案,我不确定 YIELD 是什么??
MATCH (user:Owner {email: "xyz@mymail.com"})-[r:OWNS]->(v:Vehicles {name:"Chevy"})
WHERE r.model = "Silverado" OR NOT EXISTS(r.model)
WITH r,user,v
call apoc.refactor.setType(r, 'OWNED')
YIELD ?????
RETURN user,r,v
您可以使用 apoc.help 过程来查看 APOC 函数的签名。例如这条语句的结果:
CALL apoc.help("apoc.refactor.setType")
是:
╒═══════════╤══════════════════╤══════════════════╤══════════════════╤═══════╤════════╕
│"type" │"name" │"text" │"signature" │"roles"│"writes"│
╞═══════════╪══════════════════╪══════════════════╪══════════════════╪═══════╪════════╡
│"procedure"│"apoc.refactor.set│"apoc.refactor.set│"apoc.refactor.set│null │null │
│ │Type" │Type(rel, 'NEW-TYP│Type(relationship │ │ │
│ │ │E') change relatio│:: RELATIONSHIP?, │ │ │
│ │ │nship-type" │newType :: STRING?│ │ │
│ │ │ │) :: (input :: INT│ │ │
│ │ │ │EGER?, output :: R│ │ │
│ │ │ │ELATIONSHIP?, erro│ │ │
│ │ │ │r :: STRING?)" │ │ │
└───────────┴──────────────────┴──────────────────┴──────────────────┴───────┴────────┘
因此,apoc.refactor.setType
具有以下可屈服变量:input
、output
和 error
。
这个查询应该适合你:
MATCH (user:Owner {email: "xyz@mymail.com"})-[r:OWNS]->(v:Vehicles {name:"Chevy"})
WHERE r.model = "Silverado" OR NOT EXISTS(r.model)
CALL apoc.refactor.setType(r, 'OWNED') YIELD output
RETURN user, output AS r, v
I am trying to change the rel type of a relationship as outlined below and getting the following error:
Neo.ClientError.Statement.SyntaxError: Procedure call inside a query does not support naming results implicitly (name explicitly using `YIELD` instead) (line 4, column 22 (offset: 224))
" call apoc.refactor.setType(r, 'OWNED')"
如果添加 YIELD 是答案,我不确定 YIELD 是什么??
MATCH (user:Owner {email: "xyz@mymail.com"})-[r:OWNS]->(v:Vehicles {name:"Chevy"})
WHERE r.model = "Silverado" OR NOT EXISTS(r.model)
WITH r,user,v
call apoc.refactor.setType(r, 'OWNED')
YIELD ?????
RETURN user,r,v
您可以使用 apoc.help 过程来查看 APOC 函数的签名。例如这条语句的结果:
CALL apoc.help("apoc.refactor.setType")
是:
╒═══════════╤══════════════════╤══════════════════╤══════════════════╤═══════╤════════╕
│"type" │"name" │"text" │"signature" │"roles"│"writes"│
╞═══════════╪══════════════════╪══════════════════╪══════════════════╪═══════╪════════╡
│"procedure"│"apoc.refactor.set│"apoc.refactor.set│"apoc.refactor.set│null │null │
│ │Type" │Type(rel, 'NEW-TYP│Type(relationship │ │ │
│ │ │E') change relatio│:: RELATIONSHIP?, │ │ │
│ │ │nship-type" │newType :: STRING?│ │ │
│ │ │ │) :: (input :: INT│ │ │
│ │ │ │EGER?, output :: R│ │ │
│ │ │ │ELATIONSHIP?, erro│ │ │
│ │ │ │r :: STRING?)" │ │ │
└───────────┴──────────────────┴──────────────────┴──────────────────┴───────┴────────┘
因此,apoc.refactor.setType
具有以下可屈服变量:input
、output
和 error
。
这个查询应该适合你:
MATCH (user:Owner {email: "xyz@mymail.com"})-[r:OWNS]->(v:Vehicles {name:"Chevy"})
WHERE r.model = "Silverado" OR NOT EXISTS(r.model)
CALL apoc.refactor.setType(r, 'OWNED') YIELD output
RETURN user, output AS r, v