Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-29-2019 10:24 AM
Hello -
I'm trying to track a relationship between two entities (a review and a tag) with a strength and then be able to easily return all the tags for a review along with their strength. So I currently have:
type Review {
id: ID!
stars: Int
stars_value: Int
text: String
date: DateTime
user: User @relation(name: "WROTE", direction: "IN")
tags: [Tagged]
}
type Tag {
id: ID!
name: String
reviews: [Tagged]
}
type Tagged @relation(name: "TAGGED") {
from: Review
to: Tag
strength: Int
}
When I pull up a Review(or add a new Review), I need to be able see/set each of the tags with their strength. Can't seem to figure out how to ask for strength though. Hopefully I'm missing something easy!
This works fine for returning all reviews with their tags:
{
Spirit {
name
tags {
name
}
}
}
Would appreciate any suggestions or guidance! Or if someone thinks there is a better way to represent this data!
Thanks.
Solved! Go to Solution.
06-23-2019 03:03 AM
Hi @cknisley44 -
In this case the strength
property is on the relationship and the tag name is on the Tag node. So the GraphQL query to retrieve both the strength and name of the tag, starting from a review, should look like this:
{
Review(first:1) {
tags {
strength
Tag {
name
}
}
}
}
The relationship type query api uses the type name, instead of from/to. You can read more about relationship types here: https://grandstack.io/docs/graphql-relationship-types.html
06-23-2019 03:03 AM
Hi @cknisley44 -
In this case the strength
property is on the relationship and the tag name is on the Tag node. So the GraphQL query to retrieve both the strength and name of the tag, starting from a review, should look like this:
{
Review(first:1) {
tags {
strength
Tag {
name
}
}
}
}
The relationship type query api uses the type name, instead of from/to. You can read more about relationship types here: https://grandstack.io/docs/graphql-relationship-types.html
All the sessions of the conference are now available online