From 937a0b9faeb1473b138a7ed4c36b69116eba6028 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Fri, 29 Mar 2019 14:29:04 +0100 Subject: [PATCH 1/5] update citation metadata --- .zenodo.json | 5 +++-- codemeta.json | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 30f4692..30ccd01 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -7,11 +7,12 @@ "orcid": "0000-0003-1898-2543" }], "contributors": [{ - "name": "Uwe Kretschmer", + "name": "Kretschmer, Uwe", + "orcid": "0000-0002-3685-6519", "type": "Other" }, { - "name": "Jana Dolan", + "name": "Dolan, Jana", "type": "Other" } ], diff --git a/codemeta.json b/codemeta.json index a0d7cc6..14fe2b6 100644 --- a/codemeta.json +++ b/codemeta.json @@ -19,15 +19,18 @@ "email": "rettinghaus@bach-leipzig.de" }], "contributor": [{ + "@id": "https://orcid.org/0000-0002-3685-6519", "@type": "Person", "givenName": "Uwe", "familyName": "Kretschmer", + "name": "Kretschmer, Uwe", "email": "kretschmer@saw-leipzig.de" }, { "@type": "Person", "givenName": "Jana", - "familyName": "Dolan" + "familyName": "Dolan", + "name": "Dolan, Jana" } ] } From a68254a98ff6eb86428d79b075a95746e73d44d8 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Fri, 29 Mar 2019 16:19:19 +0100 Subject: [PATCH 2/5] moving back to persName as default --- csv2cmi.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/csv2cmi.py b/csv2cmi.py index fb18c51..39ed477 100755 --- a/csv2cmi.py +++ b/csv2cmi.py @@ -159,9 +159,7 @@ def createFileDesc(config): def createCorrespondent(nameString): if letter[nameString]: - defaultElement = 'name' correspondents = [] - personIDs = [] # Turning the cells of correspondent names and their IDs into lists since cells # can contain various correspondents split by an extra delimiter. # In that case it is essential to be able to call each by their index. @@ -170,15 +168,15 @@ def createCorrespondent(nameString): try: personIDs = letter[nameString + "ID"].split(subdlm) except KeyError: - defaultElement = 'persName' + personIDs = [] else: persons = [letter[nameString]] try: personIDs = [letter[nameString + "ID"]] except KeyError: - defaultElement = 'persName' + personIDs = [] for index, person in enumerate(persons): - correspondent = Element(defaultElement) + correspondent = Element('persName') person = str(person).strip() # assigning authority file IDs to their correspondents if provided if (index < len(personIDs)) and personIDs[index]: @@ -190,9 +188,7 @@ def createCorrespondent(nameString): str(personIDs[index].strip()) else: authID = str(personIDs[index].strip()) - if profileDesc.findall('correspDesc/correspAction/persName[@ref="' + authID + '"]'): - correspondent = Element('persName') - elif profileDesc.findall('correspDesc/correspAction/orgName[@ref="' + authID + '"]'): + if profileDesc.findall('correspDesc/correspAction/orgName[@ref="' + authID + '"]'): correspondent = Element('orgName') elif connection: if 'viaf' in authID: From 13c9b555ecf4f1dff6e19dd555438c96adb7b475 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Fri, 29 Mar 2019 16:22:33 +0100 Subject: [PATCH 3/5] update GND element set --- csv2cmi.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/csv2cmi.py b/csv2cmi.py index 39ed477..f48611a 100755 --- a/csv2cmi.py +++ b/csv2cmi.py @@ -221,7 +221,9 @@ def createCorrespondent(nameString): except UnicodeEncodeError: print(authID) else: - elementset = ('DifferentiatedPerson', + corporatelike = ( + 'Corporate', 'Company', 'ReligiousAdministrativeUnit') + personlike = ('DifferentiatedPerson', 'Royal', 'Family', 'Legendary') gndrdf_root = gndrdf.getroot() latestID = gndrdf_root[0].get( @@ -231,12 +233,12 @@ def createCorrespondent(nameString): '%s returns new ID %s', authID, latestID) rdftype = gndrdf_root.find( './/rdf:type', ns).get('{http://www.w3.org/1999/02/22-rdf-syntax-ns#}resource') - if 'Corporate' in rdftype: + if any(entity in rdftype for entity in corporatelike): correspondent = Element('orgName') - elif any(entity in rdftype for entity in elementset): + elif any(entity in rdftype for entity in personlike): correspondent = Element('persName') else: - correspondent = Element('name') + authID = '' if 'UndifferentiatedPerson' in rdftype: logging.warning( '%sID in line %s links to undifferentiated Person', nameString, table.line_num) @@ -264,7 +266,7 @@ def createCorrespondent(nameString): else: logging.error( 'No proper authority record in line %s for %s', table.line_num, nameString) - if authID and correspondent.tag != "name": + if authID: correspondent.set('ref', authID) else: logging.debug('ID for "%s" missing in line %s', From d222d52d7317b7f408add7f7abbc72161a4651c9 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Fri, 29 Mar 2019 16:34:13 +0100 Subject: [PATCH 4/5] do not check person ID twice --- csv2cmi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/csv2cmi.py b/csv2cmi.py index f48611a..ed291ff 100755 --- a/csv2cmi.py +++ b/csv2cmi.py @@ -188,7 +188,9 @@ def createCorrespondent(nameString): str(personIDs[index].strip()) else: authID = str(personIDs[index].strip()) - if profileDesc.findall('correspDesc/correspAction/orgName[@ref="' + authID + '"]'): + if profileDesc.findall('correspDesc/correspAction/persName[@ref="' + authID + '"]'): + correspondent = Element('persName') + elif profileDesc.findall('correspDesc/correspAction/orgName[@ref="' + authID + '"]'): correspondent = Element('orgName') elif connection: if 'viaf' in authID: From ef71c151d60f9fedd6ba7fac06aba82bd1d47a62 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Fri, 29 Mar 2019 17:02:11 +0100 Subject: [PATCH 5/5] update version --- .zenodo.json | 2 +- codemeta.json | 4 ++-- csv2cmi.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 30ccd01..c662569 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,7 +1,7 @@ { "title": "CSV2CMI", "description": "converts a table of letters into CMI format", - "publication_date": "2019-03-20", + "publication_date": "2019-03-29", "creators": [{ "name": "Rettinghaus, Klaus", "orcid": "0000-0003-1898-2543" diff --git a/codemeta.json b/codemeta.json index 14fe2b6..ba36f7c 100644 --- a/codemeta.json +++ b/codemeta.json @@ -4,11 +4,11 @@ "identifier": "CSV2CMI", "name": "CSV2CMI", "description": "converts a table of letters into CMI format", - "softwareVersion": "2.0.0", + "softwareVersion": "2.0.1", "license": "OSI Approved :: MIT License", "programmingLanguage": "Python :: 3", "maintainer": "https://orcid.org/0000-0003-1898-2543", - "datePublished": "2019-03-20", + "datePublished": "2019-03-29", "codeRepository": "https://github.com/saw-leipzig/csv2cmi", "author": [{ "@id": "https://orcid.org/0000-0003-1898-2543", diff --git a/csv2cmi.py b/csv2cmi.py index ed291ff..5c7d6d9 100755 --- a/csv2cmi.py +++ b/csv2cmi.py @@ -18,7 +18,7 @@ from xml.etree.ElementTree import Element, SubElement, Comment, ElementTree __license__ = "MIT" -__version__ = '2.0.0' +__version__ = '2.0.1' # define log output logging.basicConfig(format='%(levelname)s: %(message)s')