forked from JanusChoi/translators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAIP.js
242 lines (230 loc) · 7.43 KB
/
AIP.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
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
{
"translatorID": "48d3b115-7e09-4134-ad5d-0beda6296761",
"label": "AIP",
"creator": "Aurimas Vinckevicius",
"target": "^http://scitation\\.aip\\.org/(?:search\\?|content/)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2013-12-06 17:49:29"
}
function getSearchResults(doc) {
return doc.getElementsByClassName("resultItem");
}
function detectWeb(doc, url) {
if(url.indexOf('search') !== -1 && getSearchResults(doc).length) {
return 'multiple';
}
if(ZU.xpathText(doc, '/html/head/meta[@name="citation_journal_title"]/@content')) {
return 'journalArticle';
}
else if(doc.body.id == 'conferencepaper') return "conferencePaper"
}
function doWeb(doc, url) {
if(detectWeb(doc, url) == 'multiple') {
var results = getSearchResults(doc);
var items = {};
for(var i=0, n=results.length; i<n; i++) {
var title = ZU.xpath(results[i], './/div[@class="title"]/a')[0];
items[title.href] = ZU.trimInternal(title.textContent);
}
Z.selectItems(items, function(selectedItems) {
if(!selectedItems) return true;
var urls = [];
for(var i in selectedItems) {
urls.push(i);
}
ZU.processDocuments(urls, scrape);
})
} else {
scrape(doc, url);
}
}
function scrape(doc, url) {
//use Embedded Metadata
var translator = Z.loadTranslator('web');
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function(obj, item) {
//for conference papers, we're missing some metadata
if(!item.publicationTitle
&& ZU.xpath(doc, '//div[@id="breadcrumb"]/a[@title="Link to conference proceedings"]').length) {
item.publicationTitle = "AIP Conference Proceedings";
item.volume = ZU.xpathText(doc, '//div[@class="itemCitation"]//span[@class="citationvolume"]');
}
var pdf = ZU.xpath(doc, '//li[@class="pdf"]/a[@class="pdf" and @href]')[0];
if(pdf) {
item.attachments.push({
title: "Full Text PDF",
url: pdf.href,
mimeType: 'application/pdf'
});
}
var keywords = ZU.xpath(doc, '//div[@class="keywords-container"]//dt/a');
var tags = [];
for(var i=0, n=keywords.length; i<n; i++) {
tags.push(ZU.trimInternal(keywords[i].textContent));
}
if(tags.length) {
item.tags = tags;
}
item.complete();
});
translator.translate();
}/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://scitation.aip.org/content/aip/journal/aplmater/1/2/10.1063/1.4818002",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"firstName": "Ian",
"lastName": "MacLaren",
"creatorType": "author"
},
{
"firstName": "LiQiu",
"lastName": "Wang",
"creatorType": "author"
},
{
"firstName": "Owen",
"lastName": "Morris",
"creatorType": "author"
},
{
"firstName": "Alan J.",
"lastName": "Craven",
"creatorType": "author"
},
{
"firstName": "Robert L.",
"lastName": "Stamps",
"creatorType": "author"
},
{
"firstName": "Bernhard",
"lastName": "Schaffer",
"creatorType": "author"
},
{
"firstName": "Quentin M.",
"lastName": "Ramasse",
"creatorType": "author"
},
{
"firstName": "Shu",
"lastName": "Miao",
"creatorType": "author"
},
{
"firstName": "Kambiz",
"lastName": "Kalantari",
"creatorType": "author"
},
{
"firstName": "Iasmi",
"lastName": "Sterianou",
"creatorType": "author"
},
{
"firstName": "Ian M.",
"lastName": "Reaney",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Antiferroelectricity",
"Antiferroelectricity",
"Dielectric oxides",
"Dielectric oxides",
"Image reconstruction",
"Image reconstruction",
"Iron group ions",
"Iron group ions",
"Ozone",
"Ozone"
],
"seeAlso": [],
"attachments": [
{
"title": "Snapshot"
},
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Local stabilisation of polar order at charged antiphase boundaries in antiferroelectric (Bi0.85Nd0.15)(Ti0.1Fe0.9)O3",
"date": "2013/08/13",
"publicationTitle": "APL Materials",
"volume": "1",
"issue": "2",
"abstractNote": "Observation of an unusual, negatively-charged antiphase boundary in (Bi0.85Nd0.15)(Ti0.1Fe0.9)O3 is reported. Aberration corrected scanning transmission electron microscopy is used to establish the full three dimensional structure of this boundary including O-ion positions to ∼±10 pm. The charged antiphase boundary stabilises tetragonally distorted regions with a strong polar ordering to either side of the boundary, with a characteristic length scale determined by the excess charge trapped at the boundary. Far away from the boundary the crystal relaxes into the well-known Nd-stabilised antiferroelectric phase.",
"DOI": "10.1063/1.4818002",
"pages": "021102",
"ISSN": "2166-532X",
"url": "http://scitation.aip.org/content/aip/journal/aplmater/1/2/10.1063/1.4818002",
"libraryCatalog": "scitation.aip.org"
}
]
},
{
"type": "web",
"url": "http://scitation.aip.org/content/aip/proceeding/aipcp/10.1063/1.4756630",
"items": [
{
"itemType": "conferencePaper",
"creators": [
{
"firstName": "S.",
"lastName": "Št'astník",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Advanced materials",
"Insulator surfaces",
"Materials science",
"Numerical analysis",
"Surface finishing"
],
"seeAlso": [],
"attachments": [
{
"title": "Snapshot"
},
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Evaluation of thermal resistance of building insulations with reflective surfaces",
"publisher": "AIP Publishing",
"date": "2012/09/26",
"volume": "1479",
"conferenceName": "NUMERICAL ANALYSIS AND APPLIED MATHEMATICS ICNAAM 2012: International Conference of Numerical Analysis and Applied Mathematics",
"abstractNote": "The thermal resistance of advanced insulation materials, applied namely in civil engineering, containing reflective surfaces and air gaps, cannot be evaluated correctly using the valid European standards because of presence of the dominant nonlinear radiative heat transfer and other phenomena not included in the recommended computational formulae. The proper general physical analysis refers to rather complicated problems from classical thermodynamics, whose both existence theory and numerical analysis contain open questions and cannot be done in practice when the optimization of composition of insulation layers is required. This paper, coming from original experimental results, demonstrates an alternative simplified computational approach, taking into account the most important physical processes, useful in the design of modern insulation systems.",
"DOI": "10.1063/1.4756630",
"pages": "2204-2207",
"url": "http://scitation.aip.org/content/aip/proceeding/aipcp/10.1063/1.4756630",
"libraryCatalog": "scitation.aip.org",
"proceedingsTitle": "AIP Conference Proceedings"
}
]
},
{
"type": "web",
"url": "http://scitation.aip.org/search?value1=insulation&option1=all&option12=resultCategory&value12=ResearchPublicationContent",
"items": "multiple"
}
]
/** END TEST CASES **/