Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
repo:dcdate [2012/07/12 12:26]
giancarlo
repo:dcdate [2012/07/12 12:34]
giancarlo
Line 11: Line 11:
  if [ $lline -gt 0 ]  if [ $lline -gt 0 ]
  then  then
- pid="${line%%,*}" +   pid="${line%%,*}" 
- datepages="${line#*,}" +   datepages="${line#*,}" 
- date="${datepages%%,*}" +   date="${datepages%%,*}" 
- pages="${datepages#*,}" +   pages="${datepages#*,}" 
-      echo "$pid $date $pages" +          echo "$pid $date $pages" 
-     ./modificaDSbookepage.sh $pid $date $pages $1 +          ./modificaDSbookepage.sh $pid $date $pages $1 
-   fi+        fi
 done < "elenco.txt" done < "elenco.txt"
 exit exit
Line 43: Line 43:
 if [[ "$risultato" == *Valid* ]] if [[ "$risultato" == *Valid* ]]
 then  then 
- echo "Is Valid ..." +   echo "Is Valid ..."
    ./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http YES    ./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http YES
 else  else 
- echo "ERROR XML: $risultato" +   echo "ERROR XML: $risultato" 
- exit+   exit
 fi fi
 for (( npage=1; npage<=$PAGES; npage++ )) for (( npage=1; npage<=$PAGES; npage++ ))
 do do
- snpage=$(printf "%04d" $npage) +   snpage=$(printf "%04d" $npage) 
- pagePID="$PID""-""$snpage"+   pagePID="$PID""-""$snpage"
    echo $pagePID    echo $pagePID
- ./modificaDCdate.php $pagePID $NEWDATE +   ./modificaDCdate.php $pagePID $NEWDATE 
- risultato=$(./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http)+   risultato=$(./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http)
    if [[ "$risultato" == *Valid* ]]    if [[ "$risultato" == *Valid* ]]
- then  +   then  
- echo "Is Valid ..." +      echo "Is Valid ..."
       ./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http YES       ./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http YES
- else  +   else  
- echo "ERROR XML: $risultato" +      echo "ERROR XML: $risultato" 
-   exit+      exit
    fi    fi
 done done
Line 69: Line 69:
 </WRAP> </WRAP>
  
-  * a+  * modificaDCdate.php
  
 <WRAP prewrap center> <WRAP prewrap center>
-<code bash>+<code php> 
 +#!/usr/bin/php 
 +<?php 
 +if ($argc != 3 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) { 
 +?> 
 + 
 +This is a command line PHP script with two options. 
 + 
 +  Usage: 
 +  <?php 
 +    echo $argv[0]; ?> <option> 
 + 
 +  <option> can be some word you would like 
 +  to print out. With the --help, -help, -h, 
 +  or -? options, you can get this help. 
 + 
 +<?php 
 +    exit; 
 +} else { 
 +    $PID = $argv[1]; 
 +    $Nuovadata = $argv[2]; 
 +
 +$indoc = new DOMDocument(); 
 +$indoc->formatOutput = true; 
 +$indoc->preserveWhiteSpace = false; 
 +$indoc->load('http://fc1.to.cnr.it:8080/fedora/objects/' . $PID . '/datastreams/DC/content'); 
 +$innode = $indoc->getElementsByTagNameNS('http://www.openarchives.org/OAI/2.0/oai_dc/', 'dc')->item(0); 
 +$dcdate = $innode->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/', 'date')->item(0); 
 +$olddcdate = $innode->removeChild($dcdate); 
 +print_r($dcdate->nodeValue . " <- " . $Nuovadata . "\n"); 
 +$newdate = $indoc->createElement('dc:date', $Nuovadata); 
 +$innode->appendChild($newdate); 
 +$dom = new DOMDocument('1.0', 'utf-8'); 
 +$dom->formatOutput = true; 
 +$dom->preserveWhiteSpace = false; 
 +$element = $dom->createElement('fbm:batchModify'); 
 +$element->setAttribute('xmlns:fbm', 'http://www.fedora.info/definitions/'); 
 +$element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); 
 +$element->setAttribute('xsi:schemaLocation', 'http://www.fedora.info/definitions/ http://www.fedora-commons.org/definitions/1/0/api/batchModify-1.1.xsd'); 
 +$dom->appendChild($element); 
 +$element1 = $dom->createElement('fbm:modifyDatastream'); 
 +$element1->setAttribute('pid', $PID); 
 +$element1->setAttribute('dsID', 'DC'); 
 +$element1->setAttribute('dsControlGroupType', 'X'); 
 +$element1->setAttribute('logMessage', 'BatchModify - modifyDatastream'); 
 +$element->appendChild($element1); 
 +$element2 = $dom->createElement('fbm:xmlData'); 
 +$element1->appendChild($element2); 
 +$newnode = $dom->importNode($innode, true); 
 +$element2->appendChild($newnode); 
 +// print $dom->saveXML()."\n"; 
 +// print "======================"."\n"; 
 +print 'Wrote: ' . $dom->save("bmodify.xml") . ' bytes' . "\n"; 
 +?>
 </code> </code>
 </WRAP> </WRAP>
  
-  * b+  * bmodify.xml example
  
 <WRAP prewrap center> <WRAP prewrap center>
-<code bash>+<code xml> 
 +<?xml version="1.0" encoding="utf-8"?> 
 +<fbm:batchModify xmlns:fbm="http://www.fedora.info/definitions/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fedora.info/definitions/ http://www.fedora-commons.org/definitions/1/0/api/batchModify-1.1.xsd"> 
 +  <fbm:modifyDatastream pid="fgramsci:TO024-00008-0056" dsID="DC" dsControlGroupType="X" logMessage="BatchModify - modifyDatastream"> 
 +    <fbm:xmlData> 
 +      <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> 
 +        <dc:title>Sisifo  8 - page 0056</dc:title> 
 +        <dc:creator>Istituto Gramsci piemontese</dc:creator> 
 +        <dc:subject>sviluppo; industria; welfare; lavoro; sociale; ricerca; innovazione; cultura, Piemonte, Torino</dc:subject> 
 +        <dc:description>idee, ricerche, programmi dell'Istituto Gramsci piemontese. Settembre 1986</dc:description> 
 +        <dc:publisher>Istituto Gramsci piemontese</dc:publisher> 
 +        <dc:type>Text</dc:type> 
 +        <dc:format/> 
 +        <dc:identifier>fgramsci:TO024-00008-0056</dc:identifier> 
 +        <dc:language>it</dc:language> 
 +        <dc:date>1986-09</dc:date> 
 +      </oai_dc:dc> 
 +    </fbm:xmlData> 
 +  </fbm:modifyDatastream> 
 +</fbm:batchModify>
 </code> </code>
 </WRAP> </WRAP>
  
-  * c+  * elenco.txt example
  
 <WRAP prewrap center> <WRAP prewrap center>
-<code bash>+<code> 
 +openbess:TO095-00001,1984-12,
 +openbess:TO095-00002,1985-04,
 +openbess:TO095-00003,1985-06,
 +openbess:TO095-00004,1985-10,
 +openbess:TO095-00005,1986-02,
 +openbess:TO095-00006,1986,16 
 +openbess:TO095-00007,1987,12 
 +openbess:TO095-00008,1987,16 
 +openbess:TO095-00009,1987,16 
 +openbess:TO095-00010,1988,16 
 +openbess:TO095-00011,1988,16 
 +openbess:TO095-00012,1989,16 
 +openbess:TO095-00013,1989,16 
 +openbess:TO095-00014,1990,16 
 +openbess:TO095-00015,1991-05,24 
 +openbess:TO095-00016,1991-11,24 
 +openbess:TO095-00017,1992-04,24
 </code> </code>
 </WRAP> </WRAP>
 
 
repo/dcdate.txt · Last modified: 2012/07/12 15:11 by giancarlo

Developers: CNR IRCrES IT Office and Library
Giancarlo Birello (giancarlo.birello _@_ ircres.cnr.it) and Anna Perin (anna.perin _@_ ircres.cnr.it)
DigiBess is licensed under: Creative Commons License
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki