我是泰坦新的死亡,當我開始研究它時,我感到困惑,因爲它有像gremlin,tinkerpop和引擎蓋下的新東西過多rexter等泰坦與卡桑德拉作爲後端:創建,存儲和遍歷圖中的java
我想要的是一個在java中使用Cassandra作爲後端的例子。我想創建一個圖形,存儲在cassandra中,將其恢復並遍歷它。一個非常簡單也會很有幫助。
我在java中運行了一個基本的例子。
BaseConfiguration baseConfiguration = new BaseConfiguration();
baseConfiguration.setProperty("storage.backend", "cassandra");
baseConfiguration.setProperty("storage.hostname", "192.168.3.82");
TitanGraph titanGraph = TitanFactory.open(baseConfiguration);
Vertex rash = titanGraph.addVertex(null);
rash.setProperty("userId", 1);
rash.setProperty("username", "rash");
rash.setProperty("firstName", "Rahul");
rash.setProperty("lastName", "Chaudhary");
rash.setProperty("birthday", 101);
Vertex honey = titanGraph.addVertex(null);
honey.setProperty("userId", 2);
honey.setProperty("username", "honey");
honey.setProperty("firstName", "Honey");
honey.setProperty("lastName", "Anant");
honey.setProperty("birthday", 201);
Edge frnd = titanGraph.addEdge(null, rash, honey, "FRIEND");
frnd.setProperty("since", 2011);
titanGraph.shutdown();
所以,當我運行此,我觀察到的卡桑德拉日誌,它創建了一個密鑰空間名爲Titan和下表:
- titan_ids
- edgestore
- graphindex
- system_properties
- systemlog
- txlog
- edgestore_lock_
- graphindex_lock_
- system_properties_lock_
我不知道是用來做什麼的這些表和它們是如何存儲數據。
運行該程序後,該程序創建了2個頂點的圖形以及它們之間的邊。我查詢了這些表,並在每個表中找到了一些十六進制值。
我有以下問題:
如何在圖表存儲在卡桑德拉?
現在,我有這個圖表說'x'存儲在卡桑德拉。說我創建了另一個圖表'y'並存儲它。如何能夠檢索和遍歷任何特定的圖形?因爲在正常的cql查詢中,您知道要查詢的表和列。我將如何分別識別'x'和'y'。
任何人都可以幫助在java中發佈示例代碼來使用一些示例csv數據創建圖形。存儲在Cassandra和一些遍歷相同圖形的例子。由於沒有這樣的例子可以理解,所以會很有幫助。
你真的需要泰坦嗎? Datastax在Cassandra上有圖表。 http://www.datastax.com/dse-graph-campaign/index.html –
@ cricket_007只有我相信DSE纔是商業產品。所以如果你不能把錢留給DSE,那麼使用泰坦是一個很好的選擇。 [JanusGraph](https://github.com/JanusGraph/janusgraph)也是一個不錯的免費選擇。 –
@FilipeTeixeira我註冊了一個免費帳戶,並在 –