user3205469
user3205469

Reputation: 1025

Neo4j: How to use Integer or String with special characters as Identifier/name for a Node

How to use Integer or String with special characters as Identifier/name for a Node.

For instance I wanted to create this Node with Label as Category:

CREATE (000-116880:CATEGORY {PartnerCode:"ABCD12345", MerchantCode:"XXXX_0001", Name:"XXXX ABCDE", Leaf:1, MerchantCategoryID:125})

Or

CREATE (1234:CATEGORY {PartnerCode:"ABCD12345", MerchantCode:"XXXX_0001", Name:"XXXX ABCDE", Leaf:1, MerchantCategoryID:125})

Both these statements fail. So in short, neither am I am able to use '000-116880' as Node name nor am I able to use 1234 as Node identifier/name.

My purpose is to create Node for each category and use its Category-Code as Node name and thereafter assign relationships between categories using their category codes. So I want to have :

CREATE (000-116880:CATEGORY {PartnerCode:"ABCD12345", MerchantCode:"XXXX_0001", Name:"XXXX ABCDE", Leaf:1 ,MerchantCategoryID:125})

parent of

CREATE (000-226880:CATEGORY {PartnerCode:"ABCD12345", MerchantCode:"XXXX_0001", Name:"XXXX ABCDE", Leaf:1 ,MerchantCategoryID:225})

Can anyone please give example using Cypher statements.

Upvotes: 4

Views: 1490

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41676

Use backticks (`) to quote your identifier, label, property name or relationship-type.

CREATE (`000-116880`:CATEGORY
        {Leaf:1,
         MerchantCategoryID:125,
         MerchantCode:"XXXX_0001",
         Name:"XXXX ABCDE", 
         PartnerCode:"ABCD12345"})

Upvotes: 3

Related Questions