Ejemplo n.º 1
0
def get_legacy_url_for_recid(recid):
    """Get a URL to a record on INSPIRE.

    Args:
        recid (Union[int, string]): record ID
        pattern_config_var (string): config var with the pattern

    Return:
        text_type: URL
    """
    pattern = current_app.config['LEGACY_RECORD_URL_PATTERN']
    return record_url_by_pattern(pattern, recid)
Ejemplo n.º 2
0
def get_legacy_url_for_recid(recid):
    """Get a URL to a record on INSPIRE.

    Args:
        recid (Union[int, string]): record ID
        pattern_config_var (string): config var with the pattern

    Return:
        text_type: URL
    """
    pattern = current_app.config['LEGACY_RECORD_URL_PATTERN']
    return record_url_by_pattern(pattern, recid)
Ejemplo n.º 3
0
    def get_xml(self, do_add_bibtex_citation=False):
        """Create an ORCID XML representation of the record.

        Args:
            do_add_bibtex_citation (bool): True to add BibTeX-serialized record

        Returns:
            lxml.etree._Element: ORCID XML work record
        """
        builder = OrcidBuilder()

        # Set attributes
        if self.visibility:
            builder.set_visibility(self.visibility)

        if self.put_code:
            builder.set_put_code(self.put_code)

        # Add a title
        if self.title:
            builder.add_title(self.title, self.subtitle,
                              self.title_translation)

        # Add a journal title
        containing_publication_title = self.journal_title or self.conference_title or self.book_series_title
        if containing_publication_title:
            builder.add_journal_title(containing_publication_title)

        # Add a citation
        if do_add_bibtex_citation:
            builder.add_citation('bibtex', self.bibtex_citation)

        # Add a type
        builder.add_type(self.orcid_work_type)

        # Add a publication date
        if self.publication_date:
            builder.add_publication_date(self.publication_date)

        # Add external IDs
        if self.doi:
            builder.add_doi(self.doi, 'self')

        if self.arxiv_eprint:
            builder.add_arxiv(self.arxiv_eprint, 'self')

        for isbn in get_value(self.record, 'isbns.value', []):
            builder.add_external_id('isbn', isbn)

        # Add URL pointing to INSPIRE to ORCID
        builder.add_url(record_url_by_pattern(self.url_pattern, self.recid))

        # Add authors/editors/etc. to the ORCID record
        for author in self.record.get('authors', []):
            orcid_role = self.orcid_role_for_inspire_author(author)
            if not orcid_role:
                continue
            person_orcid = self.orcid_for_inspire_author(author)
            email = get_value(author, 'emails[0]')
            builder.add_contributor(author['full_name'], orcid_role,
                                    person_orcid, email)

        # Add a country (only available for conferences)
        if self.conference_country:
            builder.add_country(self.conference_country)

        return builder.get_xml()
Ejemplo n.º 4
0
    def get_xml(self, do_add_bibtex_citation=False):
        """Create an ORCID XML representation of the record.

        Args:
            do_add_bibtex_citation (bool): True to add BibTeX-serialized record

        Returns:
            lxml.etree._Element: ORCID XML work record
        """
        builder = OrcidBuilder()

        # Set attributes
        if self.visibility:
            builder.set_visibility(self.visibility)

        if self.put_code:
            builder.set_put_code(self.put_code)

        # Add a title
        if self.title:
            builder.add_title(self.title, self.subtitle, self.title_translation)

        # Add a journal title
        containing_publication_title = self.journal_title or self.conference_title or self.book_series_title
        if containing_publication_title:
            builder.add_journal_title(containing_publication_title)

        # Add a citation
        if do_add_bibtex_citation:
            builder.add_citation('bibtex', self.bibtex_citation)

        # Add a type
        builder.add_type(self.orcid_work_type)

        # Add a publication date
        if self.publication_date:
            builder.add_publication_date(self.publication_date)

        # Add recid.
        record_url = record_url_by_pattern(self.url_pattern, self.recid)
        if self.recid:
            builder.add_recid(self.recid, record_url, 'self')
            self._external_identifiers.append(ExternalIdentifier('other-id', str(self.recid)))

        # Add external IDs
        if self.doi:
            builder.add_doi(self.doi, 'self')
            self._external_identifiers.append(ExternalIdentifier('doi', self.doi))

        if self.arxiv_eprint:
            builder.add_arxiv(self.arxiv_eprint, 'self')
            self._external_identifiers.append(ExternalIdentifier('arxiv', self.arxiv_eprint))

        for isbn in get_value(self.record, 'isbns.value', []):
            builder.add_external_id('isbn', isbn)
            self._external_identifiers.append(ExternalIdentifier('isbn', isbn))

        # Add URL pointing to INSPIRE to ORCID
        builder.add_url(record_url)

        # Add authors/editors/etc. to the ORCID record
        for author in self.record.get('authors', []):
            orcid_role = self.orcid_role_for_inspire_author(author)
            if not orcid_role:
                continue
            person_orcid = self.orcid_for_inspire_author(author)
            email = get_value(author, 'emails[0]')
            builder.add_contributor(author['full_name'], orcid_role, person_orcid, email)

        # Add a country (only available for conferences)
        if self.conference_country:
            builder.add_country(self.conference_country)

        return builder.get_xml()