Skip to content

Commit

Permalink
tries fixing tests by making volume handling more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Mar 15, 2024
1 parent a856557 commit 6620000
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions ceurspt/ceurws.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,27 +1159,30 @@ def getVolumes(self, verbose: bool = False):
self.volumes_by_number[vol_number] = volume
for proc_record in proceedings_lod:
number = proc_record["sVolume"]
volume_record = self.volume_records_by_number[number]
volume = self.volumes_by_number[number]
for key, value in proc_record.items():
volume_record[f"wd.{key}"] = value
map_pairs = [
("item", "wikidataid"),
("itemDescription", "description"),
("dblpProceedingsId", "dblp"),
("described_at_URL", "url"),
("ppnId", "k10plus"),
("URN_NBN", "urn")
]
for wd_id, attr in map_pairs:
wd_key = f"wd.{wd_id}"
if wd_key in volume_record:
value = volume_record[wd_key]
if isinstance(value, str):
value = value.replace("http://www.wikidata.org/entity/", "")
value = value.replace("https://www.wikidata.org/wiki/", "")
setattr(volume, attr, value)
pass
if not number:
print(f"Warning: {proc_record} has no volume number")
else:
volume_record = self.volume_records_by_number[number]
volume = self.volumes_by_number[number]
for key, value in proc_record.items():
volume_record[f"wd.{key}"] = value
map_pairs = [
("item", "wikidataid"),
("itemDescription", "description"),
("dblpProceedingsId", "dblp"),
("described_at_URL", "url"),
("ppnId", "k10plus"),
("URN_NBN", "urn")
]
for wd_id, attr in map_pairs:
wd_key = f"wd.{wd_id}"
if wd_key in volume_record:
value = volume_record[wd_key]
if isinstance(value, str):
value = value.replace("http://www.wikidata.org/entity/", "")
value = value.replace("https://www.wikidata.org/wiki/", "")
setattr(volume, attr, value)
pass
msg = f"{len(self.volumes_by_number)} volumes"
profiler.time(msg)

Expand Down

0 comments on commit 6620000

Please sign in to comment.