Skip to content
Robin Edwards edited this page Jan 28, 2014 · 21 revisions

(Used to be called traverse())

class Address(StructuredNode):
   name = StringProperty()
   street = StringProperty()
   town = StringProperty()
   post_code = StringProperty()

class Car(StructuredNode):
   model = StringProperty(unique_index=True)

class User(StructuredNode):
   name = StringProperty(unique_index=True)
   age = IntegerProperty()
   friend = Relationship(Address, 'FRIEND', ZeroOrMore)
   address = Relationship(Address, 'ADDRESS', ZeroOrOne)
   car =  Relationship(Address, 'CAR', ZeroOrOne)

Matching relationships:

jim.match_friends() # all friends

jim.match_friends(since__gt=yesterday()) # rel property since is greater than yesterday

Filtering nodes returned in a match

jim.match_friends().where(name="Suzan")

 # where statement acts on last matched node?
jim.match_friends(since__gt=yesterday()).where(age__gt=2)

Must have or must not have a relationship:

jim.match_friends().has_a('address').has_no('car')

ideas

.filter() and .exclude() # rather than where()

class (label) match

User.where(age__lt=16)

or perhaps

User.match(age__lt=16)
Clone this wiki locally