0
  1. In the Tinkerpop or Titan documentation, all operations are based on a sample graph. How to creat a new empty graph to work on?

  2. I am programming in erlang connecting to Tinkergraph, planned to use Titan later in production. There is no erlang driver for both so I am connecting by REST. It is easy to read from graph, but if I want to read from user's input then write into the graph, for example, to create a person named teddy:

screenshot 1

I got those errors. What is the correct way?

Thank you.

Update: For following situation:

23> Newperson=terry.

terry

24> Newperson.

terry

If I want to add this terry, below two will not work. What's the correct way to do it?

screenshot 2

Teddy
  • 35
  • 8

2 Answers2

1

1

TitanGraph titanGraph = TitanFactory.open(config); will open a titan graph without the sample data.

If you have already commited the sample data to your keyspace then you can just change the keyspace defined in your config file.

For example if you are using a cassandra backend you would change storage.cassandra.keyspace=xxxxxx .

You can also clear any keyspace using TitanCleanup.clear(graph);

2

As for the error you are seeing. It looks like you are trying to label your vertex incorrectly. I posted the following and it worked:

{ 
    "gremlin" : "g.addV(label, x).property(y,z)",
    "bindings" : 
    {
        "x" : "person",
        "y" : "name",
        "z" : "Teddy"
    }
}

A final note, when you start using Titan 1.0.0 make sure you checkout this section of the tinkerpop docs. Especially make sure to change the channel in the gremlin-server.yaml config to:

channelizer: com.tinkerpop.gremlin.server.channel.HttpChannelizer
Filipe Teixeira
  • 3,565
  • 1
  • 25
  • 45
  • Thank you Fido, by read your answer, I found why I was wrong, my bindings is not correct, I didn't put the value in quotation mark. It should be \"bindings\":\"NewName\":\"Teddy\". I put it as :teddy. Besides, g.addV('person').property('name','stephen') is also correct expression, checkout here: http://tinkerpop.apache.org/docs/current/reference/#addvertex-step – Teddy Jul 05 '16 at 04:48
0

Answer to my own question: construct a Body by lists:concat() or ++, then post

Teddy
  • 35
  • 8