【发布时间】:2014-09-09 08:46:30
【问题描述】:
我正在使用 TitanGraphDB + Cassandra。我按如下方式启动Titan
cd titan-cassandra-0.3.1
bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties
我有一个 Rexster shell,可以用来与上面的 Titan + Cassandra 通信。
cd rexster-console-2.3.0
bin/rexster-console.sh
我正在尝试使用 Titan Graph DB 对网络拓扑进行建模。我想从我的 python 程序中对 Titan Graph DB 进行编程。我为此使用灯泡包。 我创建了五种类型的顶点
- switch
- port
- device
- flow
- flow_entry
我在逻辑连接的顶点之间创建边。边缘没有标记。
假设我想测试Vertex A和Vertex B之间的连通性
我有一个 groovy 脚本 is_connected.groovy
def isConnected (portA, portB) {
return portA.both().retain([portB]).hasNext()
}
现在从我的 rexster 控制台
g = rexster.getGraph("graph")
==>titangraph[embeddedcassandra:null]
rexster[groovy]> g.V('type', 'flow')
==>v[116]
==>v[100]
rexster[groovy]> g.V('type', 'flow_entry')
==>v[120]
==>v[104]
正如你在上面看到的,我有两个流类型的顶点v[116] 和v[100]
我有两个flow_entryv[120] 和v[104] 类型的顶点
我想检查v[120] 和v[116] 之间的连通性,例如
rexster[groovy]> ?e is_connected.groovy
==>null
rexster[groovy]> is_connected(g.v[116],g.v[120])
==>An error occurred while processing the script for language [groovy]. All transactions across all graphs in the session have been concluded with failure: java.util.concurrent.ExecutionException: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: v for class: com.thinkaurelius.titan.graphdb.database.StandardTitanGraph
要么我做错了什么,要么我遗漏了一些明显的东西。如果你能指出我正确的方向,那就太好了。
【问题讨论】:
标签: groovy cassandra titan bulbs rexster