Added Ref.Global ProjectStore.ref (int defId).
Added basic Query API, other bits.