예제 #1
0
    $t_place_types->insert();
    if ($t_place_types->numErrors()) {
        print "[Error] couldn't create ca_list row for place types: " . join('; ', $t_place_types->getErrors()) . "\n";
        die;
    }
    $t_place_types->addLabel(array('name' => 'Getty TGN place types'), $pn_en_locale_id, null, true);
}
$vn_place_type_list_id = $t_place_types->getPrimaryKey();
// load places
$o_xml = new XMLReader();
print "[Notice] READING TGN TERMS...\n";
$vn_last_message_length = 0;
$vn_term_count = 0;
$t_place = new ca_places();
$t_place->setMode(ACCESS_WRITE);
$t_place->logChanges(false);
// Don't log changes to records during import – takes time and we don't need the logs
if (true) {
    for ($vn_file_index = 1; $vn_file_index <= 15; $vn_file_index++) {
        $o_xml->open("tgn_xml_12/TGN{$vn_file_index}.xml");
        print "\n[Notice] READING TERMS FROM TGN{$vn_file_index}.xml...\n";
        while ($o_xml->read()) {
            switch ($o_xml->name) {
                # ---------------------------
                case 'Subject':
                    if ($o_xml->nodeType == XMLReader::END_ELEMENT) {
                        if ($va_subject['subject_id'] == '100000000') {
                            break;
                        }
                        // skip top-level root
                        $vs_preferred_term = $va_subject['preferred_term'];