Insert default terms.
1069
private function insert_default_terms() {
		global $wpdb;

		// Default category
		$cat_name = __( 'Uncategorized' );

		/* translators: Default category slug */
		$cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) );

		if ( global_terms_enabled() ) {
			$cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
			if ( null === $cat_id ) {
				$wpdb->insert(
					$wpdb->sitecategories,
					[
						'cat_ID'            => 0,
						'cat_name'          => $cat_name,
						'category_nicename' => $cat_slug,
						'last_updated'      => current_time(
							'mysql',
							true
						),
					]
				);
				$cat_id = $wpdb->insert_id;
			}
			update_option( 'default_category', $cat_id );
		} else {
			$cat_id = 1;
		}

		$wpdb->insert(
			$wpdb->terms,
			[
				'term_id'    => $cat_id,
				'name'       => $cat_name,
				'slug'       => $cat_slug,
				'term_group' => 0,
			]
		);
		$wpdb->insert(
			$wpdb->term_taxonomy,
			[
				'term_id'     => $cat_id,
				'taxonomy'    => 'category',
				'description' => '',
				'parent'      => 0,
				'count'       => 0,
			]
		);
	}
349259
def add(self, word):
        """"""
        if not word or word.strip() == '':
            return
        self.words[word]=word
788774
private function taxonomyAddDefaultTerms($parent, $terms)
    {
        foreach ($terms as $term) {
            return $this->addDefaultTaxTerm($parent, $terms);
        }
    }
229714
def __init_defaults(self, config):
        """"""

        provider = self.__provider

        if provider == 'sqlite':
            config.setdefault('dbname', ':memory:')
            config.setdefault('create_db',  True)
        elif provider == 'mysql':
            config.setdefault('port', 3306)
            config.setdefault('charset', 'utf8')
        elif provider == 'postgres':
            config.setdefault('port', 5432)
        elif provider == 'oracle':
            config.setdefault('port', 1521)
        else:
            raise ValueError('Unsupported provider "{}"'.format(provider))

        if provider != 'sqlite':
            config.setdefault('host', 'localhost')
            config.setdefault('user', None)
            config.setdefault('password', None)
            config.setdefault('dbname', None)
982337
def add(self, entries, table=None, columns=None, ignore=False):
        """"""
        # Default table and columns #
        if table is None:   table   = self.main_table
        if columns is None: columns = self.get_columns_of_table(table)
        # Default columns #
        question_marks = ','.join('?' for c in columns)
        cols           = ','.join('"' + c + '"' for c in columns)
        ignore         = " OR IGNORE" if ignore else ""
        sql_command    = 'INSERT%s into "%s"(%s) VALUES (%s);'
        sql_command    = sql_command % (ignore, table, cols, question_marks)
        # Possible errors we want to catch #
        errors  = (sqlite3.OperationalError, sqlite3.ProgrammingError)
        errors += (sqlite3.IntegrityError, sqlite3.InterfaceError, ValueError)
        # Do it #
        try:
            new_cursor = self.own_connection.cursor()
            new_cursor.executemany(sql_command, entries)
        except errors as err:
            raise Exception(self.detailed_error(sql_command, columns, entries, err))
        except KeyboardInterrupt as err:
            print("You interrupted the data insertion.")
            print("Committing everything done up to this point.")
            self.own_connection.commit()
            raise err
357673
private void changeReplicas(PrimaryTerm term) {
    threadContext.execute(() -> {
      if (this.term == null || term.term() > this.term.term()) {
        this.term = term;
      }
    });
  }
654257
def insert(self, index, value):
        """"""
        self.check(value)
        self._user_list.insert(index, value)
537797
def _add_keyword(self, collection_id, name, doc, args):
        
        argstring = json.dumps(args)
        self.db.execute("""
            INSERT INTO keyword_table
                (collection_id, name, doc, args)
            VALUES
                (?,?,?,?)
        """, (collection_id, name, doc, argstring))
1363529
def init_defaults(self):
        
        super(ModelTable, self).init_defaults()
        self.model = self.table
        self.name = self.model._meta.db_table
359555
def add_term(self, t):
        """"""
        if t not in self.terms:
            if t.parent_term_lc == 'root':
                self.terms.append(t)

                self.doc.add_term(t, add_section=False)

                t.set_ownership()

            else:
                raise GenerateError("Can only add or move root-level terms. Term '{}' parent is '{}' "
                                    .format(t, t.parent_term_lc))

        assert t.section or t.join_lc == 'root.root', t
