Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify mappings file and related code #7

Closed
MarcusBarnes opened this issue May 15, 2015 · 7 comments
Closed

Simplify mappings file and related code #7

MarcusBarnes opened this issue May 15, 2015 · 7 comments
Assignees
Labels

Comments

@MarcusBarnes
Copy link
Owner

A mapping file will also be necessary for non-CONTENTdm sources.

Task: Simplify the mapping structure. For example, using these columns:

source field label language of field target element note

The 'Language of field' and 'note' columns would be optional.

Thank you to @mjordan for the suggestions.

@MarcusBarnes MarcusBarnes self-assigned this May 15, 2015
@MarcusBarnes
Copy link
Owner Author

Updated CdmToMods metadata parser class to handle the simplified mappings file structure in commit feac7a3. Documentation and examples are still required.

@mjordan
Copy link
Collaborator

mjordan commented Jun 4, 2015

The private function getCDMtoModsMappingArray in CdmToMods.php is duplicated in the (also private) parent Mods class. I would recommend removing it from the Modc class but the mapping doesn't need to be specific to CONTENTdm. Could we keep it in the Mods class and reference it from the CdmToMods class so we could reuse it in other child classes?

@MarcusBarnes
Copy link
Owner Author

Thank you @mjordan for the comment. I'll review the code in the classes more closely and make changes as appropriate. My first thought is that we will need to rename getCDMtoModsMappingArray to remove the short-hand reference to CONTENTdm in the method in the parent Mods class and use something more generic.

@MarcusBarnes
Copy link
Owner Author

@mjordan I've opened a more general review issue related to your comment. Thank you again for your ongoing suggestions and comments.

@mjordan
Copy link
Collaborator

mjordan commented Jun 8, 2015

Just tested creating a mappings file in Excel 2013, LibreOffice Calc, and Google Sheets. Excel and Sheets export CSV like this:

title,,<titleInfo><title>%value%</title></titleInfo>,Testing titles
subject,en,"<subject authority=""foo"">%value%</subject>",Testing subjects….

That is, with annoying escaped quotation marks around the attribute value, and no option that I could see to not do that. LibreOffice Calc did provide an option to define the text delimiter, which allows you to specify none, producing this ready-to-use mappings file:

title,,<titleInfo><title>%value%</title></titleInfo>,,Just testing
subject,,<subject authority="lsch"><topic>%value%</topic></subject>,,Testing

I can't think of a case where a comma would appear in any of these fields other than the note field, or perhaps in the target element field if the target was a literal string containing a comma.

@MarcusBarnes
Copy link
Owner Author

After reflecting on the use of "language of field" in the mapping file, it was determined that it was best to handle this in the "target element", which is typically an XML snippet. In the case of MODS XML snippets, manually setting the lang attribute in a MODS element (or child element) provides greater control.

TASK: Remove "language of field" from the mappings file and related code.

@MarcusBarnes MarcusBarnes reopened this Jun 9, 2015
@MarcusBarnes
Copy link
Owner Author

The 'language of field' has been removed from the default mappings file structure. See commit 76118cd.

The default mappings file now has the following structure:

source field label target element note

The 'note' field is optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants