====== Script to modify DC datastream dc:date ======
* Main script:
#!/bin/bash
#
# 1 fedoraAdmin password
while read line; do
lline=${#line}
if [ $lline -gt 0 ]
then
pid="${line%%,*}"
datepages="${line#*,}"
date="${datepages%%,*}"
pages="${datepages#*,}"
echo "$pid $date $pages"
./modificaDSbookepage.sh $pid $date $pages $1
fi
done < "elenco.txt"
exit
* modificaDSbookepage.sh
#!/bin/bash
#
# 1 Book PID
# 2 New date
# 3 N pages
# 4 fedoraAdmin password
#
#es. ./modificaDSbookepage.sh fgramsci:TO024-00001 1984-01 52 password
#
PID=$1
NEWDATE=$2
PAGES=$3
./modificaDCdate.php $PID $NEWDATE
risultato=$(./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http)
if [[ "$risultato" == *Valid* ]]
then
echo "Is Valid ..."
./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http YES
else
echo "ERROR XML: $risultato"
exit
fi
for (( npage=1; npage<=$PAGES; npage++ ))
do
snpage=$(printf "%04d" $npage)
pagePID="$PID""-""$snpage"
echo $pagePID
./modificaDCdate.php $pagePID $NEWDATE
risultato=$(./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http)
if [[ "$risultato" == *Valid* ]]
then
echo "Is Valid ..."
./fedora-modify.sh fc1.to.cnr.it:8080 fedoraAdmin $4 bmodify.xml ../logs/log http YES
else
echo "ERROR XML: $risultato"
exit
fi
done
exit
* modificaDCdate.php
#!/usr/bin/php
This is a command line PHP script with two options.
Usage:
* bmodify.xml example
Sisifo 8 - page 0056
Istituto Gramsci piemontese
sviluppo; industria; welfare; lavoro; sociale; ricerca; innovazione; cultura, Piemonte, Torino
idee, ricerche, programmi dell'Istituto Gramsci piemontese. Settembre 1986
Istituto Gramsci piemontese
Text
fgramsci:TO024-00008-0056
it
1986-09
* elenco.txt example
openbess:TO095-00001,1984-12,4
openbess:TO095-00002,1985-04,4
openbess:TO095-00003,1985-06,4
openbess:TO095-00004,1985-10,4
openbess:TO095-00005,1986-02,4
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
* list books and number of page for collection (ITQL):
select $member3
count(select $pagine from <#ri>
where $pagine $member3
)
from <#ri>
where walk($object
and $member3 $object)
and $member3
order by $member3