2014-04-21 37 views
2

我正在嘗試使用Titan Graph DB來建模網絡拓撲。我想從python應用程序指定拓撲。使用Python中的Titan Graph數據庫

我有一個java接口文件,它使用了tinkertop frames annotation.An結構如下。

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)燈泡Python對象轉換爲圖形 (2)Rexter轉換圖來JSON (3)泰坦轉換JSON回圖形?? (4),並寫入卡桑德拉商店

它看起來像我在一個非常圓的方式做事情,我錯過了什麼?如果有人能指出上面的問題是錯誤的,那將會很棒。

回答

4

你的圖:

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

看起來或多或少正確取決於你想要怎麼想涉及的抽象。你也可以將其定義爲:

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

由於Rexster基本上嵌入了泰坦的實例,它暴露了REST由燈泡消耗。這部分是不完全正確:

  1. 燈泡Python對象轉換爲圖形
  2. Rexter圖形轉換成JSON
  3. 泰坦迴轉換JSON到圖形?
  4. ,並寫入到卡桑德拉店

我會說:

  1. 土衛六是一個Blueprints實現寫入卡桑德拉
  2. Rexster舉辦藍圖的實現並公開API的元素(和Gremlin )通過REST使用JSON
  3. 燈泡是通過Rexster的Python對象映射層。

在一天結束時,Python與泰坦之間沒有直接的聯繫。 Titan具有基於JVM的Blueprints接口,並使用Rexster作爲非JVM語言與之通信的一種方式。

+0

什麼是Gremlin?這如何符合上述計劃? – liv2hak

+3

Gremlin是TinkerPop(http://tinkerpop.com)堆棧中的圖形查詢語言。因爲它與Rexster通信,燈泡基本上使用Gremlin。 –

+3

燈泡對象是Python對象,因此可以簡單地將它想象爲:燈泡/ Python - > Rexster/Titan - > Cassandra。 Gremlin是圖形查詢語言(想象它像圖形的SQL),並且使用燈泡在Titan服務器(Rexster)上執行Gremlin查詢,就像使用SQL在RDBMS上執行查詢一樣。 – espeed

相關問題