Search code examples
pythoncassandradistributed-computingtitanbulbs

Using Titan Graph database from Python


I am attempting to model a network topology using Titan Graph DB.I want to specify the topology from a python application.

I have a java interface file that uses tinkertop frames annotation.An example structure is given below.

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 converts python objects to Graphs (2) Rexter converts Graphs to JSON (3) Titan converts JSON back to Graphs?? (4) and also writes to cassandra store

It looks like I am doing things in a very round about manner,and I am missing something? It would be great if someone could point out waht is wrong with the above?


Solution

  • Your diagram of:

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

    Looks more or less correct depending on how you want to think of the abstractions involved. You might also define it as:

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

    As Rexster basically embeds a Titan instance that it exposes over REST for consumption by Bulbs. This part isn't quite right:

    1. BULBS converts python objects to Graphs
    2. Rexter converts Graphs to JSON
    3. Titan converts JSON back to Graphs??
    4. and also writes to cassandra store

    I would say:

    1. Titan is a Blueprints implementation that writes to Cassandra
    2. Rexster hosts Blueprints implementations and exposes elements of that API (and Gremlin) over REST using JSON
    3. Bulbs is a Python object mapping layer over Rexster.

    At the end of the day there is no direct connection from Python to Titan. Titan has the JVM based Blueprints interface and uses Rexster as a way for non-JVM languages to talk to it.