Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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

Project Description

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

Build status

Example

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

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


# define a simple type hierarchy

class Knows(Relationship):
    pass


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


class Carnivore(Animal):
    pass


class Herbivore(Animal):
    pass


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

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)

manager.save(fred)
manager.save(tom)
manager.save(relation)

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

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

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

MATCH
    (Herbivore:PersistableType {id: "Herbivore"}),
    (Carnivore:PersistableType {id: "Carnivore"}),
    Carnivore <-[:ISA*]-()<-[:INSTANCEOF]-(carnivore),
    Herbivore <-[:ISA*]-()<-[:INSTANCEOF]-(herbivore),

    (herbivore)-[:KNOWS]->(carnivore)

RETURN
    "The herbivore",
    herbivore.name,
    "knows the carnivore",
    carnivore.name;
==> +---------------------------------------------------------------------+
==> | "The herbivore" | "Fred"      | "knows the carnivore" | "Tom"       |
==> +---------------------------------------------------------------------+
Release History

Release History

This version
History Node

0.40.0

History Node

0.30.2

History Node

0.30.1

History Node

0.30.0

History Node

0.23.0

History Node

0.22.0

History Node

0.21.0

History Node

0.20.1

History Node

0.20.0

History Node

0.17.1

History Node

0.17.0

History Node

0.16.2

History Node

0.16.1

History Node

0.16.0

History Node

0.15.2

History Node

0.15.1

History Node

0.15.0

History Node

0.14.3

History Node

0.14.2

History Node

0.14.1

History Node

0.14.0

History Node

0.13.4

History Node

0.13.3

History Node

0.13.2

History Node

0.13.1

History Node

0.13.0

History Node

0.12.0

History Node

0.10.0

History Node

0.9.0

History Node

0.8.4

History Node

0.8.3

History Node

0.8.2

History Node

0.8.1

History Node

0.8.0

History Node

0.7.0

History Node

0.6.0

History Node

0.5.0

History Node

0.4.0

History Node

0.3.0

History Node

0.2.1

History Node

0.2.0

History Node

0.1.2

History Node

0.1.1

History Node

0.1-dev

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
kaiso-0.40.0.tar.gz (32.0 kB) Copy SHA256 Checksum SHA256 Source Jan 9, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting