Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Assign label to Lightweight Edge from command line

43 views
Skip to first unread message

Riccardo Tasso

unread,
Nov 25, 2014, 12:21:30 PM11/25/14
to orient-...@googlegroups.com
Hi, if I tried the following command:
CREATE EDGE FROM #14:1 TO #14:0 SET @label="myLabel"
But it seems to create a new record in class E.
What if I would create a new lightweight edge from command line?

I'm using orient 1.7.10.

Cheers,
   Riccardo

Luigi Dell'Aquila

unread,
Nov 25, 2014, 12:27:14 PM11/25/14
to orient-...@googlegroups.com
Hi Riccardo,

what TinkerPop calls labels is represented by OrientDB classes. 
You can create a lightweight edge of a particular class with this syntax:

CREATE EDGE MyLabel FROM #14:1 TO #14:0

Of course the class MyLabel has to exist and has to extend E

If you use the SET labelName = value, the labelName will become a property of the edge, so the edge will become a regular one (not lightweight)

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.

Riccardo Tasso

unread,
Nov 26, 2014, 2:22:46 AM11/26/14
to orient-...@googlegroups.com
Thank you Luigi,
in this case is there a command to list all the existing "classes" extending E?
The command CLASS doesn't list lightweight edges, since they're not real classes.

Cheers,
   Riccardo

Riccardo Tasso

unread,
Nov 26, 2014, 2:45:05 AM11/26/14
to orient-...@googlegroups.com
Sorry I was talking about CLASSES command.

The point is the following.

Under the hood lightweight edges ARE NOT instances of a class.
When I created my database from Java API, I didn't create any class for my edges.

I need to create e new edge from command line.

1) I am forced to add a new class, while for all the previous edges I didn't have to do this (also if there are already other edges with the same label) => this is somehow inconsistent, since it means at the end I will have some lightweight edges for which there exists a class and others without!
2) The new created class will remain empty, since a new edge isn't a new record => this means the new class I created is unuseful

I don't remember exactly if there can be a mixed model graphdb (with lightweight AND non-lightweight edges) but I would suggest the following behaviour for ADD EDGE myLabel FROM #1:1 TO #1:2:
  • IF myLabel extends E AND non-lightweight THEN as usual
  • IF myLabel IS NOT A CLASS AND lightweight THEN add the lightweight edge
It would also be very useful a command to list all the edge types, which is different from listing all the classes extending E. I don't know if this requires to scan all records or a list of lightweight edges is maintained elsewhere.

My two cents,
  Riccardo
Reply all
Reply to author
Forward
0 new messages