For instance, a repository might offer both OAI_DC and METS versions of record metadata; the included parser can take care of OAI_DC, and someone could write or use another parser for other types.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | feeds_oai_pmh-1065452-16-d7.patch | 5.05 KB | queenvictoria |
| #15 | feeds_oai_pmh-1065452-15-d6.patch | 5.21 KB | StevenWill |
| #15 | feeds_oai_pmh-1065452-15-d7.patch | 5.33 KB | StevenWill |
| #14 | feeds_oai_pmh-1065452-14-D6.patch | 5.21 KB | StevenWill |
| #14 | feeds_oai_pmh-1065452-14-d7.patch | 5.21 KB | StevenWill |
Comments
Comment #1
janusman commentedHere is a patch. Probably will commit it as is, would love some review =)
The nice thing is that the Feed Importer form refreshes via AHAH to show only the available metadataPrefixes available on the repository (like it already happened for the sets).
Comment #2
puhig commentedHi , i try patch and i get this :
patch -p0 < feeds_oai_pmh-1065452-metadata-formats.patch
patching file FeedsOAIHTTPFetcher.inc
patching file feeds_oai_pmh.inc
Hunk #1 FAILED at 8.
Hunk #2 FAILED at 54.
Hunk #3 FAILED at 63.
Hunk #4 FAILED at 180.
Hunk #5 FAILED at 220.
5 out of 5 hunks FAILED -- saving rejects to file feeds_oai_pmh.inc.rej
patching file feeds_oai_pmh.module
why is it happening ?
Comment #3
janusman commentedThe patch should be against a fresh checkout of the HEAD branch; please confirm if you tried that =)
Comment #4
puhig commentedOh Thank!
I applied on last dev. My apologise.
Comment #5
janusman commentedI'm thinking this should be part of the configuration inside the Feed Importer itself, and not on the step before import (or editing a Feed node)...
Comment #6
puhig commentedHi,
With XML Schema and template parser i think it's possible accept more formats.
Comment #7
fereira commentedI agree, however, using the ahah approach for selecting the metadata format similar to how it selects a setSpec works nicely for constructing the ListRecords request. Of course, the request is just fetching the raw data, and if the content is oai_dc, or mets, or rdf it still needs an appropriate parser to handle it.
Comment #8
fereira commentedI couldn't get this patch to work. It doesn't seem to be constructing the FeedsOAIHTTPFetcher with the metadata_prefix from the form element and results in a request url with &metadataPrefix= without a value for the attribute.
When I uncommented the dsm statement in FeedsOAIHTTPFetcher which displays the URL a portion of it looks like this...
....?verb=ListRecords&metadataPrefix=&from=....
Comment #9
janusman commentedThis patch adds the option under the Fetcher settings when editing the Feed Importer. I'm sorry it doesn't do any nifty AJAX-y scanning of a repository, but since metadata formats will be tied to the Feed parser choice/configuration it made more sense to put it here.
I'm not ecstatic about it, but it should work =) Will commit soon.
Screenshot:

Comment #10
StevenWill commentedI applied the patch from comment #9 to the 6.x-1.x-dev and the fetcher is working. I first attempted to leave the HTTP OAI-PMH Fetcher metadataPrefix setting to "oai_dc" and run a feeds import with oai_dc. The oai_dc import was a success. A second test was performed by changing the metadataPrefix to mets and updating the OAI Parser to map the "Repository Record Identifier" as this field is located in the record head of both oai_dc and mets returns. The Fetcher and limited Parsing also imported successfully for mets.
With my test the HTTP OAI-PMH Fetcher is working successfully, but the OAI Parser needs to be extended to map other metadata fields like mets, nsdl_dc and rdf.
Comment #11
StevenWill commentedWould it be cleaner to have a separate feature request to extend the OAI Parser?
Comment #12
StevenWill commentedI did find one PHP warning when running the import as metadataPrefix=mets a second time when no new content is found. The php warning: "warning: Invalid argument supplied for foreach() in /sites/all/modules/feeds_oai_pmh/FeedsOAIParser.inc on line 38."
When I check if the array_key_exists before running the foreach loop the warning goes away.
Not sure the warning is limited to this code addition, but it is probably a good idea to perform a check on the array key anyway.
Comment #13
janusman commentedRe: @StevenWill #10: I'm not looking to implement different metadata parsers in this modules (at least not unless I get some help). You can now roll your own parser using some of the available parsers for Feeds that parse XML; you'd just use the fetcher portion of Feeds OAI-PMH module and then enable other modules to do the parsing for you.
Re: #11: And yes, a separate issue to discuss/work on extending the parser should go into another issue =)
Re: #12: Thanks for the catch; I'll fix that. Setting to needs work.
Comment #14
StevenWill commentedLooks like head has been updated so I am attaching updated patches for compatibility. I am also rolling a patch for the 7 branch.
Comment #15
StevenWill commentedBranch 7 patch in #14 is incorrect so i am attaching a update.
Comment #16
queenvictoria commentedUpdated patch for current HEAD.