tinkerpop gremlin neo4j db Multiple properties on a vertex is not supported

413 views
Skip to first unread message

Pavankumar B

unread,
Apr 5, 2018, 9:11:23 AM4/5/18
to Gremlin-users
Hi,
I am using tinkerpop's gremlin server with neo4j db.
How to set the vertex property cardinality to set or list?

java.lang.UnsupportedOperationException: Multiple properties on a vertex is not supported at org.apache.tinkerpop.gremlin.structure.VertexProperty$Exceptions.multiPropertiesNotSupported(VertexProperty.java:99) at org.apache.tinkerpop.gremlin.neo4j.structure.trait.NoMultiNoMetaNeo4jTrait.setVertexProperty(NoMultiNoMetaNeo4jTrait.java:101) at org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertex.property(Neo4jVertex.java:85) at org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AddPropertyStep.sideEffect(AddPropertyStep.java:121) at org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SideEffectStep.processNextStart(SideEffectStep.java:39) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:192) at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:89) at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:252) at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:273) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

I have tried setting these following properties in neo4j.properties

gremlin.graph=org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph
gremlin
.neo4j.directory=/var/lib/neo4j/data/databases/graph.db
gremlin
.neo4j.conf.node_auto_indexing=true
gremlin
.neo4j.conf.relationship_auto_indexing=true
gremlin
.neo4j.conf.allow_store_upgrade=true
gremlin
.neo4j.conf.multiProperties=true
gremlin
.neo4j.conf.metaProperties=true
gremlin
.tinkergraph.defaultVertexPropertyCardinality=list

and restarted the gremlin-server.

Stephen Mallette

unread,
Apr 5, 2018, 9:20:59 AM4/5/18
to Gremlin-users
I believe that I answered this on SO:


was there something still not working?

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/cceb63aa-4fc0-41ba-9831-34b80e18a0dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Dale

unread,
Apr 5, 2018, 9:29:23 AM4/5/18
to gremli...@googlegroups.com
Sounds like the configuration was updated after the initial database was created.  However:

The default setting is to disable multi- and meta-properties. [...] Once the configuration is set, it can not be changed for the lifetime of the graph.

Thus, the database will have to be removed and recreated with the desired configuration.

Robert Dale

Pavankumar B

unread,
Apr 5, 2018, 9:43:41 AM4/5/18
to Gremlin-users
Hi, thanks for your reply.
I've at it and there has been some development.
I installed neo4j again and used this new db file.
I put the properties
gremlin.neo4j.multiProperties=true
gremlin.neo4j.metaProperties=true
and I did g.addV('User').property(set, '1','2').property(set, '1',3')

I got this
gremlin> g.V().valueMap().unfold()
==>1=[3, 2]

Seems like Once the data is inserted without the meta and multi properties,
It doesn't allow to add multi properties further even if the properties are set later on.
Now I'm trying to copy the data from that old db to this new one in which property array works

It sounds lame but I couldn't copy the database to a file and file back to the new db.
I am trying using 
graph.io(IoCore.gryo()).writeGraph("dfs.kryo")
graph.io(IoCore.gryo()).readGraph("dfs.kryo")

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.neo4j
plugin activated: tinkerpop.tinkergraph
gremlin> graph = Neo4jGraph.open('/opt/gremlin-server/data/graph.db')
==>neo4jgraph[community single [/opt/gremlin-server/data/graph.db]]
gremlin> graph.io(IoCore.gryo()).writeGraph("dfs.kryo")
==>null
gremlin>


Am I doing the right thing?
Thank you again

Pavankumar B

unread,
Apr 5, 2018, 10:16:16 AM4/5/18
to Gremlin-users
I doesn't copy to the file but gives null

Stephen Mallette

unread,
Apr 6, 2018, 6:29:43 AM4/6/18
to Gremlin-users
Does this:

graph.io(IoCore.gryo()).writeGraph("dfs.kryo")

produce a dfs.kryo file? or does that give you the null? or do you get the null on the reading of that file?

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.

Robert Dale

unread,
Apr 6, 2018, 6:57:08 AM4/6/18
to gremli...@googlegroups.com

First, the properties are:
gremlin.neo4j.multiProperties=true
gremlin.neo4j.metaProperties=true

Those turn on features within the Gremlin implementation.  The 'gremlin.neo4j.conf' namespace is passed to Neo4j itself.

Using conf/neo4j-standalone.properties:
gremlin.graph=org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph
gremlin.neo4j.directory=/tmp/neo4j
gremlin.neo4j.multiProperties=true
gremlin.neo4j.metaProperties=true

gremlin> graph = GraphFactory.open('conf/neo4j-standalone.properties')
WARN  org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph  - Neo4jGraph multi/meta-properties feature is considered experimental and should not be used in a production setting until this warning is removed
==>neo4jgraph[community single [/tmp/neo4j]]
gremlin> g = graph.traversal()
==>graphtraversalsource[neo4jgraph[community single [/tmp/neo4j]], standard]
gremlin>  g.addV('User').property(set, '1','2').property(set, '1','3')
==>v[0]
gremlin> g.V().valueMap(true)
==>[1:[2,3],label:User,id:0]
gremlin> g.V().properties().valueMap(true)
==>[value:2,key:1,id:99]
==>[value:3,key:1,id:100]
gremlin> 
gremlin> graph.io(gryo()).writeGraph("neo.kryo");
==>null
gremlin> graph.io(gryo()).readGraph("neo.kryo");
==>null
gremlin> g.V().valueMap(true)
==>[1:[3,2],label:User,id:0]
==>[1:[3,2],label:User,id:3]
gremlin> g.V().properties().valueMap(true)
==>[value:3,key:1,id:100]
==>[value:2,key:1,id:99]
==>[value:3,key:1,id:103]
==>[value:2,key:1,id:102]

Now you can see that it did in fact load the graph and added a new vertex with new properties.



Robert Dale

Pavankumar B

unread,
Apr 6, 2018, 7:17:37 AM4/6/18
to Gremlin-users
It creates an empty file dfs.kryo and the gremlin prompt says null.

I think null is normal right? but the file created is empty.


gremlin> graph = Neo4jGraph.open('/opt/gremlin-server/data/graph.db')
==>neo4jgraph[community single [/opt/gremlin-server/data/graph.db]]
gremlin> graph.io(IoCore.gryo()).writeGraph("dfs.kryo")
==>null
gremlin>

I was doing it wrong at graph = Neo4jGraph.open('/opt/gremlin-server/data/graph.db')

I tried this graph = GraphFactory.open('conf/neo4j-standalone.properties')
and it worked.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages