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

Inheritance of Edges is not respected #7201

Closed
topofocus opened this issue Feb 25, 2017 · 4 comments
Closed

Inheritance of Edges is not respected #7201

topofocus opened this issue Feb 25, 2017 · 4 comments

Comments

@topofocus
Copy link

topofocus commented Feb 25, 2017

OrientDB Version: 2.2.15

Expected behavior

Edges should respect object inheritance

Actual behavior

Edges are displayed separately in every case

Steps to reproduce

 orientdb {db=temp}> create class stillhalter extends V
 orientdb {db=temp}> create class a extends V
 orientdb {db=temp}> create class aktie extends a
 orientdb {db=temp}> create class option extends a
 orientdb {db=temp}> create class future extends a
 orientdb {db=temp}> create class ist_componente extends E
 orientdb {db=temp}> create class ist_underlying extends ist_componente
 orientdb {db=temp}> create class basiswert extends V
 orientdb {db=temp}> insert into basiswert set name =  "first name"
 -> Inserted record 'basiswert#89:0{name:first name} v1' in 0,015000 sec(s).
 orientdb {db=temp}> insert into aktie set symbol= 'ABC', basiswert = #89:0
 -> Inserted record 'aktie#69:0{basiswert:#89:0,symbol:ABC} v1' in 0,003000 sec(s).
 orientdb {db=temp}> insert into option set expiry= '3.5.45', basiswert = #89:0
 -> Inserted record 'option#73:0{basiswert:#89:0,expiry:3.5.45} v1' in 0,005000 sec(s).
 oorientdb {db=temp}> insert into option set expiry= '3.5.65', right = 'put', basiswert = #89:0
 -> Inserted record 'option#74:0{basiswert:#89:0,expiry:3.5.65,right:put} v1' in 0,005000 sec(s).
 orientdb {db=temp}> insert into stillhalter set basiswert= #89:0
 -> Inserted record 'stillhalter#61:0{basiswert:#89:0} v1' in 0,003000 sec(s).
 orientdb {db=temp}> create edge ist_underlying from #69:0 to #61:0
 orientdb {db=temp}> create edge ist_komponente from #73:0 to #61:0
 orientdb {db=temp}> create edge ist_komponente from #74:0 to #61:0
 
orientdb {db=temp}> select from #61:0

+----+-----+-----------+-----------------+---------+-----------------+
|#   |@RID |@CLASS     |in_ist_komponente|basiswert|in_ist_underlying|
+----+-----+-----------+-----------------+---------+-----------------+
|0   |#61:0|stillhalter|[#93:0,#94:0]    |#89:0    |[#85:0]          |
+----+-----+-----------+-----------------+---------+-----------------+


Because

E < ist_komponente < is_underlying

"ist_komponente" must include #85:0

+----+-----+-----------+-----------------+---------+-----------------+
|#   |@RID |@CLASS     |in_ist_komponente|basiswert|in_ist_underlying|
+----+-----+-----------+-----------------+---------+-----------------+
|0   |#61:0|stillhalter|[#93:0,#94:0,#85:0]    |#89:0    |[#85:0]          |
+----+-----+-----------+-----------------+---------+-----------------+

is the expected result.

In my view, this is a major bug

@smolinari
Copy link
Contributor

smolinari commented Feb 25, 2017

As I understand inheritance of edges, what is shared are the properties of the edge, not the connectivity. Naturally, this only works, if you are using standard edges and not lightweight edges.

If you connect two vertices with "is_underlying", that is the only connection being made and the only connection you'll see. So, what you are seeing is correct behavior.

Now, to make clear what is happening with inheritance, let's say you add a property "createdAt" on the "ist_komponente" edge class. If you create an edge with "is_underlying", the "createdAt" property is also available to use in the schema of the "is_underlying" edge class. If you also searched for edges created on a certain day from the "ist_komponente" class, you'll also get results from the "is_underlying" class. That is what inheritance offers.

Scott

@topofocus
Copy link
Author

The problem is: The database is inconsistent.

If I ask the Component-Edge: How many Items belong to Stilhalter, I get "3" as answer.
If I ask the Stillhalter, how many Components are connected, I get "2" as answer.

@wolf4ood
Copy link
Member

hi @topofocus
the database is not inconsistent. The edge links are stored in separated List called Ridbag.
This is a underlying implementation of ODB.

If I ask the Component-Edge: How many Items belong to Stilhalter, I get "3" as answer.
If I ask the Stillhalter, how many Components are connected, I get "2" as answer.

You should use graph function and not use the fields directly

select  inE('ist_komponente') as inKomponente ,inE('ist_underlying') as inUnderlying from #61:0

@topofocus
Copy link
Author

I notice, Edge-properties just reflect the morphology not the structure.

Thanks for clarification. I will adapt this in ActiveOrient.

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

No branches or pull requests

3 participants