Edges in 2.2 GA

48 views
Skip to first unread message

Eric24

unread,
May 24, 2016, 9:55:10 AM5/24/16
to OrientDB
Since this has changed since a lot of the documentation was written, I want to get a definitive answer on how edges are handled in 2.2. Is it true that any edge created will be a Lightweight Edge if no properties are defined for it? Does this also apply to edge classes that derive from E or only E itself? And what happens if you add a property to an edge that was originally created without any--does ODB automatically "promote" the edge from Lightweight to Regular?

Luigi Dell'Aquila

unread,
May 24, 2016, 9:59:11 AM5/24/16
to orient-...@googlegroups.com
Hi,

By default all the edges are created as regular edges. 

This default can be changed from Studio or with an SQL statement http://orientdb.com/docs/last/Lightweight-Edges.html
In this case, an edge is created as a lightweight edge only if it has no properties. When you add a property to a lightweight edge, it is automatically transformed to a regular edge

Thanks

Luigi

2016-05-24 15:55 GMT+02:00 Eric24 <er...@24x8.com>:
Since this has changed since a lot of the documentation was written, I want to get a definitive answer on how edges are handled in 2.2. Is it true that any edge created will be a Lightweight Edge if no properties are defined for it? Does this also apply to edge classes that derive from E or only E itself? And what happens if you add a property to an edge that was originally created without any--does ODB automatically "promote" the edge from Lightweight to Regular?

--

---
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.

Eric24

unread,
May 24, 2016, 10:15:52 AM5/24/16
to OrientDB
Thanks for the quick response and the clarification. So really, there isn't any penalty for running with Lightweight Edges enabled, since they will automatically be created as Regular edges when they have properties (as long as you're aware of this distinction)?

Also, when running with Lightweight Edges enabled, can a Lightweight Edge still be a unique class derived from E (presumably with no required properties defined in the schema, but optional properties are OK)?

--Eric

Luigi Dell'Aquila

unread,
May 24, 2016, 10:54:47 AM5/24/16
to orient-...@googlegroups.com
Hi Eric,

There are no big penalties, the only real problem is that edge schema is not validated because lightweight edges are not instantiated as ODocuments, so the validation does not run (eg. if you define a mandatory property on the edge class, it won't be validated with lightweight). For the class hierarchy, it's exactly the same as regular edges

We mainly suggest to use regular edges because it's easier to deal with real records, with RIDs and all the rest, rather than having to figure out if an edge is regular or lightweight, especially if you work with document API

Thanks

Luigi

Eric Lenington

unread,
May 24, 2016, 11:04:20 AM5/24/16
to OrientDB
OK. That makes sense. The only reason I'm inclined to use Lightweight edges is for performance reasons (is that not still a factor?). I don't see using "promotable" edges (that start off Lightweight and may become Regular at some point), but assuming there is still a performance advantage, I can easily see a case for "mixed mode" where some edges are Lightweight and some are Regular, depending on their needs (or not) for local properties.
--Eric


--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/EFXDb_Qa5Jc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.

Luigi Dell'Aquila

unread,
May 24, 2016, 11:23:42 AM5/24/16
to orient-...@googlegroups.com
yes, in traversal performance you will definitely have some advantages with lightweight edges

Thanks

Luigi

Reply all
Reply to author
Forward
0 new messages