libtracker-sparql: Handle correctly backreferences in TrackerResource tree

We do keep a notion of already visited TrackerResources when generating the
output. However that could go wrong if the TrackerResource references itself
or a "parent" TrackerResource.

Add the resources to the done list beforehand, so they are ensured not to be
visited again if such backreferences exist.

Related: tracker-miners#60
1 job for wip/carlosg/handle-recursive-resources in 2 minutes and 17 seconds (queued for 2 seconds)
Status Job ID Name Coverage
passed #259377