Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-10-2022 06:54 AM
Hello,
I have this query which works exactly as I want in cypher
MATCH (a:article) - [r:IN_TOPIC] -> (t:topic) where t.date = date('2022-06-05') return t.topicnum, r.pos, a.title order by t.topicnum, r.pos
Sadly, all I've managed to do trying using apollo studio to create an equivalent query is give myself a headache!
I can get close, but I cannot figure out how to have properly do the order by topicnumber (in topic), r.pos (in the relationship).
Thanks in advance for any help/advice,
Andre
06-17-2022 11:52 AM - edited 06-17-2022 11:53 AM
You can transform it step by step:
MATCH (a:article) - [r:IN_TOPIC] -> (t:topic)
where t.date = date('2022-06-05')
return t.topicnum, r.pos, a.title
order by t.topicnum, r.pos
Not sure if I got it right, b/c I haven't use the rel-entities of the new library much.
But you can test it live in https://graphql-toolbox.neo4j.io/ with some data in your graph.
Something like this:
Schema
# (a:article) - [r:IN_TOPIC] -> (t:topic) where t.date = date('2022-06-05') return t.topicnum, r.pos, a.title order by t.topicnum, r.pos
type Topic {
topicnum: Int!
date: Date!
inTopic: [ArticleInTopic!]! @relationship(direction:IN,type:"IN_TOPIC")
}
type ArticleInTopic {
topic: Topic
article: Article
pos: Int
}
type Article {
title: String!
}
query:
{
topics(options: { sort: { topicnum: ASC } },
where: { date: "2022-06-05" }) {
topicnum
inTopic(options: { sort: { pos: ASC } }) {
article {
title
}
}
}
}
All the sessions of the conference are now available online