void handleNamedGraph(long graphId, long uuid, long revision, NamedGraphRevision ngr)
     throws AnzoException {
   URI graphNode = getValue(graphId);
   URI uuidNode = getValue(uuid);
   ngr.revision = revision;
   ngr.uuid = uuidNode;
   ngs.put(graphNode, ngr);
 }
 void handleStatement(boolean addition, Long graphId, Long subj, Long prop, Long obj)
     throws AnzoException {
   URI graphNode = getValue(graphId);
   Resource subjNode = getValue(subj);
   URI propNode = getValue(prop);
   Value objNode = getValue(obj);
   URI ngURI = graphNode;
   boolean meta = false;
   if (UriGenerator.isMetadataGraphUri(ngURI)) {
     ngURI = UriGenerator.stripEncapsulatedURI(NAMESPACES.METADATAGRAPH_PREFIX, ngURI);
     meta = true;
   }
   NamedGraphRevision ngr = ngs.get(ngURI);
   if (ngr == null) {
     throw new AnzoException(
         ExceptionConstants.DATASOURCE.NAMEDGRAPH.REVISION_NOT_FOUND, "?", ngURI.toString());
   }
   if (meta
       && (!ngr.readMeta
           && !(ngr.readGraph && subjNode.equals(ngURI) && isSpecialMeta(propNode)))) {
     return;
   } else if (!meta && !ngr.readGraph) {
     return;
   }
   if (lastNGRevision == null || !lastNGRevision.namedGraphUri.equals(ngURI)) {
     handler.handleNamedGraph(ngr.namedGraphUri, ngr.uuid, ngr.revision);
     lastNGRevision = ngr;
     if (newGraph.get(ngURI) && lastNGRevision.cache == null) {
       lastNGRevision.cache = new ArrayList<Statement>();
     }
   }
   handler.handleStatement(meta, addition, subjNode, propNode, objNode, graphNode);
   if (addition && lastNGRevision.cache != null) {
     lastNGRevision.cache.add(
         Constants.valueFactory.createStatement(subjNode, propNode, objNode, graphNode));
   }
 }