我的Cypher FOREACH有什么不对吗?

时间:2014-07-31 18:07:55

标签: neo4j cypher

有人可以帮我理解我的Cypher查询错误吗

MATCH (sys:System{Name:'MYSYS' , Version:'1.0'})
FOREACH (item in [
  {
    itemObj: {
        ItemID: "DOMAIN",
        Name: "DOMAIN",
        TypeID: "",
        Physical: "",
        Logical: ""
        },
    parameters: {
        VERSIONNUM: "",
        QUALSTATE: "",
        VERSION: "",
        CREATEDBY: "",
        DATECREATED: "",
        MODIFIEDBY: "",
        VERSIONDATE: "",
        BLCKCOMMENT1: "",
        BLCKCOMMENT2: "",
        BLCKCOMMENT3: "",
        BLCKCOMMENT4: "",
        ORIGASSIGN: "",
        CANETYPE: "",
        FULLITEMNAME: "",
        DESC: "",
        SCANPNTDTL: "",
        SCANASSOCDSP: "",
        ADSIPATH: "",
        ASSIGNABLE: ""
        }
    },
    {
    itemObj: {
        ItemID: "COMPUTERS",
        Name: "COMPUTERS",
        TypeID: "",
        Physical: "",
        Logical: ""
        },
    parameters: {
        VERSIONNUM: "",
        QUALSTATE: "",
        VERSION: "",
        CREATEDBY: "",
        DATECREATED: "",
        MODIFIEDBY: "",
        VERSIONDATE: "",
        BLCKCOMMENT1: "",
        BLCKCOMMENT2: "",
        BLCKCOMMENT3: "",
        BLCKCOMMENT4: "",
        ORIGASSIGN: "",
        CANETYPE: "",
        FULLITEMNAME: "",
        DESC: "",
        SCANPNTDTL: "",
        SCANASSOCDSP: "",
        ASSIGNABLE: ""
        }
    },
    {
    itemObj: {
        ItemID: ".htm",
        Name: ".htm",
        TypeID: "",
        Physical: "",
        Logical: ""
        },
    parameters: {
        FileName: ""
    }
  }
] | 
CREATE (p:Parameter) SET p=item.parameters 
MERGE (it:Item { ItemID: item.itemObj.ItemID}) ON CREATE SET it=item.itemObj 
MERGE (sys)-[HAS_ITEM]->(it)-[:HAS_PARAMETERS]->(p) )

我最终收到此错误

A single relationship type must be specified for CREATE (line 77, column 12)

我正在尝试学习在批量插入的情况下非常快速地使用foreach作为接缝,因此我们非常欢迎任何帮助。

此致 基兰

1 个答案:

答案 0 :(得分:2)

在声明关系类型时,您遗漏了:。在最后一行,[HAS_ITEM]应为[:HAS_ITEM]