> select *
Show all variables starting with ?
> wd:Q9682
Find item Q9682 (Queen Elizabeth 2)
> (wdt:P25|wdt:P22)*
Follow edges that are either P22 (father) or P25 (mother) zero-or more times
Everytime you follow one of those edges, add the new item to ?p. Keep following these edges until you can't anymore.
> ?p wdt:P25|wdt:P22 ?q
For every ?p follow a mother/father edge precisely once, call the item it points to ?q (if there is no such edge we get rid of the p)
The end result, is we have a list of rows containing pairs of (an ancestor of elizabeth, one of that ancestor's direct parents).
----
I feel like one of the reasons that sparql is confusing is because people use their intuitions from SQL which is wrong - since the underlying data model is different but the syntax looks vaugely sql-like which leads to misunderstandings.