Surjit Jana
Surjit Jana

Reputation: 53

CypherTypeException: Properties containing arrays of non-primitive types are not supported

I am getting this exception while creating nodes in NEO4J 2.0.3 using C# Client for NEO4J. My Node Structure is like this

namespace UserGraph.BusinessObjects
{
    public class UserInfo
    {
        public int UserID { get; set; }
        public string UserName { get; set; }
        public int HeadendId { get; set; }
        public int Score { get; set; }
        public string ThirdPartyObjID { get; set; }
        public long ThirdPartyTypeId { get; set; }
        public string[] ThirdPartyFriendsIds { get; set; }
        public List<Programme> Programs { get; set; }
        public List<Channel> Channels { get; set; }
    }

    public class Channel
    {
        public long ChannelID { get; set; }
        public String ChannelName { get; set; }
    }

    public class Programme
    {
        public long ProgrammeID { get; set; }
        public String ProgrammeName { get; set; }
    }
}

I think Neo4j nodes don't hold Complex data. I searched and found on this link http://docs.neo4j.org/chunked/stable/graphdb-neo4j-properties.html Can any one tell me is there any way by which i can store the list of channel and program objects in my UserInfo class.

Upvotes: 0

Views: 1047

Answers (1)

Shawn
Shawn

Reputation: 125

I am running into the same issue and I am not sure I agree with the concept that all complex "properties" should be relationships. At the end of the day, the entire "node" should be something that can be serialized and stored -- this is one of the advantages of using JSON to serialize/deserialize the node. Coder the following

public class Address {
    public string Line1 { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public string Country { get; set; }
}

public class User {
    public string Name { get; set; }
    public string email { get; set; }
    public Address HomeAddress { get; set; }
    public Address WorkAddress { get; set; }
}

While create nodes for Addresses can be done, I would ask the question -- why should the developer be forced to create nodes and relationships for something like this. If I never intend to do any direct queries on the properties of the Address class independently of the main user, then it is far simpler to treat the entire user as a complex object and store it in its entirety as the data for the node in the graph.

Upvotes: 2

Related Questions