Git Product home page Git Product logo

bulbs's Introduction

Bulbs

a Python persistence framework for graph databases

What is Bulbs?

Bulbs is a Python persistence framework for graph databases that supports Python 3 and Python 2.7 originally created by James Thornton.

It connects to several graph-database servers, including Neo4j Server and Rexster.

Neo4j Server is Neo4j's open-source REST server, and it is available as an Heroku Add On.

Rexster is a graph-database REST server optimized for recommendations. It is part of the TinkerPop stack and connects to any Blueprints-enabled graph database, including Neo4j, OrientDB, Dex, OpenRDF Sail, and TinkerGraph.

Bulbs supports pluggable back ends, and more native bindings are in the works.

Is it ready?

A preview release is out now, and I welcome feedback on how to improve it. The API will probably change somewhat until we hit 1.0.

What do I need?

And a few Python libraries, such as ujson and httplib2.

Where are the docs?

The 0.3.x docs are now online at Bulbflow.org.

Where can I get help?

bulbs's People

Contributors

747project avatar arusahni avatar barbogast avatar espeed avatar etabard avatar etandel avatar honzakral avatar jeffjirsa avatar kefirbandi avatar luckenbach avatar michalpodeszwa avatar nidico avatar sroberts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bulbs's Issues

index.count() doesnt work

calling g.edges.index.count() or g.vertices.index.count() results in the following error:

Users/arthur/Projects/bulbs_src/bulbs/bulbs/neo4jserver/index.pyc in count(self, key, value, **pair)
    125         :type index_name: str
    126 
