예제 #1
0
    def get_issue(self, obj):
        """Get issue number."""
        issue = None
        itemdatas = _get_itemdata(obj['metadata'], "Issue Number")
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_ISSUENO)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, issue = _get_mapping_data(schema, itemdata, "Issue Number")

        if issue:
            return issue
        return missing
예제 #2
0
    def get_version(self, obj):
        """Get version."""
        version = None
        itemdatas = _get_itemdata(obj['metadata'], 'Version')
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_VERSION)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, version = _get_mapping_data(schema, itemdata, "Version")

        if version:
            return version
        return missing
예제 #3
0
    def get_volume(self, obj):
        """Get volume."""
        volume = None
        itemdatas = _get_itemdata(obj['metadata'], "Volume Number")
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_VOLUME)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, volume = _get_mapping_data(schema, itemdata, "Volume Number")

        if volume:
            return volume
        return missing
예제 #4
0
    def get_language(self, obj):
        """Get language."""
        language = []
        itemdatas = _get_itemdata(obj['metadata'], 'Language')
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_LANGUAG)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, language = _get_mapping_data(schema, itemdata, "Language")

        if language:
            return language
        return missing
예제 #5
0
    def get_description(self, obj):
        """Get description."""
        description = None
        itemdatas = _get_itemdata(obj['metadata'], 'Description')
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_DESCRIP)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, description = _get_mapping_data(schema, itemdata, "Description")

        if description:
            return description
        return missing
예제 #6
0
    def get_publishers(self, obj):
        """Get publisher."""
        publisher = []
        itemdatas = _get_itemdata(obj['metadata'], "Publisher")
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_PUBLISH)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, data = _get_mapping_data(schema, itemdata, "Publisher")
            publisher.append(data)

        if len(publisher):
            return publisher[0]
        return missing
예제 #7
0
    def get_pages(self, obj):
        """Get number of pages."""
        num_of_pages = None
        itemdatas = _get_itemdata(obj['metadata'], 'Number of Pages')
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_PAGES)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, num_of_pages = _get_mapping_data(schema, itemdata,
                                                "Number of Pages")

        if num_of_pages:
            return num_of_pages
        return missing
예제 #8
0
    def get_container_title(self, obj):
        """Get alternative title."""
        alternative_title = []
        itemdatas = _get_itemdata(obj['metadata'], 'Alternative Title')
        schema = get_attribute_schema(69)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, data = _get_mapping_data(schema, itemdata, "Alternative Title")
            alternative_title.append(config.WEKO_ITEMPROPS_SCHEMAID_ALTITLE)

        if len(alternative_title):
            return alternative_title[0]
        return missing
예제 #9
0
def _get_creator_name(obj, name_type):
    """Parsing creator data for multiple item type."""
    name = None
    try:
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_CREATOR)
        value, name_data = _get_mapping_data(schema, obj, name_type)

        if name_data:
            _, name = _get_mapping_data(value.get('items'), name_data[0],
                                        name_type)
    except BaseException:
        current_app.logger.debug(traceback.format_exc())

    if name:
        return name
    return None
예제 #10
0
    def get_doi(self, obj):
        """Get DOI."""
        doi = None
        doi_type = None
        itemdatas = _get_itemdata(obj['metadata'], 'Identifier Registration')
        schema = get_attribute_schema(config.WEKO_ITEMPROPS_SCHEMAID_DOI)
        if itemdatas is None:
            return missing

        for itemdata in itemdatas:
            _, doi = _get_mapping_data(
                schema, itemdata, "Identifier Registration")
            _, doi_type = _get_mapping_data(
                schema, itemdata, "Identifier Registration Type")

        if doi:
            return '{} ({})'.format(doi, doi_type)
        return missing