123641
public function addTerm($terms, $taxonomy, $parent = 0, $order = 0)
    {
        $terms = TaxableUtils::makeTermsArray($terms);

        $this->createTaxables($terms, $taxonomy, $parent, $order);

        $terms = Term::whereIn('name', $terms)->pluck('id')->all();

        if (count($terms) > 0) {
            foreach ($terms as $term) {
                if ($this->taxonomies()->where('taxonomy', $taxonomy)->where('term_id', $term)->first())
                    continue;

                $tax = Taxonomy::where('term_id', $term)->first();
                $this->taxonomies()->attach($tax->id);
            }

            return;
        }

        $this->taxonomies()->detach();
    }
357841
def insert(collection_name, docs, check_keys,
           safe, last_error_args, continue_on_error, opts, ctx=None):
    """"""
    if ctx:
        return _insert_compressed(
            collection_name, docs, check_keys, continue_on_error, opts, ctx)
    return _insert_uncompressed(collection_name, docs, check_keys, safe,
                                last_error_args, continue_on_error, opts)
697843
def insert(self, index = 0, *widgets):
        """"""
        for widget in widgets:
            self._add(widget, index)
            index +=1 # as we are moving forwards
        self._sort()
452859
public function insertTerms() {

		if ( ! taxonomy_exists( 'front-matter-type' ) ) {
			$this->registerTaxonomies();
		}

		// Front Matter
		wp_insert_term(
			'Abstract', 'front-matter-type', [
				'slug' => 'abstracts',
			]
		);
		wp_insert_term(
			'Acknowledgements', 'front-matter-type', [
				'slug' => 'acknowledgements',
			]
		);
		wp_insert_term(
			'Before Title Page', 'front-matter-type', [
				'slug' => 'before-title',
			]
		);
		wp_insert_term(
			'Chronology, Timeline', 'front-matter-type', [
				'slug' => 'chronology-timeline',
			]
		);
		wp_insert_term(
			'Dedication', 'front-matter-type', [
				'slug' => 'dedication',
			]
		);
		wp_insert_term(
			'Disclaimer', 'front-matter-type', [
				'slug' => 'disclaimer',
			]
		);
		wp_insert_term(
			'Epigraph', 'front-matter-type', [
				'slug' => 'epigraph',
			]
		);
		wp_insert_term(
			'Foreword', 'front-matter-type', [
				'slug' => 'foreword',
			]
		);
		wp_insert_term(
			'Genealogy, Family Tree', 'front-matter-type', [
				'slug' => 'genealogy-family-tree',
			]
		);
		wp_insert_term(
			'Image credits', 'front-matter-type', [
				'slug' => 'image-credits',
			]
		);
		wp_insert_term(
			'Introduction', 'front-matter-type', [
				'slug' => 'introduction',
			]
		);
		wp_insert_term(
			'List of Abbreviations', 'front-matter-type', [
				'slug' => 'list-of-abbreviations',
			]
		);
		wp_insert_term(
			'List of Characters', 'front-matter-type', [
				'slug' => 'list-of-characters',
			]
		);
		wp_insert_term(
			'List of Illustrations', 'front-matter-type', [
				'slug' => 'list-of-illustrations',
			]
		);
		wp_insert_term(
			'List of Tables', 'front-matter-type', [
				'slug' => 'list-of-tables',
			]
		);
		wp_insert_term(
			'Miscellaneous', 'front-matter-type', [
				'slug' => 'miscellaneous',
			]
		);
		wp_insert_term(
			'Other Books by Author', 'front-matter-type', [
				'slug' => 'other-books',
			]
		);
		wp_insert_term(
			'Preface', 'front-matter-type', [
				'slug' => 'preface',
			]
		);
		wp_insert_term(
			'Prologue', 'front-matter-type', [
				'slug' => 'prologue',
			]
		);
		wp_insert_term(
			'Recommended citation', 'front-matter-type', [
				'slug' => 'recommended-citation',
			]
		);
		wp_insert_term(
			'Title Page', 'front-matter-type', [
				'slug' => 'title-page',
			]
		);

		// Back Matter
		wp_insert_term(
			'About the Author', 'back-matter-type', [
				'slug' => 'about-the-author',
			]
		);
		wp_insert_term(
			'About the Publisher', 'back-matter-type', [
				'slug' => 'about-the-publisher',
			]
		);
		wp_insert_term(
			'Acknowledgements', 'back-matter-type', [
				'slug' => 'acknowledgements',
			]
		);
		wp_insert_term(
			'Afterword', 'back-matter-type', [
				'slug' => 'afterword',
			]
		);
		wp_insert_term(
			'Appendix', 'back-matter-type', [
				'slug' => 'appendix',
			]
		);
		wp_insert_term(
			"Author's Note", 'back-matter-type', [
				'slug' => 'authors-note',
			]
		);
		wp_insert_term(
			'Back of Book Ad', 'back-matter-type', [
				'slug' => 'back-of-book-ad',
			]
		);
		wp_insert_term(
			'Bibliography', 'back-matter-type', [
				'slug' => 'bibliography',
			]
		);
		wp_insert_term(
			'Biographical Note', 'back-matter-type', [
				'slug' => 'biographical-note',
			]
		);
		wp_insert_term(
			'Colophon', 'back-matter-type', [
				'slug' => 'colophon',
			]
		);
		wp_insert_term(
			'Conclusion', 'back-matter-type', [
				'slug' => 'conclusion',
			]
		);
		wp_insert_term(
			'Credits', 'back-matter-type', [
				'slug' => 'credits',
			]
		);
		wp_insert_term(
			'Dedication', 'back-matter-type', [
				'slug' => 'dedication',
			]
		);
		wp_insert_term(
			'Epilogue', 'back-matter-type', [
				'slug' => 'epilogue',
			]
		);
		wp_insert_term(
			'Glossary', 'back-matter-type', [
				'slug' => 'glossary',
			]
		);
		wp_insert_term(
			'Index', 'back-matter-type', [
				'slug' => 'index',
			]
		);
		wp_insert_term(
			'Miscellaneous', 'back-matter-type', [
				'slug' => 'miscellaneous',
			]
		);
		wp_insert_term(
			'Notes', 'back-matter-type', [
				'slug' => 'notes',
			]
		);
		wp_insert_term(
			'Other Books by Author', 'back-matter-type', [
				'slug' => 'other-books',
			]
		);
		wp_insert_term(
			'Permissions', 'back-matter-type', [
				'slug' => 'permissions',
			]
		);
		wp_insert_term(
			'Reading Group Guide', 'back-matter-type', [
				'slug' => 'reading-group-guide',
			]
		);
		wp_insert_term(
			'Resources', 'back-matter-type', [
				'slug' => 'resources',
			]
		);
		wp_insert_term(
			'Sources', 'back-matter-type', [
				'slug' => 'sources',
			]
		);
		wp_insert_term(
			'Suggested Reading', 'back-matter-type', [
				'slug' => 'suggested-reading',
			]
		);

		// Chapter
		wp_insert_term(
			'Standard', 'chapter-type', [
				'slug' => 'standard',
			]
		);
		wp_insert_term(
			'Numberless', 'chapter-type', [
				'slug' => 'numberless',
			]
		);

		// Glossary
		wp_insert_term(
			'Miscellaneous', 'glossary-type', [
				'slug' => 'miscellaneous',
			]
		);

		foreach ( $this->licensing->getSupportedTypes( true, true ) as $key => $val ) {
			wp_insert_term(
				$val['desc'], Licensing::TAXONOMY, [
					'slug' => $key,
				]
			);
		}
	}
47713
def add(self, term, field, metadata):
        """"""
        if term not in self.metadata:
            self.metadata[term] = {field: metadata}
            return

        if field not in self.metadata[term]:
            self.metadata[term][field] = metadata
            return

        for key in metadata.keys():
            if key in self.metadata[term][field]:
                self.metadata[term][field][key].extend(metadata[key])
            else:
                self.metadata[term][field][key] = metadata[key]
451546
def insert(self, i, v):
        """"""
        self.list1.insert(i, v)
        self.list2.insert(i, v.obj)
        if isinstance(v, EpBunch):
            v.theidf = self.theidf
1373732
public void addTerm(Term term) {
        // 是否有数字
        if (!hasNum && term.termNatures().numAttr.numFreq > 0) {
            hasNum = true;
        }
        // 是否有人名
        if (!hasPerson && term.termNatures().personAttr.flag) {
            hasPerson = true;
        }
        TermUtil.insertTerm(terms, term, InsertTermType.REPLACE);

    }