skip to navigation
skip to content

Not Logged In

kaiso 0.14.0

A queryable object persistence and relationship framework based on the Neo4j graph database.

Latest Version: 0.16.2

A graph based queryable object persistance framework built on top of Neo4j.

Build status

.. image::


In addition to objects, Kaiso also stores the class information in the graph.
This allows us to use cypher to query instance information, but also to answer
questions about our types.

Let's define some basic classes

.. code:: python

    from kaiso.attributes import Integer, Outgoing, String, Uuid
    from kaiso.types import Entity, Relationship

    # define a simple type hierarchy

    class Knows(Relationship):

    class Animal(Entity):
        id = Uuid(unique=True)
        name = String()
        knows = Outgoing(Knows)

    class Carnivore(Animal):

    class Herbivore(Animal):

    class Penguin(Herbivore):
        favourite_ice_cream = String()

    class Lion(Carnivore):
        n_siblings = Integer()

As with any orm, we can make some instances and persist them in our graph

.. code:: python

    from kaiso.persistence import Manager

    manager = Manager("http://localhost:7474/db/data/")

    # create some instances

    fred = Penguin(name="Fred")
    tom = Lion(name="Tom")

    relation = Knows(fred, tom)

Using the Neo4j web interface to explore our graph, we find Tom and Fred:

.. image:: docs/images/instances.png

However, in addition, we can also see the type information in the graph:

.. image:: docs/images/type_hierarchy.png

We can make use of the type information in our queries, e.g. to find all
herbivores who know a carnivore

.. code:: cypher


        Carnivore <-[:ISA*]-()<-[:INSTANCEOF]-(carnivore),
        Herbivore <-[:ISA*]-()<-[:INSTANCEOF]-(herbivore),


        "The herbivore",,
        "knows the carnivore",;


    ==> +---------------------------------------------------------------------+
    ==> | "The herbivore" | "Fred"      | "knows the carnivore" | "Tom"       |
    ==> +---------------------------------------------------------------------+
File Type Py Version Uploaded on Size
kaiso-0.14.0.tar.gz (md5) Source 2013-12-19 29KB
  • Downloads (All Versions):
  • 81 downloads in the last day
  • 343 downloads in the last week
  • 3410 downloads in the last month