How to use DQL to query those film's name of (starring is _:luke and starring is _:leia)?

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.