{"action":"created","issue":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5438","labels_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5438/labels{/name}","comments_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5438/comments","events_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5438/events","html_url":"https://github.com/orientechnologies/orientdb/issues/5438","id":121213297,"number":5438,"title":"Duplication Constrain on Edges","user":{"login":"healiseu","id":14239698,"avatar_url":"https://avatars.githubusercontent.com/u/14239698?v=3","gravatar_id":"","url":"https://api.github.com/users/healiseu","html_url":"https://github.com/healiseu","followers_url":"https://api.github.com/users/healiseu/followers","following_url":"https://api.github.com/users/healiseu/following{/other_user}","gists_url":"https://api.github.com/users/healiseu/gists{/gist_id}","starred_url":"https://api.github.com/users/healiseu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/healiseu/subscriptions","organizations_url":"https://api.github.com/users/healiseu/orgs","repos_url":"https://api.github.com/users/healiseu/repos","events_url":"https://api.github.com/users/healiseu/events{/privacy}","received_events_url":"https://api.github.com/users/healiseu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/orientechnologies/orientdb/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-09T11:09:35Z","updated_at":"2015-12-09T11:45:18Z","closed_at":null,"body":"Hi, I have noticed that it is possible to create the same edge multiple times. Although this might be an option, for example I can imagine a case where we want to monitor a navigation path  and measure how frequently we cross a certain edge, this is certainly NOT the standard way to model relational data.\r\n\r\nTo achieve referential integrity on a standard Many-to-Many relationship, duplicate instances of a JOIN table record ARE NOT allowed. In other words, it is most desirable, to provide a mechanism for referential integrity, something which is trivial to do in Microsoft Access, right click and check \"Enforce Referential Integrity\". I can imagine a similar check button with the description, \"DUPLICATE INSTANCES\" of the edge ARE NOT allowed.\r\n\r\nThis way, you save the user from the burden to write code for preventing ACCIDENTAL duplication on edges. Let us take the classic Supplier-Part-Catalog case, a duplicate entry in the catalog means that \r\nyou are COUNTING WRONG how many parts are supplied by a specific Supplier or how many Suppliers manufacture a certain part. Somehow you have to exclude duplicate instances. Yes, I know you can do that with code, and commands, etc, etc, but it is causing an extra headache !!!\r\n\r\nIn fact every single data instance that is duplicated in the system is asking for trouble, and if that is possible, it must be prevented. It is like disease, prevent it, rather than cure it ;-)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/comments/163198281","html_url":"https://github.com/orientechnologies/orientdb/issues/5438#issuecomment-163198281","issue_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5438","id":163198281,"user":{"login":"smolinari","id":3314957,"avatar_url":"https://avatars.githubusercontent.com/u/3314957?v=3","gravatar_id":"","url":"https://api.github.com/users/smolinari","html_url":"https://github.com/smolinari","followers_url":"https://api.github.com/users/smolinari/followers","following_url":"https://api.github.com/users/smolinari/following{/other_user}","gists_url":"https://api.github.com/users/smolinari/gists{/gist_id}","starred_url":"https://api.github.com/users/smolinari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolinari/subscriptions","organizations_url":"https://api.github.com/users/smolinari/orgs","repos_url":"https://api.github.com/users/smolinari/repos","events_url":"https://api.github.com/users/smolinari/events{/privacy}","received_events_url":"https://api.github.com/users/smolinari/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T11:45:18Z","updated_at":"2015-12-09T11:45:18Z","body":"Have a look at this part of the documentation. \r\n\r\nhttp://orientdb.com/docs/last/Tutorial-Using-schema-with-graphs.html#using-in-and-out-constraints-on-edges\r\n\r\nIt describes how you can create certain constraints, so you can avoid duplicate edges - mainly the unique edge index.\r\n\r\nThere is also these discussions about edge control and better abstraction. \r\n\r\nhttps://github.com/orientechnologies/orientdb/issues/3820#issuecomment-151162243\r\nhttps://groups.google.com/forum/#!topic/orient-database/sZ4GjSvEKtI\r\n\r\nScott "}}