Bug 6876

Summary: OAI-PMH: ListMetadataFormats lists 2 URLs in namespace
Product: Koha Reporter: Ben Anderson <benanderson>
Component: Web servicesAssignee: Frédéric Demians <f.demians>
Status: NEW --- QA Contact: Bugs List <koha-bugs>
Severity: minor    
Priority: P5 - low CC: f.demians
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Ben Anderson 2011-09-16 20:24:42 UTC
this command:
  $ curl -s 'http://ubuntu/cgi-bin/koha/oai.pl?verb=ListMetadataFormats' | xmllint --format - 

results in :
  http://pastebin.com/raw.php?i=SU52snk3

I believe this is a problem:
  <schema>http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd</schema>
  <metadataNamespace>http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim</metadataNamespace>

shouldn't it be this instead?
  <schema>http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd</schema>
  <metadataNamespace>http://www.loc.gov/MARC21/slim</metadataNamespace>

and not quite as important, but somewhat relevant I think this:
  <metadataPrefix>marcxml</metadataPrefix>
should be this:
  <metadataPrefix>marc21</metadataPrefix>
according to this:
  http://www.openarchives.org/OAI/2.0/guidelines-marcxml.htm
  "It is recommended that the metadataPrefix "marc21" be used with this metadata format."
Comment 1 Frédéric Demians 2011-09-17 04:44:26 UTC
Why is it a critical bug? Does it block any OAI-PMH harvester? Koha
supports other MARC flavours that MARC21 that's the reason why it
returns by default a 'neutral' MARCXML schema. If you need more control
over your Koha OAI server, use it in extended mode:

http://perldoc.koha-community.org/opac/oai.html
Comment 2 Ben Anderson 2011-09-19 13:27:43 UTC
"Why is it a critical bug? Does it block any OAI-PMH harvester?"
not per se, but the harvester has the wrong info about the format and thus can't do anything with the harvested records.

"Koha supports other MARC flavours that MARC21 that's the reason why it returns by default a 'neutral' MARCXML schema."
The intended schema and namespace are fine, but it seems there's a typo (note the spaces in the link you provided)
  metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
  schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd

why are there two urls in each of those values.  That is wrong isn't it?
Comment 3 Frédéric Demians 2011-09-19 17:17:12 UTC
> not per se, but the harvester has the wrong info about the format and
> thus can't do anything with the harvested records.

Please elaborate on this point. Current Koha OAI server is used by
many libraries and harvested by several well known harversters without
trouble, apparently. If it doesn't work for you, tell exacly why.
Propose a patch or describe the issue so someone can try to fix it for
you.

>   metadataNamespace: http://www.loc.gov/MARC21/slim
> http://www.loc.gov/standards/marcxml/schema/MARC21slim
>   schema: http://www.loc.gov/MARC21/slim
> http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd

> why are there two urls in each of those values.  That is wrong isn't
> it?

It seems so. This should be enough:

http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd

Since no harverster seems to complain about or fails to work properly, I
would hesitate to fix that. So same as above, please report any
harverster failing due to this 'strange' namespace.
Comment 4 Ben Anderson 2011-09-19 17:45:36 UTC
Not sure what else to say except that you should re-read my initial comment.  I clearly detailed the issue and offered what I think is the solution.

Here's a couple more resources:

http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd
  <complexType name="metadataFormatType">
    <sequence>
      <element name="metadataPrefix" type="oai:metadataPrefixType"/>
      <element name="schema" type="anyURI"/>
      <element name="metadataNamespace" type="anyURI"/>
    </sequence>
  </complexType>

http://www.w3.org/TR/xmlschema-2/#anyURI:
  "anyURI represents a Uniform Resource Identifier Reference (URI)"

But koha is actually shoving in 2 uris into both schema and metadataNamespace - why?
Comment 5 Katrin Fischer 2015-01-06 17:37:58 UTC
I can confirm, that Koha still lists 2 URLs each in the response to ListMetadataFormats:

<schema>http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd</schema><metadataNamespace>http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim</metadataNamespace>
Comment 6 Katrin Fischer 2019-04-09 22:53:44 UTC
It looks like it was changed in part, there is only 1 URL in schema, but 2 URLs in one namespace element separated by space.

.../cgi-bin/koha/oai.pl?verb=ListMetadataFormats