Find all inbound outbound edges

GraphQL is strictly typed and strictly queried. You cannot ask for anything generic unless it is already defined as an interface or union.

Given the GraphQL schema:

type x {
  id: ID
  hasY: [y] @hasInverse(field: "hasX")
}
type y {
  id: String! @id
  hasX: [x]
}

You can get the incoming relationships to Y=13 by finding the outgoing relationships of that node if they are mapped with the @hasInverse directive.

query {
  getY(id: "13") {
    hasX {
      id
    }
  }
}

FYI, there is an idea on the development roadmap to support Gremlin. Maybe give your thoughts and use cases over there.

2 Likes