edsu / pymarc

process MARC records from Python
http://python.org/pypi/pymarc
Other
252 stars 98 forks source link

Embedded fields of UNIMARC #11

Open isergey opened 13 years ago

isergey commented 13 years ago

Thank you for pymarc! But pymarc can't handle embedded fields in UNIMARC scheme. Eg:

EX 1 Embedded fields technique 200 1#$aKesteven chronicle ... 205 ##$aFosse Way ed. 430 #1$12001#$aLincolnshire chronicle$1205##$aNorth Kesteven ed.

More info: http://archive.ifla.org/VI/3/p1996-1/uni4.htm#410

isergey commented 13 years ago

Bad code, but work :)

https://gist.github.com/1051026

edsu commented 13 years ago

Sorry this has sat open for a while. Do you happen to have a record I can test with?

isergey commented 13 years ago

01527naa2a2200217#i#450# 001RU\SPSTU\analits2005\45776 00520080916154518.0 035##$aRU\SPSTU\analits2005\45775 100##$a20080916a2008####k##y0rusy01020304ba 1010#$aeng 102##$aRU 2001#$aMega-universitet : actionstrategies on the distance education market$fI. Krutiy, D. Zueva 2251#$aСовременная социальная проблематика 300##$9547$aБюллетень "Высшая школа" №3 за 2008г. 461##$1 001RU\SPSTU\ser\146298$1 011##$a1561-2465$1 1010#$arus$1 102##$aRU$1 2001#$aСоциология образования$eДайджест российской и зарубежной прессы $fСовременная гуманитарная академия$1 210##$aМ.$d2001-$cИзд-во СГУ$1 311##$aДо №12 2005 г. в надзаг.: Современный гуманитарный университет$1 6101#$aсоциология$aобразование$aпреподаватели$aстуденты$1 686##$2rubbk$a74.04(2)$1 686##$2rubbk$a74.584(2)$1 686##$2rubbk$a60.550.55я5$1 71200$aСовременная гуманитарная академия 463##$1 001RU\SPSTU\ser\234338$1 1010#$arus$1 102##$aRU$1 2000#$a№4$vС.72-98$1 210##$d2008 6101#$aсоциальные процессы$aпроблемы образования$aмега-вузы 700#1$aKrutiy$bI. 701#1$aZueva$bD. 801#1$aRU$b19013582$c20080916$gPSBO 998##$aMe:0ac000000Krut

Field 463 have subfield $1 with inner fields 001, 101, 200 etc (inner record). Lang of record - russian, encoding UTF-8. Record file https://github.com/isergey/marc/raw/master/record.mrc

edsu commented 12 years ago

Thanks for the record. pymarc seems to be able to read it. For example this works:

record = pymarc.reader.MARCReader(file("record.mrc")).next()

What specifically isn't working for you?

isergey commented 12 years ago

Yes, it's work, but now inner fields handling as plain text. In my patch, inner fields converts to Field instances. it is more easy for working with record , as it seems to me.

edsu commented 12 years ago

I'm still confused about what is broken. Can you supply a unit test?

anarchivist commented 12 years ago

I think I understand. UNIMARC allows for fields to be embedded in certain linking entry fields (4XXs), as expressed in the "1" subfields in some of the records above.

@isergey - @edsu is right; we would need a unit test for the code to make sure it's working and further changes don't break the rest of the module.