Opened 10 years ago

Closed 10 years ago

#530 closed enhancement (fixed)

Add base field conversion to translation level

Reported by: dstillman Owned by: simon
Priority: major Milestone: 1.0 Beta 4
Component: ingester Version: 1.0
Keywords: Cc:

Description

Potentially useful methods:

  • ItemFields.isBaseField(fieldID)
  • ItemFields.getFieldIDFromTypeAndBase(itemType, baseField)
  • ItemFields.getBaseIDFromTypeAndField(itemType, typeField)
  • ItemFields.getTypeFieldsFromBase(baseField)

Data coming from the 'publisher' field from translators, for example, should be put into the appropriate type-specific field using getFieldIDFromTypeAndBase(). Export to non-Zotero-RDF formats should get switched back to the base field with getBaseIDFromTypeAndField(), and I assume bibliography output can use it too.

The conversion methods return false if there's no associated field, so they can just be run against all itemData fields.

Change History (3)

comment:1 Changed 10 years ago by dstillman

(In [1154]) Addresses #346, mapping for new item types
Closes #453, Check if any fields will actually be discarded on item type change before giving warning
Refs #530, Add base field conversion to translation level

Added mechanism for linking item type fields via base fields, e.g. publisher => label in audioRecording

New methods:

Item.getFieldsNotInType(itemTypeID, allowBaseConversion)
ItemFields.getLocalizedString(itemTypeID, field)
ItemFields.isBaseField(fieldID)
ItemFields.getFieldIDFromTypeAndBase(itemType, baseField)
ItemFields.getBaseIDFromTypeAndField(itemType, typeField)
ItemFields.getTypeFieldsFromBase(baseField)

Currently only the publisher fields are mapped -- I need more feedback on #346 before I implement the others (specifically on whether or not all these sorts of fields should be done as distinct fields or whether some should just be localized strings (in which case they'll autocomplete but not show up separately as search conditions))

Also added 'university' as distinct publisher field for thesis

Values of equivalent fields are now preserved when switching between item types (e.g. the 'studio' value becomes the 'label' value when switching between videoRecording and audioRecording), and the pop-up is much smarter--it will only prompt you if fields will in fact be lost, and it will list the fields that would be deleted.

Not finished:

  • Searching for base fields doesn't yet search the type-specific fields, as Elena requested
  • import/export/bib should be updated to use the ItemFields base conversion methods where appropriate -- data coming from the 'publisher' field from translators, for example, should be put into the appropriate type-specific field.

comment:2 Changed 10 years ago by dstillman

Export can use the new third Item.getField() parameter, |includeBaseMapped|, to return the value of the type-specific field for base fields instead (e.g. 'label' for 'publisher' in 'audioRecording').

comment:3 Changed 10 years ago by simon

  • Resolution set to fixed
  • Status changed from new to closed

(In [1232]) closes #530, add base field conversion to translation level
closes #534, export fails on missing attachments

Note: See TracTickets for help on using tickets.