2021-12-28

How are nodes and edges connected in GraphQL?

I am using https://arrows.app/ to create a basic network:

enter image description here

And the resulting GraphQL it creates is:

type Person {
  Name: Dante Alighieri
  wroteBook: Book @relationship(type: "WROTE", direction: OUT)
}

type Book {
  Title: The Inferno
  personWrote: Person @relationship(type: "WROTE", direction: IN)
  personReviewed: Person @relationship(type: "REVIEWED", direction: IN)
  personRead: Person @relationship(type: "READ", direction: IN)
}

type Person {
  Name: Harold Bloom
  reviewedBook: Book @relationship(type: "REVIEWED", direction: OUT)
  reviewedBook: Book @relationship(type: "REVIEWED", direction: OUT)
}
...

How do we know in GraphQL that these two relationships are 'linked'?

type Person {
  Name: Dante Alighieri
  wroteBook: Book @relationship(type: "WROTE", direction: OUT)
}
type Book {
  Title: The Inferno
  personWrote: Person @relationship(type: "WROTE", direction: IN)
}

Does sequential ordering in GraphQL imply a relationship, as there is no ID or mention of 'The Inferno' in the 'Person[@Name=Dante Alighieri].wroteBook' entry. How do we know, for example, that it doesn't refer to a later entry, such as:

type Book {
  Title: The Tempest
  personWrote: Person @relationship(type: "WROTE", direction: IN)
}


from Recent Questions - Stack Overflow https://ift.tt/3ptkxQt
https://ift.tt/3ExHSov

No comments:

Post a Comment