3

I have gremlin-console connected to gremlin-server with janusGraph on backend. I want to recreate edgeLabel with multiplicity so I send script to gremlin-server with removeEdgeLabel() command to remove label "hasNext":

graph_creation_script="""
tx = graph.newTransaction();
g.V().drop().iterate();
g.E().drop().iterate();
g.tx().commit()

tx = graph.newTransaction();
a = tx.addVertex(label, "A");
b = tx.addVertex(label, "B");
tx.commit()

mgmt = graph.openManagement()
mgmt.getEdgeLabel("hasNext").remove()
// mgmt.makeEdgeLabel("hasNext").multiplicity(ONE2ONE).make()
//a.addEdge("hasNext",b);
mgmt.commit()
"""
:> @graph_creation_script

Then I comment out the line mgmt.getEdgeLabel("hasNext").remove() and remove comment symbols from makeEdgeLabel(...) line to create new label with multiplicity(ONE2ONE):

...
// mgmt.getEdgeLabel("hasNext").remove()
mgmt.makeEdgeLabel("hasNext").multiplicity(ONE2ONE).make()
...

and I get error:

Adding this property for key [~T$SchemaName] and value [rtâ–²hasNext] violates a uniqueness constraint [SystemIndex#~T$SchemaName]

So it seems that label was not removed from the schema, but why that happens?

palandlom
  • 529
  • 6
  • 17

2 Answers2

1

Not sure , you need this answer now but could you please try this one

mgmt.getEdgeLabel('Bad_Name').remove()

I had to close the graph connection after

mgmt.commit()

and when I checked again, edge label was not there. Please let me know if it works for you as well. I am using Janusgraph 0.3.0 .

89n3ur0n
  • 921
  • 11
  • 24
0

At the end I drop all schema/graph content by commands:

./bin/janusgraph.sh stop
./bin/janusgraph.sh clean

and evidently define JanusGraph for operation in gremlin-console:

:remote connect tinkerpop.server conf/remote.yaml
==>Configured localhost/10.11.221.123:8182
graph = JanusGraphFactory.open("conf/janusgraph-cassandra-es.properties")
g = graph.traversal()
palandlom
  • 529
  • 6
  • 17