cancel
Showing results for 
Search instead for 
Did you mean: 

Nested type definition in GraphQL:: Address, City, State, Country

sakhsen
Node Link

I have the following address relationship.

:Address-[r:LIVES_IN]->:City
:City-[r2:PART_OF]->State
:State-[r3:BELONGS_TO]->Country

Please clarify how do we define our type definition in GraphQL.

type Country {
countryId: ID!
name: String!
}
type State {
stateId: ID!
name: String!
belongs_to: Country @relation(direction: OUT, name: "BELONGS_TO")
}

type City {
cityId: ID!
name: String!
part_of: State @relation(direction: OUT, name: "PART_OF")
}

type Address {
address1: String!
address2: String
address3: String
location: Point
city: City @relation(name: "LIVES_IN", direction: OUT)
state: ?? <<<<<< Should i use Cypher with Merge?
country: ?? <<<<< Should I use Cyper with Merge?
}

Please clarify!

0 REPLIES 0
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.