How to use a precise cypher request in GRANDstack starter?

I started learning GRANDstack and I'm using the GRANDstack starter.

I have connected my Neo4j database to this starter.I would like to do something like this:

Here I displayed titles of articles having the community id 996.

What I would like to do is to be able, in the user interface, to display bloc like the image, and each blocs will be each community (for example the first bloc will be the community 996)

I would like to use a precise Cypher request in order to display articles by clusters (community in the request) in the user interface.

MATCH (a:ARTICLE)
WITH a, collect(a.community) as community
ORDER BY a.community
RETURN community, count(a), a.title

The graphql schema has all the types required.
I pasted this request in the schema.graphql.

type Query {

  communities: Int! @cypher(statement:"
    MATCH (a:ARTICLE) 
    WITH a, collect(a.community) as community
    RETURN community, count(a), a.title")

}

I don't know if it is the good way to do it. If it is what do I have to do next ?
And if not where do I have to put this request in the GRANDstack starter ?

You defined your query as returning an int, but your cypher returns 3 fields so i don't think that's gonna work how you'd expect. as i was writing the next part of this answer i realized your intent could be one of several and i didn't want to guess. for the example you have; i'd change it to

type Query {

  communityCount: Int! @cypher(statement:"
    MATCH (a:ARTICLE) 
    WITH a, collect(a.community) as community
    RETURN size(community)")

}

Thank you for your answer. Yes I would like to be able to display the titles by clusters id.
So I try to aggregate title by community

How about

type community{
  title:string
  count:Int
}

type query{
communityCount: [community] @cypher(statement:"
    MATCH (a:ARTICLE) 
    WITH a, collect(a.community) as community
    RETURN {title:a.title, count:size(community)}" )
}

Thank you for your answer, I tried but it doesn't work.

I would like to do something like this:

Here I displayed titles of articles having the community id 996.

What I would like to do is to be able, in the user interface, to display bloc like the image, and each blocs will be each community (for example the first bloc will be the community 996)

when you say "it didn't work" can you elaborate ?
to limit by community you might consider adding a parameter to the query. something like this

type query{
communityCount(communityNumber:ID!): [community] @cypher(statement:"
    MATCH (a:ARTICLE) 
    WHERE a.community = $communityNumber
    WITH a, collect(a.community) as community
    RETURN {title:a.title, count:size(community)}" )
}

This type doesn't work in my schema.

type community{
  title:string
  count:Int,
}

If I consider a parameter, do I have to do like a foor loop next ? To display each communities separately in the user interface.

no comma of course on that type. and i presume that in general the answer is yes, but that is the case regardless of this approach.