py2neo ogm Relationship with Multiple Node Labels
<p>I would like to use OGM of py2neo to represent a relationship from one node type to two node types. </p>

<p>I have a solution (below) that works only to store nodes/relationships in the DB, and I could not find one that works properly when retrieving relationships.</p>

<p>This is my example. Consider the relationship OWNS from a Person to a Car:</p>

<pre><code>from py2neo.ogm import GraphObject, Property, RelatedTo
from py2neo import Graph

class Person(GraphObject):
    name = Property()
    Owns = RelatedTo("Car")

class Car(GraphObject):
    model = Property()

g = Graph(host="localhost", user="neo4j", password="neo4j")

# Create Pete
p = Person()
p.name = "Pete"  

# Create Ferrari
c = Car()
c.model = "Ferrari"

# Pete OWNS Ferrari
p.Owns.add(c)

# Store
g.push(p)
</code></pre>

<p>This works well and fine. Now, let's assume that a Person OWNS a House as well (this code continues from the one above):</p>

<pre><code>class House(GraphObject):
    city = Property()

# Create House
h = House()
h.city = "New York"

# Pete OWNS House in New York
p.Owns.add(h)

# Update
g.push(p)
</code></pre>

<p>The "to" end of the relationship OWNS is supposed to point to a Car, not a House. But apparently py2neo does not care that much and stores everything in the DB as expected: a Person, a Car and a House connected via OWNS relationships. </p>

<p>Now the problem is to use the above classes to retrieve nodes and relationships. While node properties are loaded correctly, relationships are not:</p>

<pre><code>p = Person.select(g).where(name="Pete").first()
for n in list(p.Owns):
    print type(n).__name__
</code></pre>

<p>This results in:</p>

<pre><code>Car
Car
</code></pre>

<p>This behavior is consistent with the class objects. </p>

<p>How can I model "Person OWNS Car" and "Person OWNS House" with the same class in py2neo.ogm? Is there any known solution or workaround that I can use here?</p>