public class TitanMassiveInsertion {
private TitanGraph titanGraph = null;
private BatchGraph<TitanGraph> batchGraph = null;
public static void main(String args[]) {
TitanMassiveInsertion test = new TitanMassiveInsertion();
test.startup("data/titanDB");
test.createGraph("data/flickrEdges.txt");
test.shutdown();
}
public void startup(String titanDBDir) {
System.out.println("The Titan database is now starting . . . .");
BaseConfiguration config = new BaseConfiguration();
Configuration storage = config.subset(GraphDatabaseConfiguration.STORAGE_NAMESPACE);
storage.setProperty(GraphDatabaseConfiguration.STORAGE_BACKEND_KEY, "local");
storage.setProperty(GraphDatabaseConfiguration.STORAGE_DIRECTORY_KEY, titanDBDir);
storage.setProperty(GraphDatabaseConfiguration.STORAGE_BATCH_KEY, true);
titanGraph = TitanFactory.open(config);
titanGraph.createKeyIndex("nodeId", Vertex.class);
titanGraph.commit();
batchGraph = new BatchGraph<TitanGraph>(titanGraph, VertexIDType.STRING, 1000);
batchGraph.setVertexIdKey("nodeId");
batchGraph.setLoadingFromScratch(true);
}
public void createGraph(String datasetDir) {
System.out.println("Creating the Titan database . . . .");
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(datasetDir)));
String line;
int lineCounter = 1;
int nodeCounter = 0;
Vertex srcVertex, dstVertex;
while((line = reader.readLine()) != null) {
if(lineCounter > 4) {
String[] parts = line.split("\t");
srcVertex = batchGraph.getVertex(parts[0]);
if(srcVertex == null) {
srcVertex = batchGraph.addVertex(parts[0]);
srcVertex.setProperty("nodeId", parts[0]);
nodeCounter++;
}
dstVertex = batchGraph.getVertex(parts[1]);
if(dstVertex == null) {
dstVertex = batchGraph.addVertex(parts[1]);
dstVertex.setProperty("nodeId", parts[1]);
nodeCounter++;
}
Edge edge = batchGraph.addEdge(null, batchGraph.getVertex(parts[0]), batchGraph.getVertex(parts[1]), "similar");
System.out.println(edge);
System.out.println(nodeCounter);
}
lineCounter++;
}
reader.close();
}
catch(IOException ioe) {
ioe.printStackTrace();
}
}
public void shutdown() {
System.out.println("The Titan database is now shuting down . . . .");
if(titanGraph != null) {
batchGraph.shutdown();
titanGraph.shutdown();
batchGraph = null;
titanGraph = null;
}
}
}
Exception in thread "main" java.lang.IllegalArgumentException: Label with given name does not exist
at com.thinkaurelius.titan.graphdb.types.DisableDefaultTypeMaker.makeLabel(DisableDefaultTypeMaker.java:18)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.getEdgeLabel(StandardTitanTx.java:646)
at com.thinkaurelius.titan.graphdb.blueprints.TitanBlueprintsTransaction.addEdge(TitanBlueprintsTransaction.java:124)
at com.thinkaurelius.titan.graphdb.blueprints.TitanBlueprintsTransaction.addEdge(TitanBlueprintsTransaction.java:116)
at com.thinkaurelius.titan.graphdb.blueprints.TitanBlueprintsGraph.addEdge(TitanBlueprintsGraph.java:217)
at com.thinkaurelius.titan.graphdb.blueprints.TitanBlueprintsGraph.addEdge(TitanBlueprintsGraph.java:24)
at com.tinkerpop.blueprints.util.wrappers.batch.BatchGraph.addEdge(BatchGraph.java:380)
at com.tinkerpop.blueprints.util.wrappers.batch.BatchGraph.addEdge(BatchGraph.java:367)
at TitanMassiveInsertion.createGraph(TitanMassiveInsertion.java:106)
at TitanMassiveInsertion.main(TitanMassiveInsertion.java:29)
--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
val serving_cell: Vertex = GraphDBConnectionTest.graph.asScala.addVertex("cell")
or
val serving_cell: Vertex = GraphDBConnectionTest.graph +(s"cell-1", ID -> s"cell-2")
or
val serving_cell: Vertex = GraphDBConnectionTest.graph.addVertex(T.label,"cell")
java.lang.IllegalArgumentException: Vertex Label with given name does not exist: cell at com.thinkaurelius.titan.graphdb.types.typemaker.DisableDefaultSchemaMaker.makeVertexLabel(DisableDefaultSchemaMaker.java:37) at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.getOrCreateVertexLabel(StandardTitanTx.java:988) at com.thinkaurelius.titan.graphdb.tinkerpop.TitanBlueprintsTransaction.addVertex(TitanBlueprintsTransaction.java:101) at com.thinkaurelius.titan.graphdb.tinkerpop.TitanBlueprintsGraph.addVertex(TitanBlueprintsGraph.java:115)
"com.michaelpollmeier" %% "gremlin-scala" % "3.0.2-incubating.2",
"com.thinkaurelius.titan" % "titan-core" % "1.0.0",
"com.thinkaurelius.titan" % "titan-cassandra" % "1.0.0"
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/b2ec4478-1ca5-4d91-9084-2f9707689b18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.