Created
July 12, 2014 00:11
-
-
Save realoptimal/d5fe0b566b6eb50165e8 to your computer and use it in GitHub Desktop.
Code to illustrate possible bug in bulbflow RelationshipProxy method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from bulbs.titan import Graph, DEBUG, ERROR | |
| from bulbs.config import Config | |
| from bulbs.model import Node, Relationship | |
| from bulbs.property import String, Integer, DateTime | |
| from bulbs.utils import current_timestamp | |
| class Person(Node): | |
| element_type = "person" | |
| name = String(nullable=False) | |
| class Knows(Relationship): | |
| label = "knows" | |
| created = DateTime(default=current_timestamp, nullable=False) | |
| if __name__ == "__main__": | |
| conf = Config('http://10.0.3.139:8182/graphs/emptygraph') | |
| conf.set_logger(DEBUG) | |
| g = Graph(conf) | |
| g.add_proxy("person", Person) | |
| g.add_proxy("knows", Knows) | |
| print "Create Vertex: Person(name='James')" | |
| james = g.person.create(name="James") | |
| print "Create Vertex: Person(name='Julie')" | |
| julie = g.person.create(name="Julie") | |
| print "Create Relationship: Knows(james, julie)" | |
| g.knows.create(james, julie) | |
| print "Get all 'Knows' relationships" | |
| g.knows.get_all() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment