Closed flyingsilverfin closed 3 years ago
Further, we want to add the ability to override a role in a sub-relation using as
, which will block the sub-relation from inheriting the role form the parent. Not writing anything should simply inherit the role that is related in the parent.
Corner cases:
as
in children should be blocked as wellThere will also be a syntax change to Graql, @flyingsilverfin :
When you define roles in a relation
, such as
marriage sub relation,
relates husband,
relates wife;
You will refer to the roles being played by an entity
, such as:
man sub person,
plays marriage:husband;
When a relation inherits a role from a parent relation, such as the role child
below:
parenthood sub relation,
relates parent,
relates child;
motherhood sub parenthood,
relates mother as parent;
# the role 'child' is inherited
You must can only refer to the child
role through the relation it was first declared:
person sub relation,
plays parenthood:child;
Can you aggregate all the comments (both of yours and mine) into a clear breakdown of changes included in this issue, in the issue description, @flyingsilverfin? All this should be one big change that goes in together.
@haikalpribadi sure - do you think inheriting roles is a prerequisite? the change is going to be big already, might be worth breaking it down where we can and doing first inheritance, then making the syntax changes.
Note that some of the changes will be in Graql, and some are in Grakn Core. You can break them into the respective smaller task and put the issue in the correct repo, if that helps you. Make sure to reference them in this issue description - have a checklist of complete ones would be very useful.
Typo in comment by @haikalpribadi https://github.com/graknlabs/graql/issues/107#issuecomment-602491168
person sub relation; should be person sub entity;
this would align it with the latter comment
You will refer to the roles being played by an entity, such as:
man sub person,
is this fully implemented, if so should this issue be closed, If not how about a description of what is and is not working and why are the changes to the language not documented in the TypeDB release notes
they were documented in the first 2.0 graql/typeql release notes, but you're right it should be closed
Problem to Solve
Roles are currenty globally scoped, which not only makes naming more difficult, but also increases complexity of Graql as we can share roles across unrelated parts of the type hierarchy.
Proposed Solution
We will scope roles to belong to relations. In other words, roles will be scoped to a relation and not live independently. This will making naming much simpler, as roles will be interpreted within the context of the relation name the user is providing.