How to get relationship source/target using GraphQL?

Hello everyone,
How can I get source and target of certain relationship? While using Ratel UI, you can click on random relationship and, it will show two different buttons, “Find Source” & "Find target. Is there any way to get this information related to the source and target when I fetch the data using GraphQL queries?

I’ve read somewhere in the documentation that relationships can’t be used in reverse.

Schema:

type Entity @withSubscription {
    id: ID!
    name: String! @id @search(by: [exact, regexp])
    source: String
    has: [Entity]
}

Using this schema, I can create nested Entities, where each one of them may “have” multiple other entities. If I want to perform query related to those Entities, only the “parent” entity will know who are his “children entities”. A child entity doesn’t know anything about his “parent”, it only knows about his “child entities”.

There is a way to create backwards relationships, using @hasInverse field, but that will make other problems.

type Entity @withSubscription {
    id: ID!
    name: String! @id @search(by: [exact, regexp])
    source: String
    has: [Entity] @hasInverse (field: "has")
}

Based on this schema, entities will know about each other, but now I don’t know how to differ “parent Entities” from the “children Entities”.

One of the ways to solve this problem, is using this schema:

type Entity @withSubscription {
    id: ID!
    name: String! @id @search(by: [exact, regexp])
    source: String
    belongs: Entity
    has: [Entity]
}

By using this schema, each of the entities will store its “relationships” with other entities using two different properties, belongs & has. Each entity may have only one “parent” and multiple other “child entities”.

Thanks in advance!