Fixed problem with queries something like this: building (floor.room)
Added tests for problem in previous commit.