|
@@ -35,7 +35,7 @@ url_detail = wikidata_api\
|
35
|
35
|
|
36
|
36
|
url_map = 'https://www.openstreetmap.org/'\
|
37
|
37
|
+ '?lat={latitude}&lon={longitude}&zoom={zoom}&layers=M'
|
38
|
|
-url_image = 'https://commons.wikimedia.org/wiki/Special:FilePath/{filename}?width=500'
|
|
38
|
+url_image = 'https://commons.wikimedia.org/wiki/Special:FilePath/{filename}?width=500&height=400'
|
39
|
39
|
|
40
|
40
|
# xpaths
|
41
|
41
|
wikidata_ids_xpath = '//div/ul[@class="wikibase-disambiguation"]/li/a/@title'
|
|
@@ -162,6 +162,7 @@ def getDetail(jsonresponse, wikidata_id, language, locale):
|
162
|
162
|
|
163
|
163
|
# INFOBOX ATTRIBUTES (ROWS)
|
164
|
164
|
|
|
165
|
+ # DATES
|
165
|
166
|
# inception date
|
166
|
167
|
add_attribute(attributes, result, 'P571', date=True)
|
167
|
168
|
# dissolution date
|
|
@@ -170,11 +171,14 @@ def getDetail(jsonresponse, wikidata_id, language, locale):
|
170
|
171
|
add_attribute(attributes, result, 'P580', date=True)
|
171
|
172
|
# end date
|
172
|
173
|
add_attribute(attributes, result, 'P582', date=True)
|
173
|
|
-
|
174
|
174
|
# date of birth
|
175
|
175
|
add_attribute(attributes, result, 'P569', date=True)
|
176
|
176
|
# date of death
|
177
|
177
|
add_attribute(attributes, result, 'P570', date=True)
|
|
178
|
+ # date of spacecraft launch
|
|
179
|
+ add_attribute(attributes, result, 'P619', date=True)
|
|
180
|
+ # date of spacecraft landing
|
|
181
|
+ add_attribute(attributes, result, 'P620', date=True)
|
178
|
182
|
|
179
|
183
|
# nationality
|
180
|
184
|
add_attribute(attributes, result, 'P27')
|
|
@@ -201,7 +205,7 @@ def getDetail(jsonresponse, wikidata_id, language, locale):
|
201
|
205
|
# area
|
202
|
206
|
add_attribute(attributes, result, 'P2046')
|
203
|
207
|
# currency
|
204
|
|
- add_attribute(attributes, result, 'P38')
|
|
208
|
+ add_attribute(attributes, result, 'P38', trim=True)
|
205
|
209
|
# heigth (building)
|
206
|
210
|
add_attribute(attributes, result, 'P2048')
|
207
|
211
|
|
|
@@ -230,6 +234,10 @@ def getDetail(jsonresponse, wikidata_id, language, locale):
|
230
|
234
|
add_attribute(attributes, result, 'P264')
|
231
|
235
|
# publisher
|
232
|
236
|
add_attribute(attributes, result, 'P123')
|
|
237
|
+ # original network
|
|
238
|
+ add_attribute(attributes, result, 'P449')
|
|
239
|
+ # distributor
|
|
240
|
+ add_attribute(attributes, result, 'P750')
|
233
|
241
|
# composer
|
234
|
242
|
add_attribute(attributes, result, 'P86')
|
235
|
243
|
# publication date
|
|
@@ -266,6 +274,10 @@ def getDetail(jsonresponse, wikidata_id, language, locale):
|
266
|
274
|
add_attribute(attributes, result, 'P112')
|
267
|
275
|
# legal form (company/organization)
|
268
|
276
|
add_attribute(attributes, result, 'P1454')
|
|
277
|
+ # operator
|
|
278
|
+ add_attribute(attributes, result, 'P137')
|
|
279
|
+ # crew members (tripulation)
|
|
280
|
+ add_attribute(attributes, result, 'P1029')
|
269
|
281
|
# taxon
|
270
|
282
|
add_attribute(attributes, result, 'P225')
|
271
|
283
|
# chemical formula
|
|
@@ -300,8 +312,8 @@ def getDetail(jsonresponse, wikidata_id, language, locale):
|
300
|
312
|
|
301
|
313
|
# only returns first match
|
302
|
314
|
def add_image(result):
|
303
|
|
- # P18: image, P154: logo, P242: map, P41: flag, P2716: collage, P2910: icon
|
304
|
|
- property_ids = ['P18', 'P154', 'P242', 'P41', 'P2716', 'P2910']
|
|
315
|
+ # P15: route map, P242: locator map, P154: logo, P18: image, P242: map, P41: flag, P2716: collage, P2910: icon
|
|
316
|
+ property_ids = ['P15', 'P242', 'P154', 'P18', 'P242', 'P41', 'P2716', 'P2910']
|
305
|
317
|
|
306
|
318
|
for property_id in property_ids:
|
307
|
319
|
image = result.xpath(property_xpath.replace('{propertyid}', property_id))
|
|
@@ -320,6 +332,7 @@ def add_attribute(attributes, result, property_id, default_label=None, date=Fals
|
320
|
332
|
label = default_label
|
321
|
333
|
else:
|
322
|
334
|
label = extract_text(attribute[0].xpath(label_xpath))
|
|
335
|
+ label = label[0].upper() + label[1:]
|
323
|
336
|
|
324
|
337
|
if date:
|
325
|
338
|
trim = True
|
|
@@ -369,6 +382,7 @@ def add_url(urls, result, property_id=None, default_label=None, url_prefix=None,
|
369
|
382
|
dom_element = dom_element[0]
|
370
|
383
|
if not default_label:
|
371
|
384
|
label = extract_text(dom_element.xpath(label_xpath))
|
|
385
|
+ label = label[0].upper() + label[1:]
|
372
|
386
|
|
373
|
387
|
if link_type == 'geo':
|
374
|
388
|
links.append(get_geolink(dom_element))
|