使用Java API在titan中设置我们自己的顶点ID [英] set-up our own vertex id in titan using java API

查看:74
本文介绍了使用Java API在titan中设置我们自己的顶点ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想像下面提到的方法那样为顶点设置自己的ID.

I want to set up my own id to vertex like the way mentioned below.

BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty("storage.backend", "hbase");
configuration.setProperty("storage.hostname", "slave05");
configuration.setProperty("storage.port", "2181");
configuration.setProperty("storage.tablename", "REC_GRAPH1");
TitanGraph graph = TitanFactory.open(configuration);

Vertex vertex = graph.addVertex(200);
graph.commit();

但是我无法..我想我缺少一些配置设置.

But I'm not able to.. I guess I'm missing some configuration setup.

请帮助我.

谢谢, 维维克

推荐答案

Titan为其分配自己的标识符.您不能分配自己的.这种行为在大多数图形数据库中都是典型的(您会在几乎所有 Blueprints 实现中找到这种情况).如果您希望保留一个自定义的标识符,则应创建一个适当的索引以快速查找该值,并将其视为顶点上的一个属性.

Titan assigns it's own identifiers. You can not assign your own. This behavior is typical of most graph databases (you will find this situation in nearly all Blueprints implementations). If you have an identifier you wish to persist that is custom to you, you should create an appropriate index for fast lookup of that value and treat it as a property on your vertex.

这篇关于使用Java API在titan中设置我们自己的顶点ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