EPrints Technical Mailing List Archive

Message: #05272

< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Adding document to existing eprint via SWORD+EP3XML?

Dear gurus,
I am trying to push documents into existing eprints records, from a staging area in an external publications database.  So far I have successfully
  1. created new eprints using POST to /id/contents, with or without embedded documents
  2. edited existing eprint metadata by fetching the XML, editing it programatically, and PUTting it back to /id/eprint/123456
What I am failing to do is the next stage up, fetching existing XML,<eprints><eprint>... <documents>, adding<document> to an existing <documents>), then pushing it back.  (Or creating <documents> where none exists)
  1. POSTing <eprints>...</eprints> to /id/eprint/123456 gives error: METHOD POST now allowed
  2. PUTting <eprints>...<documents>...</eprints>  to /id/eprint/123456 has no effect
  3. PUTting <eprints>...</eprints>  to /is/eprint/123456/contents  gives an XMLparse  error saying 'Expected <documents>, found <eprints>'
  4. PUTting <documents>..</documents>  to /id/eprint/123456  gives an XMLparse error saying 'Expected <eprints>found <documents>,
  5. PUTting <documents>..</documents> to /id/eprint/123456/contents deletes the eprint record and creates an new one containing the document but no metadata, as you would expect 
  6. PUTting <eprints><documents>..</documents></eprints> to /id/eprint/123456  wipes metadata and fails to upload document
There are probably other permutations I haven't tried on these variables, but somebody might be able to save me some time if they can spot where I'm going wrong :
  • What if I PUT or POST a document to /id/document  and specify <eprintid> within the document metadata? Will that create the document and link it to the eprint?
  • I'm unclear in general what is the function of the <eprintid> within the document, given that the eprintid is already clear from the URL and the embedded position of the <document> tag within the <eprint>. 
  • More generally, implicit in the previous question, I am unclear whether the <eprint><document><file> hierarchy is a strict tree, where a child can only have one parent, or is it possible for a document to be referenced by more than one eprint? The presence of <eprintid> within the export <document tag would seem to imply the strict interprtation, but I can find that stated anywhere.