Reduce number of repository operations required to read and write objects

This patch, in conjunction with separate patch against sparql-client (https://github.com/ruby-rdf/sparql-client/pull/45) make it possible to use Spira with a SPARQL/Update repository backend.  These changes eliminate unnecessary round trips to the repository by caching results and batching up queries.