Hi, what about something like:
CREATE EDGE knows FROM ( SELECT FROM #9:0 WHERE *NOT #9:1 IN out('knows')*
) TO #9:1
Cheers,
Riccardo
2015-02-16 18:41 GMT+01:00 Alain <[email protected]>:
> Hi,
> I've started using OrientDB (version 2.0.2, remote protocol) last week. I
> have the exact same need as Dan (using ligthweight edges, no need for
> properties).
> However I believe the query that you suggested doesn't answer to the need
> as it prevents from creating more than one 'knows' edge per 'user' vertex
> however the goal is to prevent duplicate edges between 2 users (as in "one
> user can only be friend once with another user but can have several
> friends"). With your query, #9:0 can only have one 'knows'.
>
> Do you have any other suggestion (other than creating constraints) ?
>
> Thank you for your help.
>
> Cheers,
> Alain
>
>
> Le mercredi 7 janvier 2015 10:34:36 UTC+1, Riccardo Tasso a écrit :
>>
>> 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.
>
--
---
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.