wiki:CmdiMultipleRecords

Version 1 (modified by mwindhouwer, 11 years ago) (diff)

--

In OAI-PMH it is possible to request multiple CMDI records, which then will be returned in one response. However, due to possible clashes of IDs, i.e., one record uses the same ID for a ResourceProxy? as another record. Peter Fankhauser (IDS) pointed out that xs:key and xs:unique could provide a solution.

Indeed adding these to comp2schema.xsl can solve the problem to a large extend:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dcr="http://www.isocat.org/ns/dcr" xmlns:cmd="http://www.clarin.eu/cmd/" targetNamespace="http://www.clarin.eu/cmd/" elementFormDefault="qualified">            
...
    <xs:element name="CMD">
...                
        <!-- Resource key and reference constraints -->
                
        <xs:key name="ResourceProxy">
            <xs:selector
                xpath="cmd:Resources/cmd:ResourceProxyList/cmd:ResourceProxy"/>
            <xs:field xpath="@id"/>
        </xs:key>
                
        <xs:keyref name="ResourceRef"
            refer="cmd:ResourceProxy">
            <xs:selector xpath=".//*"/>
            <xs:field xpath="@ref"/>
        </xs:keyref>
                
    </xs:element>
</xs:schema>

The problem in CMDI 1.1 is that @ref is defined to be an IDREFS, i.e., a @ref can refer to multiple resource proxies. Unfortunately there is no xs:keyrefs. So to implement this would mean a backwards incompatible change of making @ref an IDREF (again).

To see the impact of this the CMDI records harvested end of August 2013 were loaded into BaseX and queried for @ref referring to multiple resource proxies:

declare namespace cmdi = "http://www.clarin.eu/cmd/";

count(//cmdi:Components[exists(//*[count(tokenize(@ref,'\s+')) > 1])])

And this returns 0, so incorporating this change in version 1.2 will most likely affect any users.