From 5a02d655cb71a69b514e85918c1fc53971c3378b Mon Sep 17 00:00:00 2001 From: Abram Booth Date: Wed, 23 Aug 2023 10:56:06 -0400 Subject: [PATCH] fix: correct "academia" social link in metadata --- osf/metadata/osf_gathering.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/osf/metadata/osf_gathering.py b/osf/metadata/osf_gathering.py index d78310e3159b..2831273eb597 100644 --- a/osf/metadata/osf_gathering.py +++ b/osf/metadata/osf_gathering.py @@ -881,12 +881,22 @@ def gather_user_basics(focus): if isinstance(focus.dbmodel, osfdb.OSFUser): yield (RDF.type, FOAF.Person) # note: assumes osf user accounts represent people yield (FOAF.name, focus.dbmodel.fullname) - for social_link in focus.dbmodel.social_links.values(): - if isinstance(social_link, str): - yield (DCTERMS.identifier, social_link) - elif isinstance(social_link, list): - for link in social_link: - yield (DCTERMS.identifier, link) + _social_links = focus.dbmodel.social_links + # special cases abound! do these one-by-one (based on OSFUser.SOCIAL_FIELDS) + yield (DCTERMS.identifier, _social_links.get('github')) + yield (DCTERMS.identifier, _social_links.get('scholar')) + yield (DCTERMS.identifier, _social_links.get('linkedIn')) + yield (DCTERMS.identifier, _social_links.get('impactStory')) + yield (DCTERMS.identifier, _social_links.get('researcherId')) + yield (DCTERMS.identifier, _social_links.get('researchGate')) + yield (DCTERMS.identifier, _social_links.get('baiduScholar')) + yield (DCTERMS.identifier, _social_links.get('ssrn')) + for _url in _social_links.get('profileWebsites', ()): + yield (DCTERMS.identifier, _url) + _academia_institution = _social_links.get('academiaInstitution') + _academia_profile_id = _social_links.get('academiaProfileID') + if _academia_institution and _academia_profile_id: + yield (DCTERMS.identifier, ''.join((_academia_institution, _academia_profile_id))) orcid = focus.dbmodel.get_verified_external_id('ORCID', verified_only=True) if orcid: orcid_iri = ORCID[orcid] @@ -899,7 +909,7 @@ def gather_user_basics(focus): focustype_iris=[OSF.Registration] ) def gather_ia_url(focus): - yield (OSF.archivedAt, focus.dbmodel.ia_url) + yield (OSF.archivedAt, rdflib.URIRef(focus.dbmodel.ia_url)) @gather.er(