Hi, this is a bit confused.

I understood that parent (MemberOf) is a lightweight edge. In this case his 
child (UserOf) will be a lightweight edge. This is the choice of 
subclassing an edge instead of usin only one class for edges with a "type" 
attribute.

Otherwise if the parent is a regular (or heavy) edge, i.e. it has some 
properties, I expect that subclassing it will result in another regular 
edge class.

I was curious, so I did some experiment. Consider this script:
create database memory:temp admin admin memory graph
ALTER DATABASE custom useLightweightEdges=true

INSERT INTO V set name = 'a'
INSERT INTO V set name = 'b'
INSERT INTO V set name = 'c'

CREATE CLASS MemberOf EXTENDS E
CREATE CLASS UserOf EXTENDS MemberOf

The command "classes" shows that at this time there are two new classes, 
each one with its clusterId (which is required to create new records) and 
with 0 records: as expected!

Please note that at this moment Orien doesn't know if those edges will be 
lightweight or regular, since there is no instance.

Then I created an edge with properties:
CREATE EDGE MemberOf FROM (SELECT FROM V WHERE name='a') TO (SELECT FROM V 
WHERE name='b') SET weight = 5

At this point class "MemberOf" has one record, and it is a regular edge: it 
has a @rid and properties.
Ready for another edge, this time I don't need properties:
CREATE EDGE UserOf FROM (SELECT FROM V WHERE name='a') TO (SELECT FROM V 
WHERE name='c')
At this point class "UserOf" has still zero records, what happened? Orient 
decided that without properties it could be created a lightweight edge.
Now I need to create a last edge, to conclude my experiment:
CREATE EDGE UserOf FROM (SELECT FROM V WHERE name='b') TO (SELECT FROM V 
WHERE name='c') SET weight = 2
This time Orient decided to create a record, since there is a property.

Let's do a recap. Now we should have:

   - 3 *logical* edges (with logical I mean that I don't care if they are 
   regular or lightweight, THEY ARE edge)
   - 2 regular edges (the first and the third)
   - 1 lightweight edge (the second)

Trying with some queries:

   - SELECT FROM E : returns just 2 edges (the regular ones)
   - SELECT FROM MemberOf : returns just 2 edges (the regular ones)
   - SELECT FROM UserOf : returns only the third
   - SELECT expand(inE()) FROM V WHERE name = 'c' : returns the second 
   (lightweight) and the third (regular) edges
   
This is not very clean, since it may lead to write wrong code, but it works 
quite well. I would suggest anyone to choose, if possibile, a model with 
only lightweight edges or only regular edges.

Probably what is really missing to Orient is a command (or maybe i don't 
know it exists) to list all the logical (both regular and lightweight) 
edges.
I also ignore if there is some way to promote a lightweight edge to a 
regular one.

Cheers,
   Riccardo

Il giorno mercoledì 17 giugno 2015 09:10:00 UTC+2, scott molinari ha 
scritto:
>
> Are you sure the "UserOf" child edge wouldn't inherit the MemberOf parent 
> edge's property and thus be a "heavy edge"? If it doesn't, that would go 
> against the principle of inheritance, wouldn't it? 
>
> Scott
>

-- 

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

Reply via email to