* modification of tables/row names : *_tag_* replaced by *_subfield_* where needed
[koha.git] / marc / perlmarcstructure
1
2 A proposed perl data structure for storing marc info
3
4
5 $record is a hash reference
6
7 $record->{leader}=
8 $record->{bibid}=58973
9 $record->{tags}=$tags
10
11 $tags is a hash reference
12
13 $tags->{1}=$tag
14 $tags->{2}=$tag
15 $tags->{3}=$tag
16
17 $tag->{tag}=110
18 $tag->{indicator}='04'
19 $tag->{tagid}=573498
20 $tag->{subfields}=$subfields
21
22
23 $subfields->{1}=$subfield
24 $subfields->{2}=$subfield
25 $subfields->{3}=$subfield
26
27 $subfield is a hash reference
28
29 $subfield->{mark}='a'
30 $subfield->{value}='MacDonald, John A.'
31
32 This takes care of possible repeating tags and subfields as well as ordering of
33 tags and subfields, but it makes it difficult to look up specific tags and
34 subfields without looping through every time.  It might be an idea to add an
35 index to the structure to aid these lookups.
36
37 $record->{index}->{110}->{tags}=\(3,4)   <-- array ref shows that tags 3 and 4
38                                              are 110 tags
39
40 Need a similar index for subfields.... I'm not sure if this is any simpler than
41 just looping through the tags every time.  :)
42
43 I think looping is the way to go...
44
45 This still needs more work.  This will also require an API for accessing or
46 modifying this structure, as it is non-trivial to parse the data.  I'm also
47 starting to wonder how difficult it is going to be to develop templates using
48 this kind of structure.  HTML::Template has no facility for parsing this kind
49 of data structure.  We might need an alternate (or completely different) data
50 structure that is parseable by HTML::Template.