[22393] | 1 | /* ------------------------------------------------------------------- */
|
---|
| 2 | /* usMARC : Convert a metatag struct to USMARC */
|
---|
| 3 | /* */
|
---|
| 4 | /* 1998-09-30: Ole Husby */
|
---|
| 5 | /* ------------------------------------------------------------------- */
|
---|
| 6 |
|
---|
| 7 | #include <stdio.h>
|
---|
| 8 | #include <string.h>
|
---|
| 9 | #include "d2m.h"
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | void uniMARC(struct metatag *mt, struct marcrec *mr)
|
---|
| 14 | {
|
---|
| 15 | char pre[64], title_tag[4];
|
---|
| 16 |
|
---|
| 17 | *pre = 0;
|
---|
| 18 |
|
---|
| 19 | if (strcasecmp(mt->name, "title") == 0)
|
---|
| 20 | {
|
---|
| 21 | if ( (!*mt->type)
|
---|
| 22 | | (strcasecmp(mt->type, "main") == 0)
|
---|
| 23 | | (strcasecmp(mt->type, "long") == 0) )
|
---|
| 24 | {
|
---|
| 25 | if (mr->ntitles)
|
---|
| 26 | strcpy(title_tag, "200 ");
|
---|
| 27 | else
|
---|
| 28 | strcpy(title_tag, "200 ");
|
---|
| 29 |
|
---|
| 30 | mr->ntitles++;
|
---|
| 31 |
|
---|
| 32 | sprintf(pre, "%s $a", title_tag);
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | else if (strcasecmp(mt->name, "creator") == 0)
|
---|
| 37 | {
|
---|
| 38 | if (!*mt->type)
|
---|
| 39 | strcpy(pre, "700 $a");
|
---|
| 40 | else if ( (strcasecmp(mt->type, "name") == 0)
|
---|
| 41 | || (strcasecmp(mt->type, "personal") == 0) )
|
---|
| 42 | strcpy(pre, "700 $a");
|
---|
| 43 | else if (strcasecmp(mt->type, "corporate") == 0)
|
---|
| 44 | strcpy(pre, "710 $a");
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | else if (strcasecmp(mt->name, "publisher") == 0)
|
---|
| 49 | {
|
---|
| 50 | if (!*mt->type)
|
---|
| 51 | strcpy(pre, "210 $c");
|
---|
| 52 | else if (strcasecmp(mt->type, "name") == 0)
|
---|
| 53 | strcpy(pre, "210 $c");
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | else if (strncasecmp(mt->name, "contributor", 11) == 0) /* Note both pl and sgl allowed */
|
---|
| 57 | {
|
---|
| 58 | if (!*mt->type)
|
---|
| 59 | strcpy(pre, "701 $a");
|
---|
| 60 | else if ( (strcasecmp(mt->type, "name") == 0)
|
---|
| 61 | || (strcasecmp(mt->type, "personal") == 0) )
|
---|
| 62 | strcpy(pre, "701 $a");
|
---|
| 63 | else if (strcasecmp(mt->type, "corporate") == 0)
|
---|
| 64 | strcpy(pre, "711 $a");
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | else if (strcasecmp(mt->name, "coverage") == 0)
|
---|
| 69 | {
|
---|
| 70 | if (!*mt->type)
|
---|
| 71 | strcpy(pre, "300 $a");
|
---|
| 72 | else if (strcasecmp(mt->type , "spatial") == 0)
|
---|
| 73 | strcpy(pre, "300 $a");
|
---|
| 74 | else if (strcasecmp(mt->type, "temporal") == 0)
|
---|
| 75 | strcpy(pre, "300 $a");
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | else if (strcasecmp(mt->name, "source") == 0)
|
---|
| 80 | strcpy(pre, "324 $a");
|
---|
| 81 |
|
---|
| 82 | else if (strcasecmp(mt->name, "rights") == 0)
|
---|
| 83 | {
|
---|
| 84 | if (!*mt->scheme)
|
---|
| 85 | strcpy(pre, "300 $a");
|
---|
| 86 | else if (strcasecmp(mt->scheme, "url") == 0)
|
---|
| 87 | strcpy(pre, "300 $3 rights $a");
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | else if (strcasecmp(mt->name, "identifier") == 0)
|
---|
| 91 |
|
---|
| 92 | /* Not supported: Indicator for urn! (See crosswalk) */
|
---|
| 93 |
|
---|
| 94 | {
|
---|
| 95 | if (!*mt->scheme)
|
---|
| 96 | strcpy(mr->url, mt->value);
|
---|
| 97 | else if (strcasecmp(mt->scheme, "url") == 0)
|
---|
| 98 | strcpy(mr->url, mt->value);
|
---|
| 99 | else if (strcasecmp(mt->scheme, "urn") == 0)
|
---|
| 100 | strcpy(pre, "300 $a urn:");
|
---|
| 101 | else if (strcasecmp(mt->scheme, "isbn") == 0)
|
---|
| 102 | strcpy(pre, "010 $a");
|
---|
| 103 | else if (strcasecmp(mt->scheme, "issn") == 0)
|
---|
| 104 | strcpy(pre, "011 $a");
|
---|
| 105 | else
|
---|
| 106 | strcpy(pre, "300 $a");
|
---|
| 107 | }
|
---|
| 108 |
|
---|
| 109 | else if (strcasecmp(mt->name, "format") == 0)
|
---|
| 110 | {
|
---|
| 111 | if (!*mt->scheme)
|
---|
| 112 | strcpy(mr->fmat, mt->value);
|
---|
| 113 | else if (strcasecmp(mt->scheme, "imt") == 0)
|
---|
| 114 | strcpy(mr->fmat, mt->value);
|
---|
| 115 | else if (strcasecmp(mt->scheme, "mime") == 0)
|
---|
| 116 | strcpy(mr->fmat, mt->value);
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | else if (strcasecmp(mt->name, "subject") == 0)
|
---|
| 120 | {
|
---|
| 121 | if (!*mt->scheme)
|
---|
| 122 | strcpy(pre, "610 $a");
|
---|
| 123 | else if (strcasecmp(mt->scheme, "lcc") == 0)
|
---|
| 124 | strcpy(pre, "680 $a");
|
---|
| 125 | else if (strcasecmp(mt->scheme, "lcsh") == 0)
|
---|
| 126 | strcpy(pre, "606 $a");
|
---|
| 127 | else if (strcasecmp(mt->scheme, "ddc") == 0)
|
---|
| 128 | strcpy(pre, "676 $a");
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 |
|
---|
| 132 | else if (strcasecmp(mt->name, "language") == 0)
|
---|
| 133 | {
|
---|
| 134 | if (strcasecmp(mt->scheme, "z39.53") == 0)
|
---|
| 135 | {
|
---|
| 136 | if (strlen(mt->value) == 3)
|
---|
| 137 | put008(mr->s008, mt->value, F008_LANGUAGE);
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 |
|
---|
| 142 | else if (strcasecmp(mt->name, "date") == 0)
|
---|
| 143 | {
|
---|
| 144 | if ( (strncasecmp(mt->scheme, "ans", 3) == 0) ||
|
---|
| 145 | (strncasecmp(mt->scheme, "iso", 3) == 0) )
|
---|
| 146 | {
|
---|
| 147 | if ( (!*mt->type) || ( strcasecmp(mt->type, "current") == 0) )
|
---|
| 148 | {
|
---|
| 149 | if (find_year(mt->value))
|
---|
| 150 | {
|
---|
| 151 | strcpy(mr->year, mt->value);
|
---|
| 152 | put008(mr->s008, mt->value, F008_DATE1);
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 | }
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | if (*pre)
|
---|
| 159 | {
|
---|
| 160 | strcat(mr->marcline, pre);
|
---|
| 161 | strcat(mr->marcline, " ");
|
---|
| 162 | strcat(mr->marcline, mt->value);
|
---|
| 163 | strcat(mr->marcline, "\n");
|
---|
| 164 | }
|
---|
| 165 | }
|
---|