Domanda

I am imlpementing the Titan graph database with Rexster and Cassandra.

I try to add an edge like this in Ruby with Gremlin:

query = 'a = g.addVertex(null,[name:\'' +
someName +
'\']); g.addEdge(null, g.getVertex(' +
someVertexId + '), a, \'labelname\', [weight:' + 
someFloatValue.round(5) + 'd]); g.commit();'

#This formats to the following:
#"a = g.addVertex(null,[name:'myawesomename']); g.addEdge(null, g.getVertex(1337), a, 'labelname', [weight:0.30685d]); g.commit();"

After running this I get the following error:

#<Rexster::Rest::RexsterError: Graph server returned error: javax.script.ScriptException: java.lang.IllegalArgumentException: The type of given name is not a label: labelname>

It seems like I have not defined the label with the name labelname, I got that. However, I can not for the life of me figure out how to add this label so I am able to add this edge to the graph.

Adding vertices works fine by the way.


I am using the rexster_ruby gem which connects to a ubuntu 12.04 machine with titan-server 0.4.0 running the titan.sh script.

È stato utile?

Soluzione

The Titan TypeMaker has seen some serious API changes going from 0.3.x to 0.4.x. You can read about how to define an edge label here:

https://github.com/thinkaurelius/titan/wiki/Type-Definition-Overview#creating-edge-labels

It is is recommended that you use the TypeMaker at initialization of your graph, preferably outside of libraries like rexster_ruby, REST, etc. Simply initialize your graph from the Gremlin REPL. Even better, encapsulate those type definitions in a groovy class to maintain your schema.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top