Fixes RDF export of subobjects

Partial integration of the patch https://gerrit.wikimedia.org/r/#/c/70047/4
from Dbeeson
So this was giving me errors when using dumpRDF.php so I fixed it in this change itself.