Skip to content

Commit

Permalink
fix: correct "academia" social link in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
aaxelb committed Aug 23, 2023
1 parent 614e172 commit 5a02d65
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions osf/metadata/osf_gathering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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(
Expand Down

0 comments on commit 5a02d65

Please sign in to comment.