A simple way to realize self-attentional modeling for lattice inputs would be to linearize the lattice in topological order and then apply the above model.
such a strategy would ignore the lattice structure and relate queries to keys that cannot possibly appear together according to the lattice.