--> 127         :rtype: bulbs.neo4jserver.index.Index
    128 
    129         """

ValueError: invalid literal for int() with base 10: 'javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method count() on null object'```

[bulbs.model] not defined Properties are not saved in NORMAL mode

My use case:

class NodeTest(Node):
    element_type = "test"
    id = String(default=VertexId)
    definiedProperty = String()

proxy = client.build_proxy(NodeTest)
a = proxy.create(definiedProperty="toto", notDefiniedProperty="toto42")
a.data()
>>> {'definiedProperty': 'toto', 'id': '50356f3f015bf40c0bdb2e4e0'}

mode is NORMAL and the comments in the code say :

#: The mode for saving attributes to the database. 
    #: If set to STRICT, only defined Properties are saved.
    #: If set to NORMAL, all attributes are saved. 
    #: Defaults to NORMAL.

Am I missing something or this is a bug ?

Thanks,

  • Emmanuel

use of transactions

dear

can we do transactions (acid) with bulbs and rester (neo4j database) ?

thanks

Support Non-Integer IDs

Right now Bulbs converts the _id string to an int, but OrientDB doesn't use integer IDs. We need to handle this gracefully.

Website down

Hi, trying to access the docs at bulbflow.com but the website is not available ("Server not found")

Support to pickle on the bulbls models

James it would be great to add pickle support to models, i am trying to write a pull request with no success an checked the python pickle protocol.

My main use case for this feature is to pickle a model and add it to the memcached.

Thank you

LinkedData Client error

Hi James,

I try the LinkedData Client following Bulbflow quickstart:

>>> from bulbs.graph import Graph
>>> g = Graph(' http://localhost:8182/sailgraph')
>>> v = g.v('http://data.semanticweb.org/person/christian-bizer')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Graph' object has no attribute 'v'

because g.v() is not (yet?) implemented in Bulbs. The current syntax is

>>> v = g.vertices.get('http://data.semanticweb.org/person/christian-bizer')

Unfortunately, it returns:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bulbs-0.2_devdev_20110730-py2.6.egg/bulbs/element.py", line 504, in get
    resp = self.resource.get(target,params=None)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bulbs-0.2_devdev_20110730-py2.6.egg/bulbs/rest.py", line 43, in get
    return self.request("GET",target,params)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bulbs-0.2_devdev_20110730-py2.6.egg/bulbs/rest.py", line 92, in request
    resp = Response(http.request(url, method, body, headers))
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/httplib2-0.7.1-py2.6.egg/httplib2/__init__.py", line 1288, in request
    (scheme, authority, request_uri, defrag_uri) = urlnorm(uri)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/httplib2-0.7.1-py2.6.egg/httplib2/__init__.py", line 203, in urlnorm
    raise RelativeURIError("Only absolute URIs are allowed. uri = %s" % uri)
httplib2.RelativeURIError: Only absolute URIs are allowed. uri = :///sailgraph/vertices/http%3A//data.semanticweb.org/person/christian-bizer

?

Pierre

Stack Diagram

One of the most helpful pieces of information about getting bulbs up and running would be a diagram of all the various services and pieces of software, how they communicate, and which one's are on top of which.

This is the first time I've ever used Maven to build any software, and it's a bit unexpected that rexter.sh seems to know where neo4j is although I never remember explicitly installing it into the system. Normally build to local directory and installation are separate processes. This throws people like me off who just aren't used to Java environments.

It's difficult to tell where Gremlin lives when query or command from gremlin.py are called. Was it part of a process spun up by Rexster when I put it in the config? Does Neo4j run as a DB and Rexster as a Server?

So far the biggest issue I'm having is just getting a connection to my Neo4J DB. I had to finangle the build a bit and will re-try with a focus on accuracy of process and report my results. Code is documented thoroughly in the guts, and that's really helping me along. Nice work!

Change the Type System to Map Python Floats to Rexster/Java Doubles

Right now the Bulbs type system is mapping Python floats to Rexster/Java floats (https://github.com/espeed/bulbs/blob/master/bulbs/property.py#L114, https://github.com/tinkerpop/rexster/wiki/Property-Data-Types), but mapping Python floats to Java floats can lose precision.

Python floats are mapped to C doubles (http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex, http://docs.python.org/tutorial/floatingpoint.html), and Python time.time() "timestamps" are typed as floats. Saving a Python timestamp as a Rexster float won't work because the number is too big for a Java float (see https://github.com/tinkerpop/rexster/issues/156).

Handle deadlock response from API

When creating an edge, my neo4j server is returning "org.neo4j.kernel.DeadlockDetectedException: Transaction(4116)[STATUS_ACTIVE,Resources=0] can't wait on resource RWLock[Node[2]] since => Transaction(4116)[STATUS_ACTIVE,Resources=0] <-[:HELD_BY]- RWLock[Node[5]] <-[:WAITING_FOR]- Transaction(4116)[STATUS_ACTIVE,Resources=0] <-[:HELD_BY]-RWLock[Node[2]]"

In client.py:Neo4JResult.get_uri, this response is not handled since the type of that is a unicode string and the code wants to call .get('self') on it.

Update Bulbs to work with Rexster/Gremlin HEAD

The response format from Rexster has changed and current version of Bulbs seems to be incompatible.

In [4]: g.V
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)


/usr/local/lib/python2.7/dist-packages/bulbs-0.2.1-py2.7.egg/bulbs/graph.pyc in V(self)
     61         """
     62         vertices = self.gremlin.query("g.V",Vertex,raw=True)
---> 63         return list(vertices)
     64 
     65     @property

/usr/local/lib/python2.7/dist-packages/bulbs-0.2.1-py2.7.egg/bulbs/gremlin.pyc in query(self, script, *classes, **kwds)                                                                                                                     
     63         raw = kwds.pop('raw',False)
     64         resp = self._query(script,*classes,**kwds)
---> 65         for result in resp.results:
     66             yield self._initialize_result(result,raw)
     67 

AttributeError: 'Response' object has no attribute 'results'

When executing a shortestpath query, parsing result fail with a KeyError

I execute this cypher query :

POST url: http://localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query
POST body: {"query":"START d=node(3), e=node(4) MATCH p=shortestPath(d-[*..3]->e) RETURN p","params":null}

The result from server is (pprint of self.raw before exception raise) :

{u'end': u'http://localhost:7474/db/data/node/4',
u'length': 1,
u'nodes': [u'http://localhost:7474/db/data/node/3',
u'http://localhost:7474/db/data/node/4'],
u'relationships': [u'http://localhost:7474/db/data/relationship/2'],
u'start': u'http://localhost:7474/db/data/node/3'}

The stack trace (looking for 'self' in result fail with a KeyError) :

r.next()

File "/Volumes/development/perso/sandbox/.env/lib/python2.6/site-packages/bulbs/utils.py", line 58, in initialize_elements
yield initialize_element(client,result)
File "/Volumes/development/perso/sandbox/.env/lib/python2.6/site-packages/bulbs/utils.py", line 63, in initialize_element
element_class = get_element_class(client,result)
File "/Volumes/development/perso/sandbox/.env/lib/python2.6/site-packages/bulbs/utils.py", line 69, in get_element_class
element_key = get_element_key(client,result)
File "/Volumes/development/perso/sandbox/.env/lib/python2.6/site-packages/bulbs/utils.py", line 80, in get_element_key
base_type = result.get_type()
File "/Volumes/development/perso/sandbox/.env/lib/python2.6/site-packages/bulbs/neo4jserver/client.py", line 86, in get_type
return self.type_map[neo4j_type]
KeyError: None

Bulbs assumes the gremlin.groovy query return type?

Attempt to get an integer return value from a query to count query items resulted in a generator object.

example:
def get_num_bids(auctionid) {
return g.v(auctionid).out('bidedge').count()
}
printing the result:
Number of Bids: generator object initialize_elements at 0x7fccec02e9b0

the quick hack, but slower alternative:
num_bids = len(list(g.gremlin.query(g.scripts.get("get_bids"),{'id':auction.eid})))

save_graphml

Hello,
I'm not sure if it is just my setup, but when I run save_graphml I get:

f = g.save_graphml()
Traceback (most recent call last):
File "", line 1, in
File "/home/craig/pion/src/bulbs/bulbs/graph.py", line 183, in save_graphml
resp = self.resource.get(self.base_target,params)
AttributeError: 'Graph' object has no attribute 'base_target'

This is on ubuntu with python 2.7.1

Craig

Documentation issues

Hi James,

I have started to look at Bulbs documentation. Impressive work for 0.2 version.

Here are some issues I have already noticed:

URLs used in toolbar have some side-effects:

By using correct URLs in toolbar, you may avoid all those issues:

Overview http://bulbflow.com/docs/overview/
Download http://bulbflow.com/docs/download/
Documentation http://bulbflow.com/docs
Community http://bulbflow.com/docs/community/

There are also some typos:

in http://bulbflow.com/docs/overview/

graph-traveral language
=> graph-traversal language

because you can to plug into
=> because you can plug into

object-orientated programming
=> object-oriented programming

graph-programming language
=> graph-based programming language

in http://bulbflow.com/docs/download/

make sure you have Git and Mavern installed
=> make sure you have Git and Maven installed

HTH,
Pierre

Add Support for Rexster Paging Params

Bulbs supports paging the Gremlin way:

>>> from bulbs.graph import Graph
>>> g = Graph('http://localhost:8182/neo4jenron')
>>> g.gremlin.query('g.V[0..9]')

But it would nice to support the Rexster paging params too.

Add Documentation on How to Set Up Your Local Config

Bulbs looks to see if you set a BULBS_CONFIG environment variable pointing to a bulbs_config.py module.

If you haven't, when you import bulbs you'll see a message saying:

Unable to import your local config file. Using default settings.  

Add documentation explaining how to set up the local config file.

gremlin.groovy file missing

Hi,

After running "setup.py install" the gremlin.groovy file is missing from the bulbs site-packages directory. This leads to the following error when trying to use bulbs:

  File "/Users/arthur/Envs/food/lib/python2.7/site-packages/bulbs-0.3ddev_20120309-py2.7.egg/bulbs/groovy.py", line 139, in scan
    fin = open(file_path, 'r')    
IOError: [Errno 2] No such file or directory: '/Users/arthur/Envs/food/lib/python2.7/site-packages/bulbs-0.3ddev_20120309-py2.7.egg/bulbs/gremlin.groovy'

Port Exhaustion on Windows

When making lots of repeated requests (such as to insert data), there can be too many connections left open, leaving to port exhaustion, as described here:
http://msdn.microsoft.com/en-us/library/aa560610%28v=bts.20%29.aspx

The following code can create the problem on my machine after around 3900 requests:

port_exhaustion.py

from bulbs.graph import Graph
g = Graph('http://localhost:8182/emptygraph')
dataset = []
for i in range(5000):
datadict = {}
datadict['a'] = 'test'
dataset.append(datadict)
for i, data in enumerate(dataset):
print i
vertex = g.vertices.create(data)
print i
print "finished"

with the following error:
Traceback (most recent call last):
File "C:/Python26/port_exhaustion.py", line 14, in
vertex = g.vertices.create(data)
File "C:\Python26\lib\site-packages\bulbs-0.2_devdev_20110715-py2.6.egg\bulbs\element.py", line 467, in create
resp = self.resource.post(target,data)
File "C:\Python26\lib\site-packages\bulbs-0.2_devdev_20110715-py2.6.egg\bulbs\rest.py", line 47, in post
return self.request("POST",target,params)
File "C:\Python26\lib\site-packages\bulbs-0.2_devdev_20110715-py2.6.egg\bulbs\rest.py", line 94, in request
resp = Response(http.request(url, method, body, headers))
File "C:\Python26\lib\site-packages\httplib2-0.7.1-py2.6.egg\httplib2__init__.py", line 1436, in request
(response, content) = self.request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "C:\Python26\lib\site-packages\httplib2-0.7.1-py2.6.egg\httplib2__init
_.py", line 1188, in request
(response, content) = self.conn_request(conn, request_uri, method, body, headers)
File "C:\Python26\lib\site-packages\httplib2-0.7.1-py2.6.egg\httplib2__init
.py", line 1162, in conn_request
conn.connect()
File "C:\Python26\lib\site-packages\httplib2-0.7.1-py2.6.egg\httplib2__init
_.py", line 796, in connect
raise socket.error, msg
error: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted

It seems the issue is that httplib2 leaves the connections in CLOSE_WAIT by default:
http://code.google.com/p/httplib2/issues/detail?id=41

but adding "connection": "close" to the headers fixes the problem:
in rest.py, line 67, change:
headers = {'Accept': 'application/json'}

to:
headers = {'Accept': 'application/json', "connection": "close"}

recursion error when subclassing Relationship

Hello,
When I try to create an instance of a Relationship subclass, I get a recursion error:

import time
from bulbs.model import Relationship, Node
from bulbs.property import Property, String, Integer, Float

class Entry(Node):
element_type = 'entry'
text = Property(String)

class User(Node):
element_type = 'user'
name = Property(String)

class CreatedBy(Relationship):

label = "created_by"
timestamp = Property(Float, default="current_timestamp", nullable=False)

@property
def entry(self):
    return Entry.get(self.outV)

@property
def user(self):
    return User.get(self.inV)

def current_timestamp(self):
    return time.time()

craig = User(name='craig')
entry = Entry(text='hi, here is my entry')
CreatedBy(craig, entry)

python example.py
Unable to import your local config file. Using default settings.
Exception RuntimeError: 'maximum recursion depth exceeded in subclasscheck' in <type 'exceptions.AttributeError'> ignored

I know this error occurs when I create a CreatedBy instance because the error disappears when I comment the last line out.

Batch and Message

Hi,

I'm trying to perform batch insert with the batch and message class. But can't execute the Neo4jBatch.send() command since the "Neo4jClient" don't have the attribute "batch".

Do you have an example on how to use these to perform batch operations or is this a work in progress?

Regards Calle

Unique index with neo4j

Hi ! I was looking for unique indexes with bulbs and neo4j and I found this in the source :

# Uncdocumented -- experimental
class UniqueIndex(ExactIndex):
    pass

class Property(object):

     ...

     # These aren't implemented yet.         
     # TODO: unique creates an index
     self.indexed = indexed
     self.unique = unique

Could you give me status on that ? Do you need help ?

can't install bulbs

Using Ubuntu desktop 64-bit 12.04

Any thoughts?

Here's a copy of what I did and what I got in response:

jonathan@ubuntu:$ virtualenv --never-download --system-site-packages env2
New python executable in env2/bin/python
Installing setuptools............done.
Installing pip...............done.
jonathan@ubuntu:
$ cd env2
jonathan@ubuntu:/env2$ source bin/activate
(env2)jonathan@ubuntu:
/env2$ pip install https://github.com/espeed/bulbs/tarball/master
Downloading/unpacking https://github.com/espeed/bulbs/tarball/master
Downloading master (165Kb): 165Kb downloaded
Running setup.py egg_info for package from https://github.com/espeed/bulbs/tarball/master

warning: no previously-included files matching '*~' found under directory '.'
warning: no previously-included files matching '*.pyc' found under directory '.'
no previously-included directories found matching '*/*/old'
no previously-included directories found matching '*/old'

Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/local/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Requirement already satisfied (use --upgrade to upgrade): httplib2>=0.7.2 in /usr/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Downloading/unpacking pyyaml>=3.10 (from bulbs==0.3.3-20120715)
Downloading PyYAML-3.10.zip (364Kb): 364Kb downloaded
Running setup.py egg_info for package pyyaml

Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/local/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Downloading/unpacking ujson>=1.15 (from bulbs==0.3.3-20120715)
Downloading ujson-1.19.zip (191Kb): 191Kb downloaded
Running setup.py egg_info for package ujson

warning: no files found matching 'setup.y'

Requirement already satisfied (use --upgrade to upgrade): python-dateutil==1.5 in /usr/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Installing collected packages: pyyaml, ujson, bulbs
Running setup.py install for pyyaml
checking if libyaml is compilable
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory
compilation terminated.

libyaml is not found or a compiler error: forcing --without-libyaml
(if libyaml is installed correctly, you may need to
 specify the option --include-dirs or uncomment and
 modify the parameter include_dirs in setup.cfg)

Running setup.py install for ujson
building 'ujson' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/ujson.c -o build/temp.linux-x86_64-2.7/./python/ujson.o
In file included from ./python/ujson.c:34:0:
./python/py_defines.h:34:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/jonathan/env2/bin/python -c "import setuptools;file='/home/jonathan/env2/build/ujson/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /tmp/pip-VHuK7N-record/install-record.txt --install-headers /home/jonathan/env2/include/site/python2.7:
running install

running build

running build_ext

building 'ujson' extension

creating build

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/python

creating build/temp.linux-x86_64-2.7/lib

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/ujson.c -o build/temp.linux-x86_64-2.7/./python/ujson.o

In file included from ./python/ujson.c:34:0:

./python/py_defines.h:34:20: fatal error: Python.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1


Command /home/jonathan/env2/bin/python -c "import setuptools;file='/home/jonathan/env2/build/ujson/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /tmp/pip-VHuK7N-record/install-record.txt --install-headers /home/jonathan/env2/include/site/python2.7 failed with error code 1 in /home/jonathan/env2/build/ujson
Storing complete log in /home/jonathan/.pip/pip.log

'NoneType' object is not iterable

When trying to execute the following code:

james = g.vertices.create({'name':'James'})
julie = g.vertices.create({'name':'Julie'})
g.edges.create(james,"knows",julie)

g.V

The following exception is raised:

TypeError: 'NoneType' object is not iterable

I'm using Bulbs 0.2.2, Gremlin 1.5 and Rexster 0.8 with Neo4j as a backend.

Change Graph constructor defaults

I guess that with the new Configuration object in 0.3 this bug may be obsolete, but anyway:

Graph takes a constructor parameter db_url that has config.DATABASE_URL as default value. This causes problems because default parameters in python are evaluated when importing for the first time, and never again. If config.DATABASE_URL changes, the constructor will keep using the old value. This is a feature from python.

To solve this, change the constructor like this:

def __init__(self, db_url=None):
    self.db_url = db_url if db_url else config.DATABASE_URL

This way, config.DATABASE_URL will be evaluated for every constructor call

Clearing a graph in OrientDB through Rexster crashes OrientDB

Here's what I did:

from bulbs.graph import Graph

g = Graph("http://localhost:8182/graphs/orientdbsample")

g.clear()
print g.V

This is the traceback:

Traceback (most recent call last):
File "", line 6, in
print g.V
File "/usr/local/lib/python2.7/dist-packages/bulbs-0.2.2-py2.7.egg/bulbs/graph.py", line 64, in V
return list(vertices)
File "/usr/local/lib/python2.7/dist-packages/bulbs-0.2.2-py2.7.egg/bulbs/gremlin.py", line 66, in query
for result in resp.results:
TypeError: 'NoneType' object is not iterable

Rexster prints this:
[WARN] GraphResource - The [tp:gremlin+*] extension raised an error response.

Every time I do this, I have to restart Rexster, because even a simple "g.V" will raise this error. I can't figure out if this is a bug in Bulbs or in Rexster or in OrientDB. Also I haven't figured out a way to "bulk" delete vertices with gremlin.

Properties aren't being saved on Relationship.create()

Craig reported this...

If you create a relationship with keyword args, the keyword args don't seem to get saved on the resulting edge:

from bulbs.graph import Graph
Unable to import your local config file. Using default settings.
g = Graph()
g.clear()
<bulbs.rest.Response object at 0x103d20dd0>
james = g.vertices.create({'name':'James'})
julie = g.vertices.create({'name':'Julie'})
e = g.edges.create(james,"knows",julie, data=dict(relationship='frien
ds'))
e.map
{u'relationship': u'friends'}

This works fine, but if you create the edge with a Relationship:

from bulbs.model import Relationship
e = Relationship.create(james, 'knows', julie, relationship='friends')
e.map
{}

Then the keywords don't get saved.

can't install bulbs

jonathan@ubuntu:$ virtualenv --never-download --system-site-packages env2
New python executable in env2/bin/python
Installing setuptools............done.
Installing pip...............done.
jonathan@ubuntu:
$ cd env2
jonathan@ubuntu:/env2$ source bin/activate
(env2)jonathan@ubuntu:
/env2$ pip install https://github.com/espeed/bulbs/tarball/master
Downloading/unpacking https://github.com/espeed/bulbs/tarball/master
Downloading master (165Kb): 165Kb downloaded
Running setup.py egg_info for package from https://github.com/espeed/bulbs/tarball/master

warning: no previously-included files matching '*~' found under directory '.'
warning: no previously-included files matching '*.pyc' found under directory '.'
no previously-included directories found matching '*/*/old'
no previously-included directories found matching '*/old'

Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/local/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Requirement already satisfied (use --upgrade to upgrade): httplib2>=0.7.2 in /usr/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Downloading/unpacking pyyaml>=3.10 (from bulbs==0.3.3-20120715)
Downloading PyYAML-3.10.zip (364Kb): 364Kb downloaded
Running setup.py egg_info for package pyyaml

Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/local/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Downloading/unpacking ujson>=1.15 (from bulbs==0.3.3-20120715)
Downloading ujson-1.19.zip (191Kb): 191Kb downloaded
Running setup.py egg_info for package ujson

warning: no files found matching 'setup.y'

Requirement already satisfied (use --upgrade to upgrade): python-dateutil==1.5 in /usr/lib/python2.7/dist-packages (from bulbs==0.3.3-20120715)
Installing collected packages: pyyaml, ujson, bulbs
Running setup.py install for pyyaml
checking if libyaml is compilable
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory
compilation terminated.

libyaml is not found or a compiler error: forcing --without-libyaml
(if libyaml is installed correctly, you may need to
 specify the option --include-dirs or uncomment and
 modify the parameter include_dirs in setup.cfg)

Running setup.py install for ujson
building 'ujson' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/ujson.c -o build/temp.linux-x86_64-2.7/./python/ujson.o
In file included from ./python/ujson.c:34:0:
./python/py_defines.h:34:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/jonathan/env2/bin/python -c "import setuptools;file='/home/jonathan/env2/build/ujson/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /tmp/pip-VHuK7N-record/install-record.txt --install-headers /home/jonathan/env2/include/site/python2.7:
running install

running build

running build_ext

building 'ujson' extension

creating build

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/python

creating build/temp.linux-x86_64-2.7/lib

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/ujson.c -o build/temp.linux-x86_64-2.7/./python/ujson.o

In file included from ./python/ujson.c:34:0:

./python/py_defines.h:34:20: fatal error: Python.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1


Command /home/jonathan/env2/bin/python -c "import setuptools;file='/home/jonathan/env2/build/ujson/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /tmp/pip-VHuK7N-record/install-record.txt --install-headers /home/jonathan/env2/include/site/python2.7 failed with error code 1 in /home/jonathan/env2/build/ujson
Storing complete log in /home/jonathan/.pip/pip.log

Retrieve an existing index

Hi,

I've walked through the documentation, searched in the issues and on Gremlin google code, and even in the source code, but I definetly didn't understand how to use indexes, other than the default client index.

For example, I've got a 'nodes' lucene index on my neo4j, and I'd like to create an bulbs index object to query it. Is it possible? How to do that?

thanks :-)

Using existing index

I have a number of edge and vertex indexes that were created during the database import stage. I've been going through the documentation but cannot find out a way how to use these in Bulbs.

So far I've looked at:

  1. from bulbs.neo4jserver import Neo4jClient
    from bulbs.base.index import *
    client = Neo4jClient()
    ind = client.get_vertex_index('index_n_CLIN').one()
    index = Index( client, ind )
    index.lookup('label', 'TClin')
    Traceback (most recent call last):
    raise NotImplementedError
    NotImplementedError

  2. from bulbs.neo4jserver import Graph, FulltextIndex
    from bulbs.base.index import *
    client = Neo4jClient()
    proxy = VertexIndexProxy( FulltextIndex, client )
    index = proxy.get('index_n_CLIN')
    Traceback (most recent call last):
    raise NotImplementedError
    NotImplementedError

  3. Came across #47 which covers the same problem. I tried both of the solutions there:

from bulbs.neo4jserver import Graph, Config, NEO4J_URI
config = Config(NEO4J_URI)
config.vertex_index = 'index_n_CLIN'
g = Graph(config)
Traceback (most recent call last):
....
ValueError: ({'status': '400', 'content-length': '973', 'content-encoding': 'UTF-8', 'server': 'Jetty(6.1.25)', 'access-control-allow-origin': '*', 'content-type': 'application/json'}, '{\n "message" : "Supplied index configuration:\n{type=exact, provider=lucene}\ndoesn't match stored config in a valid way:\n{provider=lucene, type=fulltext}\nfor 'index_n_CLIN'",\n "exception" : "IllegalArgumentException",\n "stacktrace" : [ "org.neo4j.kernel.IndexManagerImpl.assertConfigMatches(IndexManagerImpl.java:156)", "org.neo4j.kernel.IndexManagerImpl.findIndexConfig(IndexManagerImpl.java:137)", "org.neo4j.kernel.IndexManagerImpl.getOrCreateIndexConfig(IndexManagerImpl.java:198)", "org.neo4j.kernel.IndexManagerImpl.getOrCreateNodeIndex(IndexManagerImpl.java:301)", "org.neo4j.kernel.IndexManagerImpl.forNodes(IndexManagerImpl.java:289)", "org.neo4j.server.rest.web.DatabaseActions.createNodeIndex(DatabaseActions.java:385)", "org.neo4j.server.rest.web.RestfulGraphDatabase.jsonCreateNodeIndex(RestfulGraphDatabase.java:628)", "java.lang.reflect.Method.invoke(Method.java:616)", "org.neo4j.server.statistic.StatisticFilter.doFilter(StatisticFilter.java:62)" ]\n}')

It fails because the index type is fulltext instead of exact index.

The other suggested solution:

from bulbs.neo4jserver import Graph, FulltextIndex
from bulbs.element import Vertex
g = Graph()
index = g._factory.get_index(Vertex, FulltextIndex, 'index_n_CLIN')
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'Graph' object has no attribute '_factory'

Bulbs 0.3

do we have a release date for this version ?
thx

Cypher with neo4jserver graph

Shouldn't there be cypher attribute in neo4jserver.graph.Graph object?? This enables executing cypher querys from Graph() object in your code (I changed it and it works).

Please correct me if I'm wrong.

Building Sphinx Docs

I am using a clone of this repository at fb6f791
When trying to build the docs, I ran into the following issues:

  • A Makefile is missing
    • Without a makefile, the primary makefile in the project root will fail when trying to make docs
    • Generating the makefile using sphinx-quickstart is a bit of a workaround as conf.py and index.rst need to be renamed temporarily, as quickstart refuses to work on existing files (or just use them).
    • Maybe it would already be enough to use the actual commandline ( sphinx-build -b html -d _build/doctrees . _build/html ) in the root makefile instead of referencing the non-existing sphinx-generated Makefile.
  • Local references to files
    • in docs there is a symlink to a local file
    • in docs/_ext/bulbsdoc.py is a hardcoded local path

Maybe there are more issues further down the road, the ones mentioned are the ones I ran into so far.

Do you think it is possible to check-in the referenced local files to the project and use relative paths instead ?

Thanks You

NameError: global name 'name' is not defined

Hi,

there are few methods where "index_name" is passed as an argument but the code uses the variable "name" instead. "name" needs to be renamed to "index_name" in the following methods in neo4jserver/client.py:

  • 821: query_vertex
  • 838: remove_vertex
  • 860: put_edge
  • 884: lookup_edge
  • 905: query_edge
  • 922: remove_edge

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.