UB-Mannheim / zotkat

Erweiterung von Zotero für die Katalogisierung
GNU Affero General Public License v3.0
45 stars 22 forks source link

keywords/tags exportieren #38

Closed socheres closed 7 years ago

socheres commented 7 years ago

Keywords gibt es nicht als zotero-field. Wie kann man trotzdem item.tags exportieren?

        // keywords aus Fremddaten--> 5520
        if (item.tags) {
            writeLine("5520 |s|", item.tags);
        }
zuphilip commented 7 years ago

Wie soll dies genau aussehen in Pica? Die Tags in Zotero sehen beispielsweise so aus:

item.tags = [
    {"tag":"Structural Models","type":1},
    {"tag":"NEIO","type":1},
    {"tag":"Pricing","type":1},
    {"tag":"Sales Promotion","type":1},
    {"tag":"Sales Promotion Paradox","type":1}
];
socheres commented 7 years ago

Für nicht normierte keywords kann man das Feld 5520 in WiniBW nutzen. Und zwar vor dem ersten Keyword muss |s| stehen. Z.B.: 5520 |s|Structural Models; NEIO; Pricing; Sales Promotion; Sales Promotion Paradox

socheres commented 7 years ago

@zuphilip bitte eine "kleine" Änderung noch. Mit jedem Tag muss das Feld 5520 wiederholt werden. Wenn wir das obige Bsp. nehmen, sähe das Exportergebnis wie folgt aus: 5520 |s|Structural Models 5520 |s|NEIO 5520 |s|Sales Promotion 5520 |s|Sales Promotion Paradox

socheres commented 7 years ago

ich habe mit folgendem Code getestet, aber das Ergebnis ist nicht ganz sauber var i = 0, tagStatement; while (item.tags.length > 0) { tagStatement = item.tags.shift(); var tagStatement = "|s|" + item.tags.map(function(tag) { return tag.tag; }).join('; '); writeLine("5520", tagStatement); }

socheres commented 7 years ago

mit var tagStatement = "|s|" + item.tags.map(function(tag) { return tag.tag; }).join('; ').split(";", 1);kommt das Ergebnis sauber. Kann ich das so ändern?

zuphilip commented 7 years ago

Okay, dies ändert natürlich die Sachlage.

Ich würde so etwas vorschlagen:

for (var i=0; i<item.tags.length; i++) {
    writeLine("5520", "|s|" + item.tags[i].tag);
}
socheres commented 7 years ago

ja, mit deinem Vorschlag for (var i=0; i<item.tags.length; i++) { var tagStatement = "|s|" + item.tags.map(function(tag) { return tag.tag; }).join('; ').split(";", 1); writeLine("5520", "|s|" + item.tags[i].tag); } sieht gut aus. Bei meinem Vorschlag wurde das erste Tag/Keyword nicht exportiert.

socheres commented 7 years ago

außerdem noch eine kleine Änderung writeLine("5520", "|s|" + item.tags[i].tag.replace(/ --/g, ';')); } Trennzeichen fürs präkombinierte Schlagwort ist ";", damit das Wort nach ";" beim Marc-Export in Unterfeld "$x"geschrieben werden. Z.B.: 5520 |s|Nature; Religious aspects; Christianity 650 0$aNature$xReligious aspects$xChristianity

zuphilip commented 7 years ago

Closed by #41