I would use the following query:

CREATE EDGE knows FROM (SELECT FROM #9:0 WHERE out('knows') IS NULL) TO #9:1

In this way you won't have any exception if the edge already exists, but it
won't be inserted a duplicate.

Cheers,
   Riccardo

2015-01-07 9:50 GMT+01:00 Dan Andrei <[email protected]>:

> Hello, I've looked for some info but I couldn't find anything clearly
> explained. My question is
>
> *How do I make a Edge unique in Orientdb ? version 1.7*
>
> The solution that I came up with:
>
>    - delete the edge
>    - create it again
>
> but it's not nice. Edge is without any properties.
>
> *Example:*
>
> create edge is_friend from #12:0 to #12:3
>
> and if I call it again, there should be an error like when you make a
> unique index.
>
> Lvca said Create a constraint on Edge out and in fields.
>
> But how exactly to do it ? I have a simple database with users and edges
> "is_friend" from user to user without any additional properties on the edge.
>
>
>
>
>
> http://www.orientechnologies.com/docs/last/orientdb.wiki/Graph-Schema.html#constraints
>
>
>
> Thank you very much
>
> --
>
> ---
> 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.

Reply via email to