2
votes

is there a way to limit an edge on specific vertices? I am not meaning light weight edges.

Say, I have:

[Vertex] Person (properties: firstName, lastName, birthDate)
[Vertex] House (properties: street, city)
[Vertex] Car   (properties: brand, make, year)
[Edge]   livesIn (properties: sinceDate, isOwner)
[Edge]   owns    (properties: sinceDate)

Now I want to be able to limit the edge 'livesIn' between (from) Person and (to) House, so if I create a 'livesIn' edge object (Create EDGE livesIn FROM #12:0 TO #13:0) between a Person object (#12:0) and House object (#13:0) it succeeds, but it will fail for a Person and Car object (#14:0).

( I am using orientdb-community-2.1.2)

1
There might be a few people that DO live in their cars! :P I'm looking for the same solution. Although I am using light weight edges. Following this question with interest.Adrian Lynch

1 Answers

3
votes

Oh, found it. It's answered here: Enforce an Edge to connect two distinct vertex classes

To apply it to your case, try:

create property livesIn.out link Person
create property livesIn.in link House