Skip to content
Snippets Groups Projects
Commit 87461179 authored by philip.roeggla's avatar philip.roeggla
Browse files

werke in relation

parent c6b75a02
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ from travelogues_extraction.getrecords.acnumber_extractor import extract_ac_from
from travelogues_extraction.dataextractors.dataextractors.combinedsubfields import VerfasserGND, ReihentitelBandzählung, \
HaupttitelTitelzusatzVerantwortlichkeitsangabe, BandzählungTitelDesBandes, VerlagsOrtNormiertGND, DruckOrtNormiertGND, \
VerlegerNormiertGNDID, DruckerGNDID, WeitereVerfasserGNDID, HerausgeberGNDID, ÜbersetzerGNDID, BeiträgerGNDID, \
WeitereBeteiligteGNDID, IllustratorenGNDID, WidmenderGNDID, WidmungsempfängerGNDID
WeitereBeteiligteGNDID, IllustratorenGNDID, WidmenderGNDID, WidmungsempfängerGNDID, WerkeInRelation
from travelogues_extraction.dataextractors.dataextractors.index import IndexSetter
......@@ -46,6 +46,7 @@ async def test_multiple_classes():
illustratorenGNDID = IllustratorenGNDID(target_dataframe)
widmenderGNDID = WidmenderGNDID(target_dataframe)
widmungsempfängerGNDID = WidmungsempfängerGNDID(target_dataframe)
werkeInRelation = WerkeInRelation(target_dataframe)
index = 0
stop = 7
......@@ -87,6 +88,7 @@ async def test_multiple_classes():
await illustratorenGNDID.write(record)
await widmenderGNDID.write(record)
await widmungsempfängerGNDID.write(record)
await werkeInRelation.write(record)
assert target_dataframe.shape[0] == index + 1
if record.ac_number == 'AC09682453':
......@@ -248,6 +250,13 @@ async def test_multiple_classes():
assert widmungsempfängerGNDID_list[0][0][0].isalpha()
assert widmungsempfängerGNDID_list[0][1].startswith('http://d-nb.info/gnd/')
if record.ac_number in ('AC09836279', 'AC07705435'):
werkeInRelation_val: typing.Union[str, float] = target_dataframe.at[record.ac_number, werkeInRelation.column]
if record.ac_number == 'AC09836279':
assert werkeInRelation_val.__repr__() == 'nan'
else:
assert werkeInRelation_val[0].isalpha()
index += 1
if index == stop:
......
......@@ -37,7 +37,7 @@ class FromAlmaOutputToExcel:
VerlegerNormiertGNDID, DruckerGNDID, Erscheinungsjahr, ErscheinungsjahrSortierform, Kollation, Illustrationen,
Format, Anmerkungen, Sprache, OriginalSprache, BemerkungenZurSprache, Standardnummer, WeitereVerfasserGNDID,
HerausgeberGNDID, ÜbersetzerGNDID, BeiträgerGNDID, WeitereBeteiligteGNDID, IllustratorenGNDID, WidmenderGNDID,
WidmungsempfängerGNDID, ArtDesInhalts, Inhalt
WidmungsempfängerGNDID, ArtDesInhalts, Inhalt, WerkeInRelation
]
def __init__(self, alma_output: str, target_output: str, slice: slice):
......
......@@ -187,3 +187,13 @@ class WidmungsempfängerGNDID(AbstractMultifield):
'marc:subfield[@code="4" and text()="dte"]'
']'
), namespaces=namespaces)
class WerkeInRelation(AbstractMultifield):
column = 'Werke in Relation'
primary_xml_path = lxmletree.XPath('./marc:datafield[(@tag="700" and @ind1="1" and @ind2="2") or (@tag="787" and @ind1="0" and @ind2="8")]', namespaces=namespaces)
xpath_isgnd_tuples = (
VerlagsOrtNormiertGND.xpath_isgnd_tuples[0],
AbstractMultifield.XpathIsGnd(xpath=lxmletree.XPath('./marc:subfield[@code="t"]', namespaces=namespaces), isgnd=False),
VerlagsOrtNormiertGND.xpath_isgnd_tuples[1],
)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment