Skip to content

Instantly share code, notes, and snippets.

@cmharlow
Last active September 11, 2016 03:19
Show Gist options
  • Save cmharlow/eab2223dd6803b405613712c0b7af106 to your computer and use it in GitHub Desktop.
Save cmharlow/eab2223dd6803b405613712c0b7af106 to your computer and use it in GitHub Desktop.
working through title logic for ld4all with isbd nonsense
245value = full value of 245 field (all subfields included)
:work1 = bf:Work instance related to MARC record being processed
EOL = end of the field OR until the presence of $c
if 245value exists:
for first subfield present (either $a or $k):
create :title1 instance
:work1 ld4l:hasPreferredTitle :title1 .
:title1 a madsrdf:Title ;
rdfs:label "values of subfields if exist, concatenated in order found, stopping at ';', '=', or EOL: a,b,f,g,k,n,p,v (string punctuation preceding $c)" ;
dcterms:hasPart :title1part1 .
:title1part1 a madsrdf:MainTitleElement ;
rdfs:label "value of first subfield normalized (strip trailing punctuation)"
for each following subfield before ';', '=' or EOL:
if is $b and is subfield is preceded by ':' :
subtitleString = $b from start of subfield until next ';', ':', '=', end of subfield or EOL.
:title1 dcterms:hasPart :title1part2 .
:title1part2 a madsrdf:SubTitleElement ;
rdfs:label subtitleString ;
ld4l:rank = '1' .
if $b contains '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment