Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Bulbs 0.3 Neo4j Server Example
# Bulbs 0.3 Neo4j Server Example
# by James Thornton (http://jamesthornton.com)
from bulbs.neo4jserver import Graph
from bulbs.model import Node, Relationship
from bulbs.property import String, Integer, DateTime
from bulbs.utils import current_datetime
class Person(Node):
element_type = "person"
name = String(nullable=False)
age = Integer()
class Knows(Relationship):
label = "knows"
timestamp = DateTime(default=current_datetime, nullable=False)
g = Graph()
g.add_proxy("people", Person)
g.add_proxy("knows", Knows)
james = g.people.create(name="James",age=34)
julie = g.people.create(name="Julie")
knows = g.knows.create(james,julie)
print type(james), james.eid, james.element_type, james.name, james.age
james.name = "James Thornton"
james.city = "Dallas"
james.save()
james2 = g.people.get(james.eid)
print james2.city
friends = james.outV('knows')
print list(friends)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.