neo4j创建具有多个对象的节点

时间:2015-12-05 06:04:53

标签: neo4j cypher

我想创建一个具有多个对象的节点,如下面的某些内容,但是没有找到适当的语法?

CREATE (E:employee {
    id: 123, name: "Kamran", sal: 50000, deptno: [10, 11]
}, {
    id: 124, name: "Qutub", sal: 50000, deptno: [10, 11]
})

上面的neo4j给出了以下错误...

Invalid input ',': expected whitespace, ')' or a relationship pattern (line 3, column 3 (offset: 79))"}, {"^

 Neo.ClientError.Statement.InvalidSyntax

3 个答案:

答案 0 :(得分:3)

尝试:

UNWIND [{ id: 123, name: "Kamran", sal: 50000, deptno: [10, 11]}, { id: 124, name: "Qutub", sal: 50000, deptno: [10, 11]}] AS props
CREATE (e:Employee)
SET e=props

答案 1 :(得分:1)

我认为这可以解决你的问题

    CREATE (ee:person{name:"tahir",position:1}),
({name:"tahir",position:2})

答案 2 :(得分:0)

您可以更改数据模型,以便有单独的EmployeeName个节点,如:

CREATE
  (e:Employee {id: 987}),
  (e)-[:NAMED]->(:Name {id: 123, name: "Kamran", sal: 50000, deptno:[10, 11]}),
  (e)-[:NAMED]->(:Name {id: 124, name: "Qutub",  sal: 50000, deptno:[10, 11]});