Michel is right. Your dataset seems to have some formatting mistakes; it’s missing some predicates in some fields. Compare your dataset to the dataset here. For example your last set of fields should be:
You’re missing the <name> and <revenue> predicates.
You have similar missing pieces in previous sets. Fix those and you won’t have trouble running the mutation and then perform queries.
Hope this helps.
@sakib My mistake . Then i updated this dataset. thank you very much.
But My trouble is I dont know how to query to get those films which has multiple starrings simultaneously.
For example: those films which include two persons (Luke and Leia) simultaneously.
my now dql is this, but this dql is complex and slow. @MichelDiz@sakib do you have better dql to get the data?
now is
{
var(func:eq(name, "Luke Skywalker")) @cascade{
A as ~starring{}
}
B as var(func:uid(A)) @cascade{
starring @filter(eq(name, "Princess Leia")){}
}
films(func: uid(B)) {
uid
name
starring{
uid
name
}
}
}
Slow how? This query looks pretty okay to me. Can be something on your side.
You don’t need cascade here. And the curly braces e.g
var(func:eq(name, "Luke Skywalker")) {
A as ~starring
}
In the first block you are collecting all Luke’s movies and in that second one you are applying the filter with Leia. Looks normal to me.
BTW, I would do like
{
Luke as var(func:eq(name, "Luke Skywalker")) {
A as ~starring
}
var(func:uid(A)) @cascade {
B as uid
Leia as starring @filter(eq(name, "Princess Leia"))
}
films(func: uid(B)) {
uid
name
starring @filter(uid(Luke,Leia)) {
uid
name
}
}
}
About the second block - I think there is a difference when using cascade. I don’t remember well. If not so, nevermind.
About the films block, filter the starring with the target seems logic as you wanna check both Luke and Leia relation.
Assuming this, I think Han Solo shouldn’t be in the result. Even if he is in the movie.
Yeah, cuz when I mentioned “About the second block - I think there is a difference when using cascade. I don’t remember well. If not so, nevermind.” I wasn’t sure in which way it would fail. So fixing it bellow.
{
Luke as var(func:eq(name, "Luke Skywalker")) {
A as ~starring
}
B as var(func:uid(A)) @cascade {
Leia as starring @filter(eq(name, "Princess Leia"))
}
films(func: uid(B)) {
uid
name
starring @filter(uid(Luke,Leia))
{
uid
name
}
}
}