You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type Person {
name: String
age: Int
livesIn : Location @relation(name:"LIVES_IN", direction: OUT)
livedIn : [Location] @relation(name:"LIVED_IN", direction: OUT)
born : Birth
died : Death
}
interface Temporal {
date: String
}
type Birth implements Temporal @relation(name:"BORN") {
from: Person
to: Location
date: String
}
type Death implements Temporal @relation(name:"DIED",from:"who",to:"where") {
who: Person
where: Location
date: String
}
interface Location {
name: String
founded: Person @relation(name:"FOUNDED", direction: IN)
sort_Arg: String
}
type City implements Location {
name: String
founded: Person @relation(name:"FOUNDED", direction: IN)
sort_Arg: String
city_Arg: String
}
type Village implements Location {
name: String
founded: Person @relation(name:"FOUNDED", direction: IN)
sort_Arg: String
villageArg: String
}
there are two problems
Unable to get only Relationship Property
query {
persons{
born{
date
}
}
}
Cypher
MATCH (persons:Person)
CALL {
WITH persons
OPTIONAL MATCH (persons)-[personsBorn:BORN]->(personsBornTo:Location)
RETURN personsBorn {
.date
} AS personsBorn LIMIT 1
}
RETURN persons {
born: personsBorn
} AS persons
issue is there is no Location node . Location is interface .
query interface
query {
persons{
born{
date
to {
name
}
}
}
}
MATCH (persons:Person)
CALL {
WITH persons
OPTIONAL MATCH (persons)-[personsBorn:BORN]->(personsBornTo:Location)
RETURN personsBorn {
.date,
to: personsBornTo {
.name,
__typename: head([label IN labels(personsBornTo) WHERE label IN $personsBornToValidTypes])
}
} AS personsBorn LIMIT 1
}
RETURN persons {
born: personsBorn
} AS persons
Schema
there are two problems
Cypher
issue is there is no Location node . Location is interface .
replaced param : personsBornToValidTypes=[City, Village]
Neo4j db version 4.4.3
lib version : 1.6.0
Test data :
Two node [Person,City] one Relationship BORN
The text was updated successfully, but these errors were encountered: