Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create unique node with a property value as array will not create the node #72

Open
lisongmin1 opened this issue Dec 28, 2012 · 2 comments

Comments

@lisongmin1
Copy link

NEO4J.batch [:create_unique_node, "properties_checksum", "properties_checksum", "076da301619e83cff84025301cf9b4adaa34a8251", {"measure_value"=>[50, 60], "properties_checksum"=>"076da301619e83cff84025301cf9b4adaa34a825"}]
return nil
if run NEO4J.batch [:create_unique_node, "properties_checksum", "properties_checksum", "076da301619e83cff84025301cf9b4adaa34a8251", {"measure_value"=>[50, 60].to_s, "properties_checksum"=>"076da301619e83cff84025301cf9b4adaa34a825"}]
will create a node

@rdvdijk
Copy link
Collaborator

rdvdijk commented Jan 18, 2013

I noticed that this does not work outside of batch either:

@neo.create_unique_node("index", "key1", "value1", { :a => [1,2] })

I see the following IllegalArgumentException stack-trace:

org.neo4j.kernel.impl.nioneo.store.PropertyStore.encodeValue(PropertyStore.java:582)
org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeAddProperty(WriteTransaction.java:1252)
org.neo4j.kernel.impl.persistence.PersistenceManager.nodeAddProperty(PersistenceManager.java:146)
org.neo4j.kernel.impl.core.NodeManager.nodeAddProperty(NodeManager.java:895)
org.neo4j.kernel.impl.core.NodeImpl.addProperty(NodeImpl.java:120)
org.neo4j.kernel.impl.core.Primitive.setProperty(Primitive.java:436)
org.neo4j.kernel.impl.core.NodeImpl.setProperty(NodeImpl.java:53)
org.neo4j.kernel.impl.core.NodeProxy.setProperty(NodeProxy.java:130)
org.neo4j.server.rest.web.DatabaseActions$UniqueNodeFactory.initialize(DatabaseActions.java:1069)
org.neo4j.server.rest.web.DatabaseActions$UniqueNodeFactory.initialize(DatabaseActions.java:1053)
org.neo4j.graphdb.index.UniqueFactory.getOrCreate(UniqueFactory.java:205)
org.neo4j.server.rest.web.DatabaseActions.getOrCreateIndexedNode(DatabaseActions.java:965)
org.neo4j.server.rest.web.RestfulGraphDatabase.addToNodeIndex(RestfulGraphDatabase.java:791)
java.lang.reflect.Method.invoke(Method.java:597)

I suspect this is a Neo4j bug, I'll investigate further.

Also note that your workaround with the [50, 60].to_s will not create a proper node with an array property value, but a field with the string "[50, 60]".

@rdvdijk
Copy link
Collaborator

rdvdijk commented Jan 18, 2013

This is indeed a Neo4j bug: neo4j/neo4j#64.

willkessler pushed a commit to willkessler/neography that referenced this issue Apr 21, 2014
add type conversion for properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants