Add doi.

        :param doi: doi for the current document.
        :type doi: string

        :param source: source for the doi.
        :type source: string

        :param material: material for the doi.
        :type material: string
329283
def add_doi(self, doi, source=None, material=None):
        
        if doi is None:
            return

        try:
            doi = idutils.normalize_doi(doi)
        except AttributeError:
            return

        if not doi:
            return

        dois = self._sourced_dict(
            source,
            value=doi
        )
        if material is not None:
            dois['material'] = material

        self._append_to('dois', dois)
533810
def add_document(docid, fields, options={})
            options.merge!( :docid => docid, :fields => fields )
            code, r = PUT "/docs", options
            return r
        end
1214968
def insert(self, document):
        

        doc_id = self._get_doc_id(document)
        data = self._read()
        data[doc_id] = dict(document)
        self._write(data)

        return doc_id
458118
def _add_uid(self, uid, skip_handle=False):
        
        # We might add None values from wherever. Kill them here.
        uid = uid or ''
        if is_arxiv(uid):
            self._ensure_reference_field('arxiv_eprint', normalize_arxiv(uid))
        elif idutils.is_doi(uid):
            self._ensure_reference_field('dois', [])
            self.obj['reference']['dois'].append(idutils.normalize_doi(uid))
        elif idutils.is_handle(uid) and not skip_handle:
            self._ensure_reference_field('persistent_identifiers', [])
            self.obj['reference']['persistent_identifiers'].append({
                'schema': 'HDL',
                'value': idutils.normalize_handle(uid),
            })
        elif idutils.is_urn(uid):
            self._ensure_reference_field('persistent_identifiers', [])
            self.obj['reference']['persistent_identifiers'].append({
                'schema': 'URN',
                'value': uid,
            })
        elif self.RE_VALID_CNUM.match(uid):
            self._ensure_reference_field('publication_info', {})
            self.obj['reference']['publication_info']['cnum'] = uid
        elif is_cds_url(uid):
            self._ensure_reference_field('external_system_identifiers', [])
            self.obj['reference']['external_system_identifiers'].append({
                'schema': 'CDS',
                'value': extract_cds_id(uid),
            })
        elif is_ads_url(uid):
            self._ensure_reference_field('external_system_identifiers', [])
            self.obj['reference']['external_system_identifiers'].append({
                'schema': 'ADS',
                'value': extract_ads_id(uid),
            })
        else:
            # ``idutils.is_isbn`` is too strict in what it accepts.
            try:
                isbn = str(ISBN(uid))
                self._ensure_reference_field('isbn', {})
                self.obj['reference']['isbn'] = isbn
            except Exception:
                raise ValueError('Unrecognized uid type')
470598
def add(self, p_src):
        
        todos = self.add_list([p_src])

        return todos[0] if len(todos) else None
1232914
def add_content(self, more_content):
        """"""
        sourcename = self.get_sourcename()

        if self.object.docs:
            self.add_line('', sourcename)
            for line in self.object.docs.splitlines():
                self.add_line(line, sourcename)

        # add additional content (e.g. from document), if present
        if more_content:
            self.add_line('', sourcename)
            for line, src in zip(more_content.data, more_content.items):
                self.add_line(line, src[0], src[1])
1363406
def add_source(self, source):
        
        if not type(source)==Source:
            raise TypeError('Can only add Source object.')

        if len(self.sources)==0:
            self.sources.append(source)
        else:
            ind = 0
            for s in self.sources:
                # Keep sorted order of separation
                if source.separation < s.separation:
                    break
                ind += 1

            self.sources.insert(ind, source)
931417
def add(self, dic):
        '''
        '''
        for kw in dic:
            checkKey(kw, self.keyWord)
            self._add([Pair(kw, StringSingle(dic[kw]))], self.d)
42566
def dois(self, key, value):
    
    def _get_first_non_curator_source(sources):
        sources_without_curator = [el for el in sources if el.upper() != 'CURATOR']
        return force_single_element(sources_without_curator)

    def _get_material(value):
        MATERIAL_MAP = {
            'ebook': 'publication',
        }

        q_value = force_single_element(value.get('q', ''))
        normalized_q_value = q_value.lower()

        return MATERIAL_MAP.get(normalized_q_value, normalized_q_value)

    def _is_doi(id_, type_):
        return (not type_ or type_.upper() == 'DOI') and is_doi(id_)

    def _is_handle(id_, type_):
        return (not type_ or type_.upper() == 'HDL') and is_handle(id_)

    dois = self.get('dois', [])
    persistent_identifiers = self.get('persistent_identifiers', [])

    values = force_list(value)
    for value in values:
        id_ = force_single_element(value.get('a', ''))
        material = _get_material(value)
        schema = force_single_element(value.get('2', ''))

        sources = force_list(value.get('9'))
        source = _get_first_non_curator_source(sources)

        if _is_doi(id_, schema):
            dois.append({
                'material': material,
                'source': source,
                'value': normalize_doi(id_),
            })
        else:
            schema = 'HDL' if _is_handle(id_, schema) else schema
            persistent_identifiers.append({
                'material': material,
                'schema': schema,
                'source': source,
                'value': id_,
            })

    self['persistent_identifiers'] = persistent_identifiers
    return dois
95366
def _add_token_to_document(self, token_string, token_attrs=None):
        """"""
        token_feat = {self.ns+':token': token_string}
        if token_attrs:
            token_attrs.update(token_feat)
        else:
            token_attrs = token_feat
        token_id = 'token_{}'.format(self.token_count)
        self.add_node(token_id, layers={self.ns, self.ns+':token'},
                      attr_dict=token_attrs)
        self.token_count += 1
        self.tokens.append(token_id)
        return token_id
1174907
def __get_doi(pub):
        
        doi = ""
        # Doi location: d["pub"][idx]["identifier"][0]["id"]
        try:
            doi = pub["DOI"][0]["id"]
            doi = clean_doi(doi)
        except KeyError:
            logger_lpd_noaa.info("get_dois: KeyError: missing a doi key")
        except Exception:
            logger_lpd_noaa.info("get_dois: Exception: something went wrong")

        # if we received a doi that's a list, we want to concat into a single string
        if isinstance(doi, list):
            if len(doi) == 1:
                doi = doi[0]
            else:
                ", ".join(doi)
        return doi
192050
def add_source(self, source):
        
        if source is not None:
            self.sources.add(source)
            source.callback = self._receive
            if hasattr(source, 'start'):
                source.start()
950524
def add_file(self, path):
        """"""
        libdoc = LibraryDocumentation(path)
        if len(libdoc.keywords) > 0:
            if libdoc.doc.startswith("Documentation for resource file"):
                # bah! The file doesn't have an file-level documentation
                # and libdoc substitutes some placeholder text.
                libdoc.doc = ""

            collection_id = self.add_collection(path, libdoc.name, libdoc.type,
                                                libdoc.doc, libdoc.version,
                                                libdoc.scope, libdoc.named_args,
                                                libdoc.doc_format)
            self._load_keywords(collection_id, libdoc=libdoc)
780943
public void addContentFile(String source, String resourceId) {

        if ((source != null) && (resourceId != null)) {
            try {
                m_helper.getFileBytes(source);
                m_contentFiles.add(new CmsUUID(resourceId));
            } catch (CmsImportExportException e) {
                LOG.info("File not found in import: " + source);
            }
        }
    }
986881
private void fillDetailIndexSource(CmsListItem item, String detailId) {

        StringBuffer html = new StringBuffer();
        // search for the corresponding A_CmsSearchIndex:
        I_CmsSearchIndex idx = OpenCms.getSearchManager().getIndex((String)item.get(LIST_COLUMN_NAME));

        html.append("<ul>\n");
        // get the index sources (nice API)
        for (CmsSearchIndexSource idxSource : idx.getSources()) {
            html.append("  <li>\n").append("    ").append("name      : ").append(idxSource.getName()).append("\n");
            html.append("  </li>");

            html.append("  <li>\n").append("    ").append("indexer   : ").append(
                idxSource.getIndexerClassName()).append("\n");
            html.append("  </li>");

            html.append("  <li>\n").append("    ").append("resources : ").append("\n");
            html.append("    <ul>\n");
            List<String> resources = idxSource.getResourcesNames();
            Iterator<String> itResources = resources.iterator();
            while (itResources.hasNext()) {
                html.append("    <li>\n").append("      ").append(itResources.next()).append("\n");
                html.append("    </li>\n");
            }
            html.append("    </ul>\n");
            html.append("  </li>");

            html.append("  <li>\n").append("    ").append("doctypes : ").append("\n");
            html.append("    <ul>\n");
            resources = idxSource.getDocumentTypes();
            itResources = resources.iterator();
            while (itResources.hasNext()) {
                html.append("    <li>\n").append("      ").append(itResources.next()).append("\n");
                html.append("    </li>\n");
            }
            html.append("    </ul>\n");
            html.append("  </li>");
        }

        html.append("</ul>\n");
        item.set(detailId, html.toString());
    }
1138291
def add_source(self, url, **kwargs):
        
        self['sources'].append(dict(url=url, **kwargs))
1189207
def add_material(self, material):
        """"""
        if self.has_material(material):
            return

        self.materials.append(material)