- Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Schema
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 replaced param : personsBornToValidTypes=[City, Village]
Neo4j db version 4.4.3
lib version : 1.6.0
Test data :
CREATE (u1:Person {name: 'Hashi',age:10}) CREATE (u1:City {name: 'Bangalore'}) CREATE (a)-[r:BORN{date:'23-12-2013'}]->(b) RETURN type(r), r.date Two node [Person,City] one Relationship BORN
Metadata
Metadata
Assignees
Labels
No labels
