python-2.7titanrexsterbulbs

What is my mistake?


This is my rexster.xml file configured as below

  <?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>

and i wrote a python client with bulbs like as below

   __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

I got below error . To correct answer what i have do ?

'usr/bin/python2.7 "/home/rpo/Desktop/ramnathreddy/addverices to rexsterdefault graph.py" Traceback (most recent call last): File "/home/rpo/Desktop/ramnath/addverices to rexsterdefault graph.py", line 10, in g = Graph(config) File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/graph.py", line 56, in init super(Graph, self).init(config) File "/usr/local/lib/python2.7/dist-packages/bulbs/base/graph.py", line 58, in init self.vertices = self.build_proxy(Vertex) File "/usr/local/lib/python2.7/dist-packages/bulbs/base/graph.py", line 124, in build_proxy return self.factory.build_element_proxy(element_class, index_class) File "/usr/local/lib/python2.7/dist-packages/bulbs/factory.py", line 19, in build_element_proxy primary_index = self.get_index(element_class,index_class,index_name) File "/usr/local/lib/python2.7/dist-packages/bulbs/factory.py", line 27, in get_index index = index_proxy.get_or_create(index_name) File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/index.py", line 80, in get_or_create resp = self.client.get_or_create_vertex_index(index_name, index_params) File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 668, in get_or_create_vertex_index resp = self.gremlin(script, params) File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 356, in gremlin return self.request.post(gremlin_path, params) File "/usr/local/lib/python2.7/dist-packages/bulbs/rest.py", line 131, in post return self.request(POST, path, params) File "/usr/local/lib/python2.7/dist-packages/bulbs/rest.py", line 186, in request return self.response_class(http_resp, self.config) File "/usr/local/lib/python2.7/dist- packages/bulbs/rexster/client.py", line 198, in init self.handle_response(response) File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 222, in handle_response response_handler(http_resp) File "/usr/local/lib/python2.7/dist-packages/bulbs/rest.py", line 50, in server_error raise 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: No signature of method: groovy.lang.MissingMethodException.rollback() is applicable for argument types: () values: []\nPossible solutions: collect(), collect(groovy.lang.Closure), collect(java.util.Collection, groovy.lang.Closure)","api":{"description":"evaluate an ad-hoc Gremlin script for a graph.","parameters":{"rexster.returnKeys":"an array of element property keys to return (default is to return all element properties)","rexster.showTypes":"displays the properties of the elements with their native data type (default is false)","load":"a list of \'stored procedures\' to execute prior to the \'script\' (if \'script\' is not specified then the last script in this argument will return the values","rexster.offset.end":"end index for a paged set of data to be returned","rexster.offset.start":"start index for a paged set of data to be returned","params":"a map of parameters to bind to the script engine","language":"the gremlin language flavor to use (default to groovy)","script":"the Gremlin script to be evaluated"}},"success":false}')

Process finished with exit code 1'

Solution

  • 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)