Multiple Inheritance Support


#1

Can there be support for multiple inheritance please? While even languages like Java & C# support for multiple inheritance via Interfaces, it will be a powerful & necessary feature for a knowledge graph.


#2

HI @velulev,

We have actually been going back and forth on this one for a while. The conclusion we keep hitting is that we will implement it only when we truly need it because while it is a powerful feature it does add some complexity to the model.

What’s been stopping us from diving into this is that we can’t think of an example that cannot be modeled with the current single inheritance constraint. Do you have such an example in mind? If so that would probably expedite the feature.

Regards,

Filipe


#3

Correct me if I’m wrong, but using Grakn’s model this could be achieve by assigning multiple roles to the same entity right ? if you define it in a hierarchical way, (with car sub vehicle;), is it possible to inherit from multiple entities?

Thanks !


#4

Yes that is 100% correct! and thank you for clarifying the issue. Grakn allows multiple inheritance as long as its from the same “branch”. In other words this works:

insert 
    vehicle sub entity;
    car sub vehicle;
    smaller-car sub car;

However, this does not:

insert 
    vehicle sub entity;
    car sub entity;
    smaller-car sub vehicle;
    smaller-car sub car;

In the latter case smaller-car will not inherit from both but will first be a vehicle and then be changed to a car