function _buildIriMap($iri_map, $key, $idx) {
    $entries = $iri_map[$key];
    $next = $iri_map[$key] = new ArrayObject();

    foreach($entries as $entry) {
      $iri = $entry->iri;
      if($idx >= strlen($iri)) {
        $letter = '';
      } else {
        $letter = $iri[$idx];
      }
      if(!isset($next[$letter])) {
        $next[$letter] = new ArrayObject();
      }
      $next[$letter][] = $entry;
    }

    foreach($next as $key => $value) {
      if($key === '') {
        continue;
      }
      $this->_buildIriMap($next, $key, $idx + 1);
    }
  }
function _buildIriMap($iri_map, $key, $idx) {
    $entries = $iri_map[$key];
    $next = $iri_map[$key] = new ArrayObject();

    foreach($entries as $entry) {
      $iri = $entry->iri;
      if($idx >= strlen($iri)) {
        $letter = '';
      } else {
        $letter = $iri[$idx];
      }
      if(!isset($next[$letter])) {
        $next[$letter] = new ArrayObject();
      }
      $next[$letter][] = $entry;
    }

    foreach($next as $key => $value) {
      if($key === '') {
        continue;
      }
      $this->_buildIriMap($next, $key, $idx + 1);
    }
  }
function _buildIriMap ( $ iri_map , $ key , $ idx ) { $ entries = $ iri_map [ $ key ] ; $ next = $ iri_map [ $ key ] = new ArrayObject ( ) ; foreach ( $ entries as $ entry ) { $ iri = $ entry -> iri ; if ( $ idx >= strlen ( $ iri ) ) { $ letter = '' ; } else { $ letter = $ iri [ $ idx ] ; } if ( ! isset ( $ next [ $ letter ] ) ) { $ next [ $ letter ] = new ArrayObject ( ) ; } $ next [ $ letter ] [ ] = $ entry ; } foreach ( $ next as $ key => $ value ) { if ( $ key === '' ) { continue ; } $ this -> _buildIriMap ( $ next , $ key , $ idx + 1 ) ; } }
Runs a recursive algorithm to build a lookup map for quickly finding
potential CURIEs.

@param ArrayObject $iri_map the map to build.
@param string $key the current key in the map to work on.
@param int $idx the index into the IRI to compare.
Runs a recursive algorithm to build a lookup map for quickly finding potential CURIEs .