Made "in" link query dependent on whether there are further triples

this saves query time