optimized reference-related WQL

now follows join pattern (instead of IN (<subselect>) )