swordapp / JavaClient2.0

A Java implementation of the SWORDv2 client responsibilities
http://www.swordapp.org
Other
8 stars 10 forks source link

Collection Partial Lists #3

Open sebhofmann opened 9 years ago

sebhofmann commented 9 years ago

In Atom-Pub its possible to get partitial lists of collections, the swordv2 spec contains no statement that its forbidden to use partial lists, so i have to assume that its okay to use them. (http://www.ietf.org/rfc/rfc5023.txt -> 10.1. Collection Partial Lists)

My Col-IRI looks like this:

GET http://localhost:8291/sword2/col/DefaultModsCollection/
...
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <link href="http://localhost:8291/sword2/col/DefaultModsCollection/1" rel="first"/>
  <link href="http://localhost:8291/sword2/col/DefaultModsCollection/2" rel="next"/>
  <link href="http://localhost:8291/sword2/col/DefaultModsCollection/2" rel="last"/>
<generator uri="http://www.swordapp.org/" version="2.0"/>
  <entry xmlns:app="http://www.w3.org/2007/app">
    <id>mods_00000001</id>
    ....
  </entry>
  <entry xmlns:app="http://www.w3.org/2007/app">
    <id>mods_00000002</id>
   ...
  </entry>
</feed>

For testing i have a limit of 2 entrys. If i make a second request:

GET http://localhost:8291/sword2/col/DefaultModsCollection/2
...
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <link href="http://localhost:8291/sword2/col/DefaultModsCollection/1" rel="first"/>
  <link href="http://localhost:8291/sword2/col/DefaultModsCollection/2" rel="last"/>
  <generator uri="http://www.swordapp.org/" version="2.0"/>
  <entry xmlns:app="http://www.w3.org/2007/app">
    <id>mods_00000003</id>
    ...
  </entry>
  <entry xmlns:app="http://www.w3.org/2007/app">
    <id>mods_00000004</id>
    ...
 </entry>
</feed>

If i now try to list the collection, then i only get mods_00000001 and mods_00000002. The API only respects the current document and ignores the next link.

// col = http://localhost:8291/sword2/col/DefaultModsCollection
final CollectionEntries collectionEntries = client.listCollection(col);
                    collectionEntries.getEntries().forEach(e-> {
                       System.out.println(e.getTitle() + "[" + e.getId() + "]");
                    });

Should the API handle this or should the user of JavaClient handle this ? Is it unusual to do this in SwordV2 ?