我的错是什么?

时间:2015-03-16 13:14:24

标签: python-2.7 titan rexster bulbs

这是我的rexster.xml文件,配置如下

  <?xml version="1.0" encoding="UTF-8"?>
   <rexster>
        <http>
           <server-port>8182</server-port>
            <server-host>0.0.0.0</server-host>
            <base-uri>http://localhost</base-uri>
            <web-root>public</web-root>
            <character-set>UTF-8</character-set>
            <enable-jmx>false</enable-jmx>
            <enable-doghouse>true</enable-doghouse>
            <max-post-size>2097152</max-post-size>
            <max-header-size>8192</max-header-size>
            <upload-timeout-millis>30000</upload-timeout-millis>
            <thread-pool>
            <worker>
                <core-size>8</core-size>
                <max-size>8</max-size>
            </worker>
            <kernal>
                <core-size>4</core-size>
                <max-size>4</max-size>
            </kernal>
            </thread-pool>
                 <io-strategy>leader-follower</io-strategy>
        </http>
        <rexpro>
            <server-port>8184</server-port>
             <server-host>0.0.0.0</server-host>
             <session-max-idle>1790000</session-max-idle>
             <session-check-interval>3000000</session-check-interval>
             <connection-max-idle>180000</connection-max-idle>
              <connection-check-interval>3000000</connection-check-interval>
              <enable-jmx>false</enable-jmx>
              <thread-pool>
         <worker>
            <core-size>8</core-size>
            <max-size>8</max-size>
        </worker>
        <kernal>
            <core-size>4</core-size>
            <max-size>4</max-size>
        </kernal>
         </thread-pool>
          <io-strategy>leader-follower</io-strategy>
      </rexpro>
       <shutdown-port>8183</shutdown-port>
       <shutdown-host>127.0.0.1</shutdown-host>
      <script-engine-reset-threshold>-1</script-engine-reset-threshold>
      <script-engine-init>data/init.groovy</script-engine-init>
      <script-engines>gremlin-groovy</script-engines>
      <security>
          <authentication>
                <type>none</type>
                 <configuration>
            <users>
                <user>
                    <username>rexster</username>
                    <password>rexster</password>
                </user>
            </users>
        </configuration>
    </authentication>
         </security>
     <graphs>

       <graph>
        <graph-name>ramgraph</graph-name>
        <graph-type>tinkergraph</graph-type>
        <graph-mock-tx>false</graph-mock-tx>
    <properties>
            <storage.backend>cassandra</storage.backend>
    <storage.hostname>localhost</storage.hostname>
            <storage.buffer-size>100</storage.buffer-size>
        </properties>
        <extensions>
            <allows>
                <allow>tp:gremlin</allow>
            </allows>
        </extensions>
    </graph>



    <graph>
        <graph-name>titanexample</graph-name>
            <graphtype>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
        <graph-location>/tmp/titan</graph-location>
        <graph-read-only>false</graph-read-only>
        <properties>
            <storage.backend>local</storage.backend>
            <storage.buffer-size>100</storage.buffer-size>
        </properties>
        <extensions>
        <allows>
            <allow>tp:gremlin</allow>
        </allows>
       </extensions>
   </graph>





      </graphs>
  </rexster>

我写了一个带有灯泡的python客户端,如下所示

   __author__ = 'rponnapureddy'
   from bulbs.config import Config, DEBUG
   from bulbs.rexster import Graph

   from bulbs.rexster import Graph

   # config = Config('http://localhost:8182/graphs/empgraph')
   config = Config('http://localhost:8182/graphs/ramgraph')

   g = Graph(config)

   class inser_class():
       ponnapu = g.vertices.create(name="ramnath")
       pr = g.vertices.create(name="reddy")
       tanu = g.vertices.create(name="brothers")
       g.edges.create(pr, "knows", tanu)
       # z=g.get_graphml()
       #print z
       #g.clear()
       # print z

我得到了以下错误。要纠正我的所作答案?

'usr / bin / python2.7“/ home / rpo / Desktop / ramnathreddy / addverices to rexsterdefault graph.py”      Traceback(最近一次调用最后一次):       文件“/ home / rpo / Desktop / ramnath / addverices to rexsterdefault graph.py”,第10行,in       g =图表(配置)       在 init 中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/graph.py”,第56行       super(Graph,self)。 init (config)       在 init 中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/base/graph.py”,第58行       self.vertices = self.build_proxy(Vertex)       在build_proxy中的文件“/usr/local/lib/python2.7/dist-packages/bulbs/base/graph.py”,第124行       return self.factory.build_element_proxy(element_class,index_class)       在build_element_proxy中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/factory.py”,第19行       primary_index = self.get_index(element_class,index_class,index_name)       在get_index中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/factory.py”,第27行       index = index_proxy.get_or_create(index_name)       在get_or_create中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/index.py”,第80行       resp = self.client.get_or_create_vertex_index(index_name,index_params)       在get_or_create_vertex_index中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py”,第668行       resp = self.gremlin(script,params)       在gremlin中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py”,第356行       return self.request.post(gremlin_path,params)       文件“/usr/local/lib/python2.7/dist-packages/bulbs/rest.py”,第131行,在帖子中       return self.request(POST,path,params)       请求文件“/usr/local/lib/python2.7/dist-packages/bulbs/rest.py”,第186行       return self.response_class(http_resp,self.config)       在 init 中输入文件“/usr/local/lib/python2.7/dist- packages / bulbs / rexster / client.py”,第198行       self.handle_response(响应)      在handle_response中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py”,第222行      response_handler(http_resp)      在server_error中输入文件“/usr/local/lib/python2.7/dist-packages/bulbs/rest.py”,第50行      引发SystemError(http_resp)      SystemError:({'status':'500','transfer-encoding':'chunked','server':'grizzly / 2.2.16','connection':'close','date':'Mon,16 2015年3月11日32:19 GMT','access-control-allow-origin':'*','content-type':'application / json'},'{“message”:“”,“error”: “javax.script.ScriptException:groovy.lang.MissingMethodException:没有方法签名:groovy.lang.MissingMethodException.rollback()适用于参数类型:()值:[] \ n可能的解决方案:collect(),collect(groovy) .lang.Closure),collect(java.util.Collection,groovy.lang.Closure)“,”api“:{”description“:”为图表评估一个特殊的Gremlin脚本。“,”parameters“:{ “rexster.returnKeys”:“要返回的元素属性键数组(默认是返回所有元素属性)”,“rexster.showTypes”:“显示元素的属性及其本机数据类型(默认为false)” ,“load”:“在''脚本'之前执行的''存储过程'列表'(如果未指定\'脚本\'则最后一次写入此参数中的pt将返回值“,”rexster.offset.end“:”要返回的分页数据集的结束索引“,”rexster.offset.start“:”将分页数据集的起始索引转换为返回“,”params“:”绑定到脚本引擎的参数映射“,”语言“:”要使用的gremlin语言风格(默认为groovy)“,”script“:”要评估的Gremlin脚本“}},” 成功“:假}')

Process finished with exit code 1'

1 个答案:

答案 0 :(得分:0)

from bulbs.config import Config, DEBUG
from bulbs.rexster import Graph
from bulbs.titan import Graph

config = Config('http://localhost:8182/graphs/ramgraph')
g = Graph(config)


class inser_class():
    ponnapu = g.vertices.create(name="reddy", age="26", state="TELNGANA", mobn="111111111")
    pr = g.vertices.create(name="ramnath" ,age="25" , state="TELNGANA", mobn="1111111")
    tanu = g.vertices.create (name="ponnapu",age="27",state="AP",mobn="11111111111111")
    g.edges.create(pr, "knows", tanu)
    g.edges.create(pr, "friends", ponnapu)
    g.edges.create(ponnapu, "dontknow",tanu)