protected function _hashQuads($id, $bnodes, $namer) {
    // return cached hash
    if(property_exists($bnodes->{$id}, 'hash')) {
      return $bnodes->{$id}->hash;
    }

    // serialize all of bnode's quads
    $quads = $bnodes->{$id}->quads;
    $nquads = array();
    foreach($quads as $quad) {
      $nquads[] = $this->toNQuad($quad, property_exists($quad, 'name') ?
        $quad->name->value : null, $id);
    }

    // sort serialized quads
    sort($nquads);

    // cache and return hashed quads
    $hash = $bnodes->{$id}->hash = sha1(implode($nquads));
    return $hash;
  }