From f9c711f77bba992e6e9e1d75929d35e8da828f61 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 7 Jan 2020 15:20:25 +0100 Subject: datacite: adding datacite-specific extra metadata * attributes.metadataVersion * attributes.schemaVersion * attributes.version (source dependent values, follows suggestions in https://schema.datacite.org/meta/kernel-4.3/doc/DataCite-MetadataKernel_v4.3.pdf#page=26, but values vary) Furthermore: * attributes.types.resourceTypeGeneral * attributes.types.resourceType --- python/fatcat_tools/importers/datacite.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'python/fatcat_tools/importers') diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py index d7fbd269..c2725aeb 100644 --- a/python/fatcat_tools/importers/datacite.py +++ b/python/fatcat_tools/importers/datacite.py @@ -607,6 +607,25 @@ class DataciteImporter(EntityImporter): if attributes.get('subjects'): extra_datacite['subjects'] = attributes['subjects'] + # Include version information. + metadata_version = attributes.get('metadataVersion') or '' + schema_version = attributes.get('schemaVersion') or '' + + if metadata_version: + extra_datacite['metadataVersion'] = metadata_version + if schema_version: + extra_datacite['schemaVersion'] = schema_version + + # Include resource types. + types = attributes.get('types', {}) or {} + resource_type = types.get('resourceType', '') or '' + resource_type_general = types.get('resourceTypeGeneral', '') or '' + + if resource_type: + extra_datacite['resourceType'] = resource_type + if resource_type_general: + extra_datacite['resourceTypeGeneral'] = resource_type_general + # Include certain relations from relatedIdentifiers. Keeping the # original structure of data here, which is a list of dicts, with # relation type, identifer and identifier type (mostly). @@ -625,6 +644,14 @@ class DataciteImporter(EntityImporter): extra = dict() + # "1.0.0", "v1.305.2019", "Final", "v1.0.0", "v0.3.0", "1", "0.19.0", + # "3.1", "v1.1", "{version}", "4.0", "10329", "11672", "11555", + # "v1.4.5", "2", "V1", "v3.0", "v0", "v0.6", "11124", "v1.0-beta", "1st + # Edition", "20191024", "v2.0.0", "v0.9.3", "10149", "2.0", null, + # "v0.1.1", "3.0", "1.0", "3", "v1.12.2", "20191018", "v0.3.1", "v1.0", + # "10161", "10010691", "10780", # "PresentaciĆ³n" + version = attributes.get('version') + # top-level extra keys if not container_id and container_name: extra['container_name'] = container_name @@ -666,6 +693,7 @@ class DataciteImporter(EntityImporter): refs=refs, extra=extra, license_slug=license_slug, + version=version, ) return re -- cgit v1.2.3