How to start over with a remote graph? (.delete()/.wipe()/.remove()/.close()/.shutdown())

348 views
Skip to first unread message

Jared Null

unread,
Oct 18, 2016, 6:17:32 PM10/18/16
to Gremlin-users
I'm trying to switch from using gremlin console from a local graph:

g = TitanFactory.open('conf/titan-cassandra-es.properties')
g1
= g.traversal()

To using a remote graph:

:remote connect tinkerpop.server conf/remote.yaml

script
= """
mgmt = graph.openManagement()
person = mgmt.makeVertexLabel('person').make()
category = mgmt.makeVertexLabel('category').make()
vote = mgmt.makeEdgeLabel('vote').multiplicity(MULTI).make()
mgmt.commit()
"""

:> @script

after running the script i get:

gremlin> :> @script
Adding this property for key [~T$SchemaName] and value [vlperson] violates a uniqueness constraint [SystemIndex#~T$SchemaName]


How do i remove all indexes or clear out the remote graph and start over?

from command line I've tried:
 ./bin/titan.sh stop
 
./bin/titan.sh clean
 
./bin/titan.sh start

then started again:
./bin/gremlin.sh

But this did not clear the remote graph, so i deleted everything with-in the titan/data/* and titan/logs/* directory like clean is suppose to do, but it didn't work.

What I'm really trying to do is execute the below in the remote graph so i can use gremlin-console npm and/or the gremlin-javascript npm browser library.  

//Connect to Titan through germlin console
g
= TitanFactory.open('conf/titan-cassandra-es.properties')
g1
= g.traversal()

//mgmt Start
mgmt
= g.openManagement()

//Labels
person
= mgmt.makeVertexLabel('person').make()
category
= mgmt.makeVertexLabel('category').make()
vote
= mgmt.makeEdgeLabel('vote').multiplicity(MULTI).make() //Multiplicity

//Indexes
//user_id (int)
user_id
= mgmt.makePropertyKey('user_id').dataType(Integer.class).cardinality(Cardinality.SINGLE).make()
user_id
= mgmt.getPropertyKey('user_id')
mgmt
.buildIndex('byPersonUserIdUnique', Vertex.class).addKey(user_id).indexOnly(person).unique().buildCompositeIndex()
mgmt
.setConsistency(user_id, ConsistencyModifier.LOCK)

//category_name (string)
category_name
= mgmt.makePropertyKey('category_name').dataType(String.class).cardinality(Cardinality.SINGLE).make()
category_name
= mgmt.getPropertyKey('category_name')
mgmt
.buildIndex('byCategoryNameUnique', Vertex.class).addKey(category_name = mgmt.getPropertyKey('category_name')).indexOnly(category).unique().buildCompositeIndex()
mgmt
.setConsistency(category_name, ConsistencyModifier.LOCK)

//votes edge
votes
= mgmt.makePropertyKey('votes').dataType(String.class).cardinality(Cardinality.SET).make()
votes
= mgmt.getPropertyKey('votes')
mgmt
.buildIndex('byEdgeVoteUnique', Vertex.class).addKey(votes).unique().buildCompositeIndex()
mgmt
.setConsistency(votes, ConsistencyModifier.LOCK)

//mgmt end
mgmt
.commit()

//Input Data
//Vertices
//People
vp1
= g.addVertex(T.label, "person", "user_id", 1, "name", "Jared", "age", 29)
vp2
= g.addVertex(T.label, "person", "user_id", 2, "name", "Brad", "age", 3000)

//categories
vc3
= g.addVertex(T.label, "category", "category_name", "dog")
vc4
= g.addVertex(T.label, "category", "category_name", "cat")
vc5
= g.addVertex(T.label, "category", "category_name", "fur")

//votes
//dog
vp1
.addEdge("vote", vc3, "votes", "'cat','fur'")
vp2
.addEdge("vote", vc3, "votes", "'fur','cat'")

//cat
vp1
.addEdge("vote", vc4, "votes", "'fur','dog'")
vp2
.addEdge("vote", vc4, "votes", "'dog','fur'")

//fur
vp1
.addEdge("vote", vc5, "votes", "'dog','cat'")
vp2
.addEdge("vote", vc5, "votes", "'cat','dog'")



Create_Main_Schema.txt

Stephen Mallette

unread,
Oct 19, 2016, 6:11:53 AM10/19/16
to Gremlin-users
I'm reasonably sure that if:

 ./bin/titan.sh clean

didn't reset your graph to an empty state that your gremlin-server.yaml file isn't pointing at the graph you think it is. I would check that.

--
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/f9dbc108-7ae6-45ae-93b9-999a3375d55d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jared Null

unread,
Oct 24, 2016, 4:43:38 AM10/24/16
to Gremlin-users

Thanks for the Reply Stephen, and sorry it took so long to respond, but the only way that i see is to remove the data by deleting the titan folder, then unzipping again.

Here are the steps i'm following:  

Step1: unzip titan-1.0.0-hadoop1.zip -d x
Step2: mv x/titan-1.0.0-hadoop1 titan
Step3: change line in titan/conf/remote.yaml  from "hosts: [localhost]" to "hosts: [10.1.1.220]"
Step4: change line in titan/conf/gremlin-server/gremlin-server.yaml from "Host: localhost" to "Host: 0.0.0.0" 
Step5: cd titan && ./bin/gremlin.sh  
Step6: :remote connect tinkerpop.server conf/remote.yaml
Step7: paste script:  script = """ <script here> """  (script.txt attached)
Step8: execute script:  ":> @script" 
Step9: ./bin/titan stop 
Step10: ./bin/titan clean 
Step11: ./bin/titan start 
Step12: ./bin/gremlin.sh  
Step13: :remote connect tinkerpop.server conf/remote.yaml
Step14: check data:  :> g.V( )   

Not sure what's happening, but maybe i'm just missing something, but the data is still returned in Step14. 

-Jared
My platform: Linux titan 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
script.txt

Stephen Mallette

unread,
Oct 24, 2016, 5:56:21 AM10/24/16
to Gremlin-users
not sure what could be wrong then. that should work. obviously, clean, just does a delete of those directories so if that works for you then you have your workaround.

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/524bc4c9-188a-447e-a5fa-351b9f9bbbf4%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages