forked from ld4l-labs/marc2rdf-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperson-algorithm-notes.txt
260 lines (225 loc) · 11 KB
/
person-algorithm-notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
Algorithm to Generate BibFrame *Persons* from MaRC
reversed engineered from LoC xquery implementation of Marc -> BibFrame
https://github.com/lcnetdev/marc2bibframe
bf:Person are created for bib records by:
modules/module.MBIB-2-BIBFRAME-Shared.xqy
a bf:Person is created when the Bib record has:
case 1A:
100
case 1Ba:
700 without |t
case 1Bb:
720 without |t and ind1=1
case 1C:
100 when first 130|240 has |l
case 1D: related work
case 1Da:
100 when there is 740 with ind2=2 and subfld a
case 1Db:
700 with |a and |t and ind2 = ( |0|1|2)
800 with |a and |t
case 2:
600 with no |t
================================================================================
Naomi's notes below this line
Looking for code that outputs bf:Person
in modules/module.MBIB-2-BIBFRAME-Shared.xqy
# case 1A, 1B, 1C, 1D
#
# get-name outputs person when:
# field tag ends in 00
# 720 with ind1=1
#
# case 1A:
# function mbshared:generate-work calls mbshared:get-name for
# 100|110|111
# case 1B:
# function mbshared:generate-work calls mbshared:get-name for
# 700|710|711|720 without |t
#
# case 1C:
# function mbshared:generate-work calls mbshared:get-uniformTitle when
# first 130|240
#
# function mbshared:get-uniformTitle calls mbshared:generate-translationOf when
# (130|240) has subfield l
#
# function mbshared:generate-translationOf calls mbshared:get-name for
# first of 100|110|111
#
# case 1D:
# function mbshared:generate-work calls mbshared:related-works
# 2751: let $work-relateds := mbshared:related-works($marcxml,$workID,"work")
# function mbshared:related-works calls mbshared:generate-related-work for
# 400|410|411|430|440|534|774|775|800|810|811|830 with |t
# 490 with |a
# 700|710|711 with |t and ind2 = ( |0|1|2)
# 730 with ind2 = ( |0|1|2)
# 740 with ind2 = ( | 2)
# 780 with ind2 = (0-7)
# 785 with ind2 = (0-8)
# 787 with |t
# 760|762|765|767|770|772|773|774
#
# function mbshared:generate-related-work calls mbshared:get-name
# for (first) 100|110|111 when there is 740 with ind2=2 and subfld a
# field NOT (400|410|411|440|490|800|810|811|630|730|740|830) and has sub a
#
function mbshared:get-name
3283: else if ( fn:ends-with(fn:string($d/@tag), "00") ) then
3284: "bf:Person"
...
3291: else if ( fn:string($d/@tag)= "720" and fn:string($d/@ind1)="1") then
3292: "bf:Person" (:????:)
Called by (case 1A, 1B):
# get-name called when
# 100|110|111 (case 1A)
# 700|710|711|720 and no |t (case 1B)
function mbshared:generate-work
2612: let $names :=
2613: ( for $d in $marcxml/marcxml:datafield[fn:matches(@tag,"(100|110|111)")]
2614: return mbshared:get-name($d),
...
2617: for $d in $marcxml/marcxml:datafield[fn:matches(@tag,"(700|710|711|720)")][fn:not(marcxml:subfield[@code="t"])]
2618: return mbshared:get-name($d)
2619: )
Called by (case 1C):
# get-name called when
function mbshared:generate-translationOf
3677: let $namenode:= mbshared:get-name($d/ancestor::marcxml:record/marcxml:datafield[fn:matches(@tag, "(100|110|111)")][1])
Called by:
function mbshared:get-uniformTitle
3857: let $translationOf :=
3858: if ($d/marcxml:subfield[@code="l"]) then
3859: (for $s in $d/marcxml:subfield[@code="l"]
3860: return marc2bfutils:process-language($s),
...
3870: mbshared:generate-880-label($d,"title"),
3871: mbshared:generate-translationOf($d)
3872: )
Called by:
function mbshared:generate-work
2609: let $uniformTitle := (:work title can be from 245 if no 240/130:)
2610: for $d in ($marcxml/marcxml:datafield[@tag eq "130"]|$marcxml/marcxml:datafield[@tag eq "240"])[1]
2611: return mbshared:get-uniformTitle($d)
Called by (case 1D):
# get-name called
# for (first) 100|110|111 when there is 740 with ind2=2 and subfld a
# field NOT (400|410|411|440|490|800|810|811|630|730|740|830) and has sub a
function mbshared:generate-related-work
2338: let $name :=
2339: if (
2340: $d/marcxml:subfield[@code="a"] and
2341: $d/@tag="740" and
2342: $d/@ind2="2" and
2343: $d/ancestor::marcxml:record/marcxml:datafield[fn:matches(@tag, "(100|110|111)")][1]
2344: ) then
2345: mbshared:get-name($d/ancestor::marcxml:record/marcxml:datafield[fn:matches(@tag, "(100|110|111)")][1])
2346: else if ( $d/marcxml:subfield[@code="a"] and fn:not(fn:matches($d/@tag,"(400|410|411|440|490|800|810|811|630|730|740|830)")) ) then
2347: mbshared:get-name($d)
2348: else ()
Called by:
# generate-related-work called for all (third param NOT 'instance')
# 400|410|411|430|440|534|774|775|800|810|811|830 with |t
# 490 with |a
# 700|710|711 with |t and ind2 = ( |0|1|2)
# 730 with ind2 = ( |0|1|2)
# 740 with ind2 = ( | 2)
# 780 with ind2 = (0-7)
# 785 with ind2 = (0-8)
# 787 with |t
# 760|762|765|767|770|772|773|774
function mbshared:related-works
# get to the code below when this function called NOT with third param 'instance'
# 730 with ind2 = ( |0|1|2)
# 740 with ind2 = ( | 2)
# 780 with ind2 = (0-7)
# 785 with ind2 = (0-8)
2497: for $d in $marcxml/marcxml:datafield[fn:matches(@tag,"(730|740|780|785)")]
2498: return (
2499: for $type in $relateds/type[fn:matches($d/@tag,@tag)][fn:matches(@ind2,$d/@ind2)]
...
from 285-327:
<work-relateds>
<type tag="(700|710|711|730)" ind2="2" property="hasPart">isIncludedIn</type>
<type tag="(700|710|711|730)" ind2="( |0|1)" property="relatedResource">relatedWork</type>
<type tag="740" ind2=" " property="relatedWork">relatedWork</type>
<type tag="740" property="partOf" ind2="2">hasPart</type>
<type tag="780" ind2="0" property="continues">continuationOf</type>
<type tag="780" ind2="1" property="continuesInPart">partiallyContinuedBy</type>
<type tag="780" ind2="2" property="supersedes">continuationOf</type>
<type tag="780" ind2="3" property="supersedesInPartBy">partiallyContinuedBy</type>
<type tag="780" ind2="4" property="unionOf">preceding</type>
<type tag="780" ind2="5" property="absorbed">isAbsorbedBy</type>
<type tag="780" ind2="6" property="absorbedInPartBy">isPartlyAbsorbedBy</type>
<type tag="780" ind2="7" property="separatedFrom">formerlyIncluded</type>
<type tag="785" ind2="0" property="continuedBy">continues</type>
<type tag="785" ind2="1" property="continuedInPartBy">partiallyContinues</type>
<type tag="785" ind2="2" property="supersededBy">continues</type>
<type tag="785" ind2="3" property="supersededInPartBy">partiallyContinues</type>
<type tag="785" ind2="4" property="absorbedBy">absorbs</type>
<type tag="785" ind2="5" property="absorbedInPartBy">partiallyAbsorbs</type>
<type tag="785" ind2="6" property="splitInto">splitFrom</type>
<type tag="785" ind2="7" property="mergedToForm">mergedFrom</type>
<type tag="785" ind2="8" property="succeededBy">formerlyNamed</type>
</work-relateds>
...
2500: return mbshared:generate-related-work($d,$type, $workID) )
# 787 with |t
2506: for $d in $marcxml/marcxml:datafield[@tag="787"][marcxml:subfield[@code="t"]]
2507: for $type in $relateds/type[fn:matches($d/@tag,@tag)]
2508: return mbshared:generate-related-work($d,$type, $workID)
# 700|710|711 with |t and ind2 = ( |0|1|2)
2510: for $d in $marcxml/marcxml:datafield[fn:matches(@tag,"(700|710|711)")][marcxml:subfield[@code="t"]]
2511: for $type in $relateds/type[fn:matches($d/@tag,@tag)][fn:matches($d/@ind2,@ind2)]
...
from 285-327:
<work-relateds>
<type tag="(700|710|711|730)" ind2="2" property="hasPart">isIncludedIn</type>
<type tag="(700|710|711|730)" ind2="( |0|1)" property="relatedResource">relatedWork</type>
...
2512: return mbshared:generate-related-work($d,$type, $workID)
# 490 with |a
2514: for $d in $marcxml/marcxml:datafield[fn:matches(@tag,"(490)")][marcxml:subfield[@code="a"]]
2515: for $type in $relateds/type[fn:matches($d/@tag,@tag)]
2516: return mbshared:generate-related-work($d,$type, $workID)
# 400|410|411|430|440|534|774|775|800|810|811|830 with |t
2518: for $d in $marcxml/marcxml:datafield[fn:matches(@tag,"(400|410|411|430|440|534|774|775|800|810|811|830)")][marcxml:subfield[@code="t"]]
2519: for $type in $relateds/type[fn:matches($d/@tag,@tag)]
2520: return mbshared:generate-related-work($d,$type, $workID)
# 760|762|765|767|770|772|773|774
2523: for $d in $marcxml/marcxml:datafield[fn:matches(@tag,"(760|762|765|767|770|772|773|774)")]
2524: for $type in $relateds/type[fn:matches(@tag,$d/@tag)]
2525: return
2526: mbshared:generate-related-work($d,$type, $workID)
Called by
function mbshared:generate-work
2751: let $work-relateds := mbshared:related-works($marcxml,$workID,"work")
# case 2:
# 600 with no |t
modules/module.MARCXMLBIB-BFUtils.xqy
130: declare variable $marc2bfutils:subject-types := (
131: <subjectTypes>
132: <subject tag="600">Person</subject>
Used By:
function mbshared:generate-work(
2742: let $subjects:=
2743: for $d in $marcxml/marcxml:datafield[fn:matches(fn:string-join($marc2bfutils:subject-types//@tag," "),fn:string(@tag))]
2744: return mbshared:get-subject($d) # NOTE: this the only place get-subject is called for bib recs
Used (also):
# 600 if no |t
function mbshared:get-subject
3017: let $subjectType := fn:string($marc2bfutils:subject-types/subject[@tag=$d/@tag])
3018: let $subjectType:= if ($d[@tag="600"][marcxml:subfield[@code="t"]]) then "Work" else $subjectType
...
3148: element {fn:concat("bf:",$subjectType)} {
--------------------------------------------------------------------------------
ack output for 'Person':
modules/module.MARCXMLBIB-BFUtils.xqy
130: declare variable $marc2bfutils:subject-types := (
131: <subjectTypes>
132: <subject tag="600">Person</subject>
modules/module.MBIB-2-BIBFRAME-Shared.xqy
2997:-:29 '600': ('subject', {'bibframeType': 'Person'}),
3284: "bf:Person"
3292: "bf:Person" (:????:)