-4

这是我的 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 (最近一次调用最后): File "/home/rpo/Desktop/ramnath/addverices to rexsterdefault graph.py ”,第 10 行,在 g = Graph(config) 文件中“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/graph.py”,第 56 行,在init super(Graph, self) 中。init(配置)文件“/usr/local/lib/python2.7/dist-packages/bulbs/base/graph.py”,第 58 行,在init self.vertices = self.build_proxy(Vertex) 文件“/usr/local/lib/python2.7/dist-packages/bulbs/base/graph.py”,第 124 行,在 build_proxy 返回 self.factory.build_element_proxy(element_class, index_class) 文件“/usr/local/lib/python2.7/dist-packages/bulbs/factory.py”,第 19 行,在 build_element_proxy primary_index = self.get_index(element_class,index_class,index_name) 文件“/usr/local/ lib/python2.7/dist-packages/bulbs/factory.py”,第 27 行,在 get_index index = index_proxy.get_or_create(index_name) 文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster /index.py”,第 80 行,在 get_or_create resp = self.client.get_or_create_vertex_index(index_name, index_params) 文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py”,行668,在 get_or_create_vertex_index resp = self.gremlin(script, params) 文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py”,第 356 行,在 gremlin 中返回 self.request.post( gremlin_path, params) 文件“/usr/local/lib/python2.7/dist-packages/bulbs/rest.py”,第 131 行,后返回 self.request(POST, path, params) 文件“/usr/local /lib/python2.7/dist-packages/bulbs/rest.py”,第 186 行,在请求中返回 self.response_class(http_resp, self.config) 文件“/usr/local/lib/python2.7/dist-packages /bulbs/rexster/client.py”,第 198 行,在参数)文件“/usr/local/lib/python2.7/dist-packages/bulbs/rest.py”,第 131 行,在后返回 self.request(POST,路径,参数)文件“/usr/local/lib /python2.7/dist-packages/bulbs/rest.py”,第 186 行,在请求中返回 self.response_class(http_resp, self.config) 文件“/usr/local/lib/python2.7/dist-packages/bulbs /rexster/client.py”,第 198 行,在参数)文件“/usr/local/lib/python2.7/dist-packages/bulbs/rest.py”,第 131 行,在后返回 self.request(POST,路径,参数)文件“/usr/local/lib /python2.7/dist-packages/bulbs/rest.py”,第 186 行,在请求中返回 self.response_class(http_resp, self.config) 文件“/usr/local/lib/python2.7/dist-packages/bulbs /rexster/client.py”,第 198 行,在在里面 self.handle_response(response) 文件“/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py”,第 222 行,在 handle_response response_handler(http_resp) 文件“/usr/local/lib/ python2.7/dist-packages/bulbs/rest.py",第 50 行,在 server_error 中引发 SystemError(http_resp) SystemError: ({'status': '500', 'transfer-encoding': 'chunked', 'server' : 'grizzly/2.2.16', 'connection': 'close', 'date': 'Mon, 16 Mar 2015 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":"为图评估一个 ad-hoc Gremlin 脚本。","parameters":{"rexster.returnKeys":"要返回的元素属性键数组(默认是返回所有元素properties)","re​​xster.showTypes":"显示元素的属性及其本机数据类型(默认为 false)","load":"要在 \' 之前执行的 \'存储过程\' 的列表script\'(如果未指定 \'script\',则此参数中的最后一个脚本将返回值","re​​xster.offset.end":"要返回的分页数据集的结束索引","re​​xster.offset.start":"要返回的分页数据集的开始索引","params":"要绑定到脚本引擎的参数映射","language":"要使用的 gremlin 语言风格(默认为 groovy)","script":"要评估的 Gremlin 脚本"}},"success":false}')

Process finished with exit code 1'
4

1 回答 1

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)
于 2015-03-19T13:37:18.307 回答