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

Andy Reid Andy.Reid at lshtm.ac.uk
Tue Dec 15 10:43:09 GMT 2015


Dear gurus,
I am trying to push documents into existing eprints records, using 
EP3XML, from a staging area in an external publications database.  So
far, using PHPCurl, I have successfully... 
	1.  created new eprints using POST to /id/contents, with 
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, fetching existing
XML,<eprints><eprint>... <documents>, adding a<document> to an existing
<documents>), then pushing it back.  (Or creating <documents> where none
exists). Various errors ensue:
	1.  POSTing <eprints>...</eprints> to /id/eprint/123456 gives
error: METHOD POST not allowed
	2.  PUTting <eprints>...<documents>...</eprints>  to
/id/eprint/123456 has no effect
	3.  PUTting <eprints>...</eprints>  to
/id/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.  Do I maybe have to create the document
first, then link it to the eprint as a separate operation? (Supposing I
could get either of those to work!)

Can someone point me at the eprintXML import DTD, if such a thing
exists - I'm sure I've seen one, but Google ain't finding it.  It would
help if I knew which tags were mandatory.  Or is that all determined by
the local field configuration files?

Is anyone still reading at this point?

TIA

Andy

PS I'm off for Xmas from tonight, but will keep an eye out for replies.
 Sad but true.



This is a sample of what is being sent - the structures all work fine
in the context of creating a new eprint, but not when editing an
existing one:<?xml version='1.0' encoding='utf-8'?><eprints
xmlns='http://eprints.org/ep2/data/2.0'>  <eprint
id='http://researchonline.lshtm.ac.uk/id/eprint/2391518'>   
<eprintid>2391518</eprintid>    <rev_number>5</rev_number>   
<eprint_status>archive</eprint_status>    <userid>498</userid>   
<dir>disk0/02/39/15/18</dir>    <datestamp>2015-12-14
17:52:01</datestamp>    <lastmod>2015-12-14 17:52:19</lastmod>   
<status_changed>2015-12-14 17:52:19</status_changed>   
<type>article</type>    <metadata_visibility>show</metadata_visibility> 
  <title>Incidence of major smoking-related cancers: Trends among adults
aged 20-44 in France from 1982 to 2012.</title>   
<ispublished>pub</ispublished>    <divisions>      <item>EPNC</item>   
</divisions>    <full_text_status>none</full_text_status><!-- Hmm,
perhaps I should edit that? —>    <abstract> Tobacco is currently the
largest risk factor for cancers of the lung, lip/oral cavity/pharynx
(LOCP) and esophagus. Variations in tobacco consumption over time have
led to changes in cancer incidence in the general population. Data on
the incidence of cancers at these sites in adults aged 20-44 years old
are scarce. Our objective was to provide estimates of incidence trends
for these cancers in France among this age group over the last 30 years.
 Observed incidence data over the period 1982-2010 for the 20-44 age
group were provided from six cancer registries (eight for esophagus)
covering approximately 6% of the French population. Age-period-cohort
models were used on the observed period, and estimates of cancer
incidence for France in 2012 were provided on the basis of short-term
predictions.  In men, a sharp decline was observed over time for LOCP
and esophageal cancers, while lung cancer saw only a slight decline. In
women, a large increase was seen in lung cancer incidence, while LOCP
cancer incidence did not vary significantly.  Smoking behaviors among
adults aged 20-44 impact incidence trends in cancers of the lung, LOCP
and esophagus, although other factors are involved, particularly in LOCP
and esophageal cancers. Our results highlight the importance of
preventative efforts which particularly target women aged 20-44. Efforts
to curb tobacco smoking in men should also be pursued. </abstract>   
<date>2015</date>    <date_type>published</date_type>   
<publication>Cancer epidemiology</publication>   
<publisher>Elsevier</publisher>   
<id_number>10.1016/j.canep.2015.07.001</id_number>   
<refereed>TRUE</refereed>    <issn>1877-7821</issn>    <creators>     
<item>        <name>          <family>Gilhodes</family>         
<given>J</given>        </name>      </item>      <item>        <name>  
       <family>Belot</family>          <given>A</given>        </name>  
     <id>Aurelien.Belot at lshtm.ac.uk</id>       
<lshtmid>108164</lshtmid>      </item>      <item>        <name>        
 <family>Bouvier</family>          <given>AM</given>        </name>     
</item>      <item>        <name>          <family>Remontet</family>    
     <given>L</given>        </name>      </item>      <item>       
<name>          <family>Delafosse</family>          <given>P</given>    
   </name>      </item>      <item>        <name>         
<family>Ligier</family>          <given>K</given>        </name>     
</item>      <item>        <name>          <family>Rogel</family>       
  <given>A</given>        </name>      </item>    </creators>   
<publication_abbrev>Cancer Epidemiol</publication_abbrev>   
<eissn>1877-783X</eissn>    <lshtm_pub_id>26209939</lshtm_pub_id>   
<pmid>26209939</pmid>    <isi>363953300007</isi>   
<view_date>2015</view_date>    <view_date_month>2015</view_date_month>  
 <browse_name>Gilhodes, J</browse_name>    <dates>      <item>       
<date>2015</date>        <date_type>published</date_type>      </item>  
 </dates><!-- THIS IS THE BIT I'VE EDITED IN WHICH IS INTENDED TO ADD A
NEW DOCUMENT TO THE EPRINT —>  <documents>	<document>		
<eprintid>2391518</eprintid>  <mime_type></mime_type>  
<format>text</format>   <language>en</language>  
<security>public</security>   <license>cc_by</license>   <main></main>  
<content>accepted</content>          <files>                 <file>     
  <datasetid>document</datasetid>
<filename>Manuscript_141.zip</filename>
<mime_type>application/zip</mime_type>
<hash>524b6d814879ede6f137ee2e57c3a0e3</hash> <hash_type>MD5</hash_type>
<filesize>492458 </filesize> <mtime></mtime>         <data
encoding='base64'>UEsDBBQAAAAIANRpNUd0imTc9oIHAIolCgApAAAAR2lsaG9kZXMtQ2FuRXBpXzIwMTVfV29yZC1BbGwtSW4tT25lLmRvY3js+gOzMMESLYhu27Zt2/vbtm3btm3btm3btm17zrl35s3MezfeH5ipjqjqzszuiI7KVbkyq+SlgEFQAMAAIAAAAAgB6LcASIsBAQCOwAEAkAEggLSE7WydTWyd9ZQ97E2cdOjcbawJCkGAKPIBgAD+3/b/6NacMiU7xIAg8ib+LXxMa6mtThCc2bjfAEIiYHi1mbQ6SL+xlPrLe8RHFKyoqNAYgeJ12zNmRMrc+dFcqi4gvdkVmZMmrOqfpGvBXrO+dTW0H4kKGaI06A6OqiVoyH60lLRwRSVAJX6jOGIafpD5RGKmL0LlAyDG3RKnStAzSgkv5BtOeR91cJ8odYeAA8fgVf9wDmfJyK6+7bf4GErSTklty+7CWWm4aeqje1YTCUH2Ex+OEJ0KZJFHn/05wLrOlFKsvVacAXcRDfVKcpzzA6i1g8zKbAk60hT+TkGj8lASF0lNf5aafHLHRpvdW9sSLJq3I/SMpFio1Vhq7Vo9bzu2N0p4Btnj0xZqBfKF4yN+JnbEUroBT2Rp7tnehm5rS44Q8fuXtaDuJkSijSn+J1f/cBML/g/pGbDe5faf+uBxCXuk3WkO...
ETC ETC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20151215/2bc5a871/attachment.html 


More information about the Eprints-tech mailing list