Neo4j.
py : binding python pour Neo4j
▶ Créer une noeud
>>> mac_node = graphdb.node(Name='MacBook')
## ajouter des pro
>>> mac_node['Name']
'MacBook'
▶ Créer une relation entre les noeuds
>>> laptop_node = graphdb.node(Name='Laptop'')
## la mac est un produit de la famille des laptop_node
>>> laptop_node.PRODUCTS(mac_node)
Neo4j.py : binding python pour Neo4
▶ Traversals
● Sont définis en créant une classe qui hérite de
neo4j.Traversal
● Un objet Traversal doit définir les attributs suivants:
Types : la liste des relations qui vont être traversées pendant la traversé
Order : l'ordre de traversée
Stop : la condition de d'arrêt
Returnable : La définition des noeuds qui vont être retournés
Neo4j.py : binding python pour Neo4
class SubCategoryProducts(neo4j.Traversal):
"Traverser that yields all products in a category and its sub categories."
types = [neo4j.Outgoing.SUBCATEGORY, neo4j.Outgoing.PRODUCT]
def isReturnable(self, pos):
if pos.is_start: return False
return pos.last_relationship.type == 'PRODUCT'
## get products of laptop_node
>>> p = [x for x in SubCategoryProducts(laptop_node)]
Références
▶ NoSQL
● http://www.julianbrowne.com/article/viewer/brewers-
cap-theorem
● http://natishalom.typepad.com/nati_shaloms_blog/2
009/12/the-common-principles-behind-the-nosql-
alternatives.html
● http://horicky.blogspot.com/2009/11/nosql-
patterns.html