Port changes from rasqal_ntriples.c