Scott, to add what Ziink said, this is tricky one not because of OrientDB, but because of nature of Graph with directed links. Actually it works. The problem here, that one could be A husband of B and could be husband of C. Actually, there are more options to resolve that issue - one of them - you might want to have two different relations inherited from MarriedTo - isHusbandOf and isWifeOf. Make two unique indexes for MarriedTo abstract class (for MarriedTo(in) and MarriedTo(out)). Then you might add some hook for evey isHsubandOf insert, adding new corresponding isWifeOf with reversed in and out.
On Monday, November 2, 2015 at 5:27:55 AM UTC+5, Ziink A wrote: > > This is a tricky one. From what I could make out OrientDB doesn't have > support for ONE2ONE within a class. So I guess they do need to extend their > SQL for this. > > You could use one of two workarounds that might work > > 1. Have a spouse property of type link on Person where the linked type is > Person. Update both records in your application code. > > 2. Use a stored function to add a property on the Edge that is an array > containing both 'in' and 'out'. Create a unique index on this property. > > > > I think you should add this as an Issue on Github. > > > > > On Sunday, November 1, 2015 at 12:31:37 AM UTC-7, scott molinari wrote: >> >> Yes, exactly. I am looking for simpler commands, which help set up edge >> multiplicity and direction. I mean, it is the relationships and how they >> can be handled better/ easier/ more flexible, which make graph databases so >> cool. But, if you need to study a book and practice and practice just to >> create such relationships and, more importantly, to get them right for a >> particular data model, so they all work properly in an application, it just >> makes the hurdle to start with a graph database that much higher. I am >> already frustrated myself..... >> >> I tried out your examples for MANY2ONE and ONE2MANY and they worked >> great. Thank you! >> >> Now another multiplicity scenario I need help with. The ONE2ONE. I >> created a "MariedTo" edge linked to the "Person" vertex in both in and out >> properties and with both in and out given a UNIQUE index, but that didn't >> work. I could still create another "MariedTo" edge to another Person >> Vertex. If you could help me out once more, what are the commands needed to >> create a bidirectional one to one relationship with a normal edge? >> >> Scott >> > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
