Hi Luca. Thanks for the reply. I understand that using a regular Edge that this is possible.
Using the code in the EdgeIndexingTest.java link as an example of creating a unique index on a lightweight edge, I thought it should work: https://github.com/orientechnologies/orientdb/blob/develop/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeIndexingTest.java Any suggestions? Think we could update the Lightweight Edge documentation to state its limitations when using indexes? Thanks! -Colin On Wednesday, January 21, 2015 at 10:28:56 AM UTC-6, Lvc@ wrote: > > Hi Colin, > If you want such constraint: > > > 1. assure you don't have lightweight edges > 2. create this constraint: create index OrganUnique ON Folders(out,in) > UNIQUE > > > Lvc@ > > On 21 January 2015 at 16:56, Colin <[email protected] <javascript:>> > wrote: > >> Bump :) >> >> >> On Tuesday, January 20, 2015 at 1:09:05 PM UTC-6, Colin wrote: >>> >>> I have a shiny new graph database using lightweight edges and running >>> against the 2.0 final release. >>> >>> I've created a schema that looks like this: >>> >>> create class Organ extends V >>> >>> create property Organ.Name String >>> >>> create property Organ.out_Folders LinkBag >>> >>> >>> >>> create index OrganUnique ON Organ(out_Folders) UNIQUE >>> >>> >>> basic Java code is: >>> >>> >>> Vertex organ = db.addVertex("class:Organ"); >>> organ.setProperty("Name", "Disney"); >>> >>> Vertex f1 = db.addVertex("class:Folder"); >>> f1.setProperty("Name", "Pic1"); >>> >>> Vertex f2 = db.addVertex("class:Folder"); >>> f2.setProperty("Name", "Doc1"); >>> >>> organ.addEdge("Folders", f1); >>> organ.addEdge("Folders", f2); >>> organ.addEdge("Folders", f1); >>> >>> >>> db.commit(); >>> >>> >>> I'd expect an ORecordDuplicatedException to be thrown when commit() is >>> called. >>> >>> Instead, all three Vertex folders are added to the organ Vertex, and the >>> index shows one f1 as the key against organ and one f2 as the key against >>> organ. >>> >>> I modeled this after this code: >>> >>> https://github.com/orientechnologies/orientdb/ >>> blob/develop/graphdb/src/test/java/com/orientechnologies/ >>> orient/graph/blueprints/EdgeIndexingTest.java >>> >>> Thanks for any input! >>> >>> -Colin >>> >> -- >> >> --- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- 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.
