SQL UPDATE EDGE command

93 views
Skip to first unread message

Simon White

unread,
Apr 20, 2016, 11:09:05 AM4/20/16
to OrientDB
I am probably being stupid but I am trying to run the sql UPDATE EDGE command (from the docs http://orientdb.com/docs/2.1/SQL-Update-Edge.html)

But I can't get it to run....

UPDATE EDGE Friend SET out = (SELECT FROM #14:10) WHERE @rid = '#50:12'



com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #0: Error parsing query: UPDATE EDGE Friend set out = #14:10 Encountered " <EDGE> "EDGE "" at line 1, column 8. Was expecting one of: <TO> ... <VALUES> ... <SET> ... <ADD> ... <PUT> ... <MERGE> ... <CONTENT> ... <REMOVE> ... <ORDER> ... <GROUP> ... <OFFSET> ... <RECORD> ... <LUCENE> ... <NEAR> ... <WITHIN> ... <EXCEPTION> ... <FIND> ... <REFERENCES> ... <THIS> ... <RECORD_ATTRIBUTE> ... <INTEGER_LITERAL> ... "(" ... "[" ... "?" ... ":" ... "-" ... "*" ... <IN> ... <KEY> ... <CLUSTER> ... <IDENTIFIER> ... <QUOTED_IDENTIFIER> ... <INDEX_IDENTIFIER> ... <INDEXVALUES_IDENTIFIER> ... <INDEXVALUESASC_IDENTIFIER> ... <INDEXVALUESDESC_IDENTIFIER> ... <CLUSTER_IDENTIFIER> ... <CLUSTER_NUMBER_IDENTIFIER> ... <METADATA_IDENTIFIER> ... "#" ...

I need to update the OUT value of an edge whilst maintaining the graph consistency with vertices and without recreating the edge

Ivan Mainetti

unread,
Apr 20, 2016, 11:16:43 AM4/20/16
to orient-...@googlegroups.com
Hi,

use this:

UPDATE 50:12 SET out=14:10


as you can see in docs you linked, the syntax UPDATE EDGE is available only since 2.2 ODB version.

Simon White

unread,
Apr 20, 2016, 11:23:07 AM4/20/16
to OrientDB
As far as I can tell this does not maintain graph consistency i.e. automatically remove the out edge on the old vertex and set it on the new - it simply updates the edge so I would have to manage the edges myself. The documentation suggests that update edge would do this for me?


On Wednesday, April 20, 2016 at 4:16:43 PM UTC+1, Ivan Mainetti wrote:
Hi,

use this:

UPDATE 50:12 SET out=14:10



Ivan Mainetti

unread,
Apr 20, 2016, 11:33:24 AM4/20/16
to OrientDB
Yes you're right, that feature will be in 2.2

Simon White

unread,
Apr 20, 2016, 11:42:15 AM4/20/16
to OrientDB

So this documentation is completely wrong?!

http://orientdb.com/docs/2.1/SQL-Update-Edge.html

Luigi Dell'Aquila

unread,
Apr 20, 2016, 11:44:09 AM4/20/16
to orient-...@googlegroups.com
Hi Simon,

I think you missed line 7 in the docs ;-)

"This command was introduced in version 2.2."

Thanks

Luigi


--

---
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 orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon White

unread,
Apr 20, 2016, 11:53:22 AM4/20/16
to OrientDB
Oh sorry - I did miss that!! :)

But look at the URI I posted... it says 2.1, surely this page should not appear in 2.1 if it is a 2.2 feature.


Anyway... any chance you could help me write the commands to manually update the edges?

from
A ----> friend  ----> B

to
A ----> friend  ----> C

something like....
1. Update B remove in friend
2. Update friend set out C
3. Update C set in friend

Luigi Dell'Aquila

unread,
Apr 20, 2016, 11:59:49 AM4/20/16
to orient-...@googlegroups.com

Luigi Dell'Aquila

unread,
Apr 20, 2016, 12:00:18 PM4/20/16
to orient-...@googlegroups.com
ops, sorry... wrong link... I'll give you the info asap

Luigi Dell'Aquila

unread,
Apr 20, 2016, 12:02:31 PM4/20/16
to orient-...@googlegroups.com

Simon White

unread,
Apr 20, 2016, 12:08:20 PM4/20/16
to OrientDB
Thanks for the link, ooooooooof though!! so many steps!! ;)  I am not using the java API either so it needs to be SQL... roll on the UPDATE EDGE command!

scott molinari

unread,
Apr 21, 2016, 1:20:55 AM4/21/16
to OrientDB
UPDATE EDGE is a reality as of version 2.2! :)

Luigi Dell'Aquila

unread,
Apr 21, 2016, 5:17:22 AM4/21/16
to orient-...@googlegroups.com
Hi Simon,

if you have to do it via SQL, you can do the following, using document queries:

UPDATE VertexFromClass remove out_EdgeClass = <edgeRid> where <something to select your original vertex>
UPDATE EdgeClass set out = VertexToClass where <something to select the edge>
UPDATE VertexToClass add out_EdgeClass = <edgeRid> where <something to select your destination vertex>

Of course if you have to update the "out" just invert 'out' and 'in' in the statements

Thanks

Luigi
 

--

Simon White

unread,
Apr 21, 2016, 5:39:11 AM4/21/16
to OrientDB
ok then I mean - roll on production-ready 2.2!

Simon White

unread,
Apr 21, 2016, 5:40:31 AM4/21/16
to OrientDB
Wow! Thank you so much Luigi!
Reply all
Reply to author
Forward
0 new messages