Why can't I create two separate attributes to the same node?

type LexicalEntry {
  id: ID!
  canonicalForm: LexicalForm! @hasInverse(field: lexicalEntry)
  otherForms: [LexicalForm] @hasInverse(field: lexicalEntry)

type LexicalForm {
  id: ID!
  lexicalEntry: LexicalEntry!


{"errors":[{"message":"resolving updateGQLSchema failed because input:365: Type LexicalEntry; Field otherForms: @hasInverse should be consistant. LexicalEntry.otherForms is the inverse of LexicalForm.lexicalEntry, but LexicalForm.lexicalEntry is the inverse of LexicalEntry.canonicalForm.\n (Locations: [{Line: 3, Column: 4}])","extensions":{"code":"Error"}}]}%

Why can’t I do this? I figured that it would create two edges to the same type but with different names, an edge called canonicalForm and then a list of edges called otherForms. If I can only add @hasInverse to one of them, say otherForms is the only attribute with @hasInverse added—then I won’t be able to lookup up the LexicalEntry for a given LexicalForm if it is linked via canonicalForm.

Seems like a pretty severe limitation, is there a workaround for this?

EDIT: Perhaps the workaround is to add LexicalForm.isCanonical: Boolean!

Looks like it does not understand two edges connected to one type, As you yourself mentioned adding isCanonical is a good way for handling this. If you were using dql it was a good fit for using facet and putting isCanonical on the edge. :innocent:

1 Like

This was brought up in Discord so resurrecting it here.

This actually was supported in a weird kind of way, but it leads to many problems.

So I believe they added an error to prevent this from being valid.

The problem lies when you try to create the edges from the edge which is the common link to multiple other reverse edges. The GraphQL rewriting mechanism gets confused on which one of the reverse edges it should create for the backlink.

1 Like

Well, I guess ideally there needs to be a way to configure the GraphQL resolver on how to resolve specific edges in this kind of situation?