python - 从 Python 使用 Titan Graph 数据库

标签 python cassandra distributed-computing titan bulbs

我正在尝试使用 Titan Graph DB 对网络拓扑进行建模。我想从 Python 应用程序中指定拓扑。

我有一个使用 tinkertop 框架注释的 java 接口(interface)文件。下面给出了一个示例结构。

public interface IDeviceObject extends IBaseObject {

          @JsonProperty("mac")
          @Property("dl_addr")
          public String getMACAddress();
          @Property("dl_addr")
          public void setMACAddress(String macaddr);

          @JsonProperty("ipv4")
          @Property("nw_addr")
          public String getIPAddress();
          @Property("nw_addr")
          public void setIPAddress(String ipaddr);

          @JsonIgnore
          @Adjacency(label="host",direction = Direction.IN)
          public Iterable<IPortObject> getAttachedPorts();

          @JsonIgnore
          @Adjacency(label="host",direction=Direction.IN)
          public void setHostPort(final IPortObject port);

          @JsonIgnore
          @Adjacency(label="host",direction=Direction.IN)
          public void removeHostPort(final IPortObject port);

          @JsonIgnore
          @GremlinGroovy("it.in('host').in('on')")
          public Iterable<ISwitchObject> getSwitch();
    }


PYTHON OBJECTS  ----> BULBS ----> REXTER ---> Titan Graph DB ---> Cassandra DB

(1) BULBS将python对象转为Graphs (2) Rexter将Graphs转JSON (3) Titan将JSON转回Graphs?? (4) 并且也写入cassandra store

看起来我做事的方式很绕,我错过了什么?如果有人能指出上述内容有什么问题,那就太好了?

最佳答案

你的图表:

PYTHON OBJECTS  ----> BULBS ----> Rexster ---> Titan Graph DB ---> Cassandra DB

看起来或多或少是正确的,这取决于你想如何看待所涉及的抽象。您也可以将其定义为:

PYTHON OBJECTS  ----> BULBS ----> Rexster/Titan ---> Cassandra DB

由于 Rexster 基本上嵌入了一个 Titan 实例,它通过 REST 公开供 Bulbs 使用。这部分不太正确:

  1. BULBS 将 python 对象转换为图形
  2. Rexter 将图形转换为 JSON
  3. Titan 将 JSON 转换回图形??
  4. 也写信给cassandra store

我会说:

  1. Titan 是一个 Blueprints写入 Cassandra 的实现
  2. Rexster 使用 JSON 通过 REST 托管蓝图实现并公开该 API 的元素(和 Gremlin)
  3. Bulbs 是基于 Rexster 的 Python 对象映射层。

归根结底,Python 与 Titan 没有直接联系。 Titan 具有基于 JVM 的蓝图接口(interface),并使用 Rexster 作为非 JVM 语言与其对话的方式。

关于python - 从 Python 使用 Titan Graph 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23190344/

相关文章:

python - 让 Tkinter 等到按下按钮

python - 使用 CMake 构建与平台无关的目录结构

python - 如何离线设置 ChatGPT 进行开发

cassandra - 在 Cassandra 中,如果我运行一个递增计数器的查询,那么从该计数器中选择是原子的吗?

java - 从 DistributedCache 读取 Hadoop 作业的分片输出

hadoop - hadoop可以做分布式队列服务器吗?

python - Tkinter Canvas 不会显示整个照片图像

java - Cassandra cluster.close 延迟

Cassandra 查询特定节点

mapreduce - Hazelcast:确保相关对象物理存储在同一成员上