class ImportExportUtils {

  public static long getTopicMapId (String address) {
    int offset = 0;
    if (address.startsWith("M"))
      offset = 1;
    else if (address.startsWith(ONTOPIA_RDBMS_URI_PREFIX)) {
      // Syntax: x-ontopia:tm-rdbms:12345
      offset = ONTOPIA_RDBMS_URI_PREFIX.length ();
      
      // Ignore M suffix on topic map id
      if (address.charAt (offset) == 'M')
        offset = offset + 1;
    }
    
    try {
      return Long.parseLong (address.substring (offset));
    } catch (NumberFormatException e) {
      throw new OntopiaRuntimeException ("'" + address
          + " is not a valid rdbms topic map URI.");
    }
  }

}