Hi, You could create a constraint in edge class, but making unique the couple "out, in" fields. So when ETL will try to create the new edge, a duplicated record exception will skip it:
*create index CustomerOf.unique on CustomerOf (out,in) UNIQUE_HASH_INDEX* Best Regards, Luca Garulli CEO at Orient Technologies LTD the Company behind OrientDB http://about.me/luca.garulli On 15 May 2015 at 16:21, Richard Jenkins <[email protected]> wrote: > Hi There, > > I have been working with OrientDB now for only a short period but I have > run across a problem with the ETL application. Now this may just be my > lack of experience but I wanted to check. > > I am shipping data from a MySQL server and then trying to create a company > hierarchy of many business and customers. I have used some of the code > that has been posted within this group but I am still struggling to get it > to work as I would like. The problem I am facing is that the ETL app is > adding the edges between the verticies if they are already there. So if I > run the ETL application over and over again ( which I will need to do ) the > edges are created over and over again and I cannot see any way to stop it. > Basically I am only want to create the edge between the verticies if there > is not already an edge there. So each customer should only have one edge > per business. > > Below is my setup and ETL config. > > Is someone able to help? > > -- Business -- > CREATE CLASS Business EXTENDS V; > CREATE PROPERTY Business.BusinessLabel STRING; > CREATE PROPERTY Business.Name STRING; > CREATE INDEX Business.Label UNIQUE; > > -- Customer -- > CREATE CLASS Customer EXTENDS V; > CREATE PROPERTY Customer.EmailAddress STRING; > CREATE PROPERTY Customer.Name STRING; > CREATE PROPERTY Customer.BusinessLabel STRING; > CREATE INDEX Customer.EmailAddress UNIQUE; > CREATE INDEX Customer.BusinessLabel NOTUNIQUE; > > -- Customer to Business Edge -- > CREATE CLASS CustomerOf EXTENDS E; > > -- OETL Config -- > { > "config": > { > "log": "debug" > }, > "extractor" : > { > "jdbc": > { > "driver": "com.mysql.jdbc.Driver", > "url": "jdbc:mysql://localhost/Company", > "userName": "admin", > "userPassword": "admin", > "query": "SELECT EmailAddress, Name, BusinessLabel FROM Customer;" > } > }, > "transformers" : > [ > { > log: > { > prefix: "MySQL -> " > } > }, > { > merge: > { > joinFieldName: "EmailAddress", > lookup: "Customer.EmailAddress" > } > }, > { > vertex: > { > class: "Customer" > } > }, > { > edge: > { > joinFieldName: "BusinessLabel", > lookup: "Business.BusinessLabel", > class: "CustomerOf", > direction: "out", > unresolvedLinkAction: "CREATE" > } > }, > { > log: > { > prefix: "Vertex -> " > } > } > ], > "loader" : > { > "orientdb": > { > "dbURL": "remote:localhost/Company", > "dbUser": "admin", > "dbPassword": "admin", > "dbType": "graph", > "tx":false, > "batchCommit":100, > "wal":false > } > } > } > > -- > > --- > 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. > -- --- 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.
