change-monitor, change-event: Be smarter when resolving new item IDs

Instead of immediately firing a separate SPARQL query to resolve each
incoming ID, we can batch them together and issue a single query per
batch. This should reduce the workload on the database.

Original patch from Cosimo Cecchi for gnome-documents.

Fixes: https://bugzilla.gnome.org/721402
change-monitor: Avoid a copy

It appears to be worth our while to try and optimize this code.

Fixes: https://bugzilla.gnome.org/721402
change-monitor: Rename a variable for consistency

... with gnome-documents.

Fixes: https://bugzilla.gnome.org/721402