Titan Graph DB:在IdGraph中处理事务

曼尼斯·库玛(Manish Kumar)

我正在阅读《泰坦》的这篇文章他们在这里谈论泰坦图中的交易

Vertex v1 = g.addVertex(null);
//Do many other things
TransactionalGraph tx = g.newTransaction();
Vertex v2 = tx.addVertex(null);
v2.setProperty("uniqueName","foo");
tx.commit();
g.addEdge(null,v1,g.getVertex(v2),"related"); //Need to load v2 into outer transaction
//Do many other things
g.commit(); // Likely to fail due to lock congestion

如果我正在使用可以,TitanGraph但是使用时应该如何处理事务IdGraph我可以做下面的事情吗:

    // baseGraph is TitanGraph,   g is IdGraph

    TransactionalGraph tx = baseGraph.newTransaction();
    Vertex v = g.addVertex(pageId);

    v.setProperty("prop1",       prop1);
    v.setProperty("prop2",       prop2);
    v.setProperty("prop3",       prop3);

    tx.commit();

    .....create some edges here

    g.commit();
斯蒂芬·梅勒

有趣的问题。如果我这样做,我的直觉是使用baseGraph来启动新的事务,然后再包创建txIdGraph,如下所示:

// baseGraph is TitanGraph,   g is IdGraph
TransactionalGraph tx = baseGraph.newTransaction();
IdGraph txId = new IdGraph(tx);
Vertex v = txId.addVertex(pageId);

v.setProperty("prop1",       prop1);
v.setProperty("prop2",       prop2);
v.setProperty("prop3",       prop3);

txId.commit();

.....create some edges here using txId

txId.commit();

包装baseGraphIdGraphg使用该功能进行装饰由于tx是“新”图实例,因此也需要对其进行包装以装饰IdGraph特征。请注意,在解决此问题之前,以上代码将不起作用:

https://github.com/thinkaurelius/titan/issues/592

直到提出这个问题,我才意识到不可能进行这种包装。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在titan graph db中使用openManagement()方法时出错

来自分类Dev

How to delete graph in Titan with Cassandra storage backend?

来自分类Dev

从Titan Graph节点获取<key,value>对

来自分类Dev

Titan/Janus 中的索引

来自分类Dev

Titan db的新功能,可帮助安装titan db

来自分类Dev

Titan DB图形到JSON

来自分类Dev

如何从iOS App查询Titan Graph数据库

来自分类Dev

Gremlin(Titan)中的嵌套变换

来自分类Dev

Titan DB中的顶点ID更新

来自分类Dev

无法将python与titan db连接

来自分类Dev

从Javascript Titan中的数组中删除项目

来自分类Dev

从Javascript Titan中的数组中删除项目

来自分类Dev

在Titan中创建后使索引唯一

来自分类Dev

泰坦(Titan):图形中的范围查询

来自分类Dev

在ViewPager中处理事务后,ListFragment显示空白屏幕

来自分类Dev

如何在Fabric8中处理事务日志?

来自分类Dev

Titan DB 1.0.0:无法将Json文件导入titan TinkerPop 3.x

来自分类Dev

手动处理事务而不是JtaTransactionManager

来自分类Dev

从Node.js批量加载titan db中的数据

来自分类Dev

Titan DB如何列出所有图形索引

来自分类Dev

在Titan中记录Groovy脚本中的语法错误

来自分类Dev

图片不会显示在Titan Build Android应用程序中

来自分类Dev

如何使用Cassandra存储后端删除Titan中的图形?

来自分类Dev

如何在Gremlin Server(Titan 1.0)中更新顶点的值

来自分类Dev

Titan图用例中的GremlinPipeLine Java API链遍历

来自分类Dev

在Titan Appacelerator中设置View和TextView的ID

来自分类Dev

如何在Gremlin Server Titan 1.0中删除顶点

来自分类Dev

如何在Android Titan中实现Coverflow视图?

来自分类Dev

如何在Gremlin Server(Titan 1.0)中更新顶点的值

Related 相关文章

热门标签

归档