This repository has been archived by the owner on Jan 3, 2020. It is now read-only.
forked from zotero/translators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGemeinsamer Bibliotheksverbund ISBN.js
194 lines (181 loc) · 5.19 KB
/
Gemeinsamer Bibliotheksverbund ISBN.js
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
{
"translatorID": "de0eef58-cb39-4410-ada0-6b39f43383f9",
"label": "Gemeinsamer Bibliotheksverbund ISBN",
"creator": "Philipp Zumstein",
"target": "",
"minVersion": "4.0",
"maxVersion": "",
"priority": 99,
"inRepository": true,
"translatorType": 8,
"browserSupport": "gcsibv",
"lastUpdated": "2015-04-16 18:45:00"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2015 Philipp Zumstein
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectSearch(item) {
return !!item.ISBN;
}
function doSearch(item) {
var queryISBN = ZU.cleanISBN(item.ISBN);
//search the ISBN over the SRU of the GBV, and take the result it as MARCXML
//documentation: https://www.gbv.de/wikis/cls/SRU
var url = "http://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=pica.isb=" + queryISBN + " AND pica.mat%3DB&maximumRecords=1";
ZU.doGet(url, function (text) {
Z.debug(text);
var translator = Zotero.loadTranslator("import");
translator.setTranslator("edd87d07-9194-42f8-b2ad-997c4c7deefd");
translator.setString(text);
translator.setHandler("itemDone", function (obj, item) {
// The url to the table of contents (scanned through DNB)
// can be contained in field 856 $3 and the url schema is unique:
// prefix (http://d-nb.info/) + id + suffix for toc (/04)
var tocURL = text.match(/http:\/\/d-nb\.info\/.*\/04/);
if (tocURL) {
item.attachments = [{
url: tocURL[0],
title: "Table of Contents PDF",
mimeType: "application/pdf"
}];
}
//delete [u.a.] from place
if (item.place) {
item.place = item.place.replace(/\[?u\.[\s\u00A0]?a\.\]?\s*$/, '');
}
//DDC is not the callNumber in Germany
item.callNumber = "";
//place the queried ISBN as the first ISBN in the list (dublicates will be removed later)
item.ISBN = queryISBN + " " + item.ISBN;
item.complete();
});
translator.translate();
});
}
// Testing locally in
// chrome://zotero/content/tools/testTranslators/testTranslators.html
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "search",
"input": {
"ISBN": "9783830931492"
},
"items": [
{
"itemType": "book",
"creators": [
{
"lastName": "Böttcher",
"firstName": "Wolfgang",
"creatorType": "editor"
},
{
"lastName": "DeGEval - Gesellschaft für Evaluation",
"creatorType": "editor",
"fieldMode": true
}
],
"notes": [
{
"note": "Literaturangaben"
}
],
"tags": [
"Aufsatzsammlung",
"Deutschland",
"Evaluation",
"Professionalisierung",
"Qualität",
"Österreich"
],
"seeAlso": [],
"attachments": [
{
"title": "Table of Contents PDF",
"mimeType": "application/pdf"
}
],
"libraryCatalog": "Gemeinsamer Bibliotheksverbund ISBN",
"place": "Münster",
"ISBN": "9783830931492 3830931492 9783830931492",
"title": "Evaluation in Deutschland und Österreich: Stand und Entwicklungsperspektiven in den Arbeitsfeldern der DeGEval - Gesellschaft für Evaluation",
"publisher": "Waxmann",
"date": "2014",
"numPages": "219",
"language": "ger",
"shortTitle": "Evaluation in Deutschland und Österreich"
}
]
},
{
"type": "search",
"input": {
"ISBN": "3-86688-240-8"
},
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "Katrin Bente",
"lastName": "Karl",
"creatorType": "author"
}
],
"notes": [
{
"note": "Literaturverz. S. [373] - 387 Die CD-ROM enth. einen Anh. mit Dokumenten zur Sprachproduktion und Sprachbewertung"
},
{
"note": "Univ., FB SLM, Diss. u.d.T.: Karl, Katrin Bente: Nicht materieller lexikalischer Transfer als Folge der aktuellen russisch-deutschen Zweisprachigkeit--Hamburg, 2011"
}
],
"tags": [
"CD-ROM",
"Deutsch",
"Deutsch",
"Hochschulschrift",
"Russisch",
"Russisch",
"Wortschatz",
"Wortschatz",
"Zweisprachigkeit",
"Zweisprachigkeit"
],
"seeAlso": [],
"attachments": [
{
"title": "Table of Contents PDF",
"mimeType": "application/pdf"
}
],
"ISBN": "3866882408 9783866882409 9783866882416",
"language": "ger",
"place": "München",
"numPages": "387",
"series": "Slavolinguistica",
"seriesNumber": "15",
"libraryCatalog": "Gemeinsamer Bibliotheksverbund ISBN",
"shortTitle": "Bilinguale Lexik",
"title": "Bilinguale Lexik: nicht materieller lexikalischer Transfer als Folge der aktuellen russisch-deutschen Zweisprachigkeit",
"publisher": "Sagner",
"date": "2012"
}
]
}
]
/** END TEST CASES **/