Skip to content

Decisions made when dealing with ORCID xml and OM

jhallida edited this page Mar 7, 2014 · 6 revisions

The original work by Jeremy used a custom-built XML renderer. It was thought that we should try to use OM instead, since OM can provide a lot of nice object mapping functionality and it's part of the Hydra stack.

The branch this code is on: https://github.com/jeremyf/orcid/tree/work-om-xml

Here's what we did:

  • Created an OM terminology for Work

  • We noticed that OM wasn't working for elements with hyphens in the name (and ORCID xml has a lot of them). After a lot of debugging, we found the bug an opened an issue with OM: https://github.com/projecthydra/om/issues/46

  • We decided we didn't have time to fix the OM bug, so we decided to define the OM terminology with underscores instead of hyphens. We only need the XML to have hyphens when sending to ORCID. We wrote a module that scrubs the XML before sending to ORCID and after receiving it from ORCID.

  • In order to get OM to work correctly in accessing elements we needed to define all of the elements as empty nodes in the xml_template method (even though this contradicts the OM documentation). This results in a document that has all of the elements, whether you use them or not.

  • In order to use Mappy, it needs to instantiate objects with a hash of attributes. Because the OM terminology doesn't have attributes (it just has OM terms) we wrote it's initializer to take those params and set the OM terms so it doesn't try to set the non-existent attributes.

  • We tested sending the XML to ORCID, but it complained about empty nodes, which happens because of the xml_template issue in OM.

  • We added to the xml scrubber to remove empty nodes.

  • We have the beginnings of a 'bio.rb' file that should eventually mimic the work.rb file with ORCID bio information.

  • Currently all spec tests work using OM to construct work objects.

Next steps:

  • Expand spec tests for works to build a full XML work document, send to ORCID, and confirm that it comes back the same.

  • Expand spec tests to test XML scrubber more thoroughly, including testing the hyphen to underscore behavior.

  • Fix XML Parser within Work.rb; it currently still uses the old method of parsing the file.

  • Flesh out the bio.rb file, and create appropriate spec tests, including sending bio information back and forth to ORCID.