Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPDATE EDGE statement [moved] #1114

Closed
lvca opened this issue Dec 10, 2012 · 29 comments
Closed

UPDATE EDGE statement [moved] #1114

lvca opened this issue Dec 10, 2012 · 29 comments
Assignees
Milestone

Comments

@lvca
Copy link
Member

lvca commented Dec 10, 2012

This is Issue 1114 moved from a Google Code project.
Added by 2012-10-14T22:09:41.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Low, v2.1.0

Original description

Having an UPDATE EDGE statement would be nice because there is less overhead then deleting and recreating the edge.

Discussion here: https://groups.google.com/forum/#!topic/orient-database/Z5ZElaxVSZ0
@chrishuttonch
Copy link

I second this request and the ability to use the update edge in Blueprints

@rore
Copy link

rore commented Oct 27, 2013

+1

@AaronSchulz
Copy link

+1

@lvca
Copy link
Member Author

lvca commented Dec 18, 2014

Makes sense, 👍

@lucasxteixeira
Copy link

+1

1 similar comment
@thedanielhanke
Copy link

+1

@luigidellaquila
Copy link
Member

Same for UPDATE VERTEX

@AlexFiverr
Copy link

+1

2 similar comments
@yujinlim
Copy link

+1

@iforwms
Copy link

iforwms commented Apr 10, 2015

+1

@AlexFiverr
Copy link

hey, any updates on the version this feature will be in?
thanks!

@pisaruk
Copy link

pisaruk commented Jun 1, 2015

+1

5 similar comments
@StarpTech
Copy link

+1

@liorn
Copy link

liorn commented Aug 9, 2015

+1

@FGRibreau
Copy link

👍

@sebastiandev
Copy link

+1

@smolinari
Copy link
Contributor

👍

@matanshukry
Copy link
Contributor

As far as I can tell, update works (including in/out):

UPDATE FRIEND SET in=#11:5 WHERE in.name="Samantha" and out.name="Mat"

Although, using a query inside the set clause for in/out will cause it to return array, which is not the desired behavior. Example:

UPDATE Friend SET in=(SELECT FROM User WHERE name="Jason") WHERE in.name="Samantha" and out.name="Mat"

When later querying the table Friend, we can see column "in" will contain [#11:4], emphasis on the brackets [], which means an array.

Upsert also works, although when creating a new vertex it doesn't set the in/out properties.
You could set the in/out properties your self, like this:

UPDATE Friend SET comment="Wazzzaup", in=#11:5, out=#11:6 UPSERT WHERE in.name="Jason" AND out.name="Mat"

It will result in a longer query when using sub-query for in= and out=, but at least it works (sub-query has same problem as above).

To summarize, the only problem I can see is using a sub-query for in/out. So:

  1. Is there any other feature required here? If not, can we agree the UPDATE command is suffice and there is no need for an UPDATE EDGE command?
  2. Is there anyway to set the in/out properties, perhaps one that I missed?

@smolinari
Copy link
Contributor

  1. Is there anyway to set the in/out properties, perhaps one that I missed?

That is the reason for the suggestion, I believe. That, and also a way to change the edge type with one command. Whereas, I see that also as a rare "edge" use case. LOL!

Scott

@matanshukry
Copy link
Contributor

Added a PR that resolves the sub-query issues.

Assuming it is accepted, the only reason to keep this issue would be to create a command that could change the edge type.

In my opinion, even if there should be a command to change it, UPDATE EDGE should not be the name of that command. It's a bit misleading, since we are really changing the edge it self, and not simply updating it's properties.

@smolinari
Copy link
Contributor

Maybe MODIFY EDGE?

Scott

@lvca
Copy link
Member Author

lvca commented Nov 18, 2015

An UPDATE EDGE command is supposed to maintain the integrity of the graph. if you just update in/out, vertices could refer to wrong edges. Furthermore the command should support also lightweight edges. So the command should do much more.

@smolinari
Copy link
Contributor

So, then 👍 👍 for me! 😄

Scott

luigidellaquila added a commit that referenced this issue Nov 24, 2015
@luigidellaquila
Copy link
Member

Hi guys,

happy to announce that I implemented this in develop branch (2.2).
Current syntax is exactly the same as normal update, so eg. (reverting an edge)

UPDATE EDGE EdgeClass SET
out = #12:0
in = #12:1
WHERE out = #12:1
and in = #12:0

The implementation validates that

  • both new out and in are vertices
  • the target is an edge

We are not in RC yet, so if you think UPDATE EDGE is not the most appropriate name, please vote for another one ;-)

I'm waiting for final confirmation to update the docs

Thanks

Luigi

@lvca
Copy link
Member Author

lvca commented Nov 25, 2015

sounds good to me, +1

@michael-go
Copy link

@luigidellaquila does it also support UPSERT?

Thanks!

@luigidellaquila
Copy link
Member

Hi @michael-go

no, right now it doesn't, but I'll work on that in the near future.
Could you please open a separate issue for that?

Thanks

Luigi

@michael-go
Copy link

I see now that a ticket for Edge UPSERT already exists: #4436

Thanks

@luigidellaquila
Copy link
Member

Yes, you are right, thank you for the pointer!

Luigi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests