【问题标题】:Rexster query returns "No such property: v for class: com.thinkaurelius.titan.graphdb.database.StandardTitanGraph"Rexster 查询返回“No such property: v for class: com.thinkaurelius.titan.graphdb.database.StandardTitanGraph”
【发布时间】: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 AVertex 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


    【解决方案1】:

    此语法无效:

    is_connected(g.v[116],g.v[120])
    

    应该是:

    is_connected(g.v(116),g.v(120))
    

    【讨论】:

    • 请注意,他的 Gremlin-Groovy 脚本的函数定义是 Groovy 风格的 camelCase isConnected(),但在 Rexster 控制台中,他使用的是 Python 风格的 snake_case is_connected()——这不起作用。
    【解决方案2】:

    您将 Python 语法与 Gremlin-Groovy 语法混为一谈:

    您将 Groovy 脚本定义为:

    def isConnected (portA, portB) {
        return portA.both().retain([portB]).hasNext()
    }
    

    ...所以...

    rexster[groovy]> is_connected(g.v[116], g.v[120])
    

    ...应该是...

    rexster[groovy]> isConnected(g.v(116), g.v(120))
    

    【讨论】:

      猜你喜欢
      • 2017-03-05
      • 1970-01-01
      • 2015-06-26
      • 1970-01-01
      • 1970-01-01
      • 2022-12-15
      • 2018-05-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多