Skip to content

Tinkerpop gremlin cheat sheet

Erwan Demairy edited this page Sep 5, 2017 · 3 revisions

Création rapide d'un graph tinkerpop

Graph graph = TinkerGraph.open();

Création rapide d'un graph Titan

graph_store = TitanFactory.open('berkeleyje:/tmp/graph')

création d'une clé

mgr.makePropertyKey("v_value").dataType(String.class).make()

création d'un index

mgr = graph_store.openManagement() keyV = mgr.getPropertyKey("v_value") mgr.buildIndex("vertices", Vertex.class).addKey(keyV).buildCompositeIndex() mgr.commit()

Enregistrement/réindexation

import com.thinkaurelius.titan.graphdb.database.management.ManagementSystem mgr = graph_store.openManagement() ManagementSystem.awaitGraphIndexStatus(graph_store, "vertices").status(SchemaStatus.REGISTERED).call() mgr.updateIndex(mgr.getGraphIndex("vertices"), SchemaAction.REINDEX).get()

list open transactions

`graph.getOpenTransactions() commit opened transactions

txs = graph_store.getOpenTransactions()

txs.forEach( a -> a.commit() ) `

ajout d'un noeud

v1 = graph_store.addVertex(T.label, "Type1", "v_value", sb.toString())

Utilisation de la console gremlin

`~/Developpement/apache-tinkerpop-gremlin-console-3.2.4/bin/gremlin.sh

path="/Users/edemairy/Developpement/corese/persistency-tools/coresedb-benchmark/btc-2010-chunk-000.nq.gz_10000000_db" g = Neo4jGraph.open(path)

`