Batch SP


cd /var/www/smarch.to.cnr.it/sites/all/modules/
git clone git://github.com/Islandora/islandora_batch
git clone git://github.com/Islandora/islandora_book_batch
drush -u 1 en islandora_batch islandora_book_batch

git clone git://github.com/mjordan/islandora_datastream_crud
drush -u 1 en islandora_datastream_crud


Example:

cd /var/www/smarch.to.cnr.it

drush -v -u 1 --uri=http://smarch.to.cnr.it islandora_book_batch_preprocess --namespace=fabbtext --parent=islandora:bookCollection --content_models=islandora:bookCModel --type=zip --target=/home/user/book/Conte74.zip
drush -v -u 1 --uri=http://smarch.to.cnr.it islandora_batch_ingest

drush -v -u 1 --uri=http://smarch.to.cnr.it islandora_batch_scan_preprocess --content_models=islandora:sp_large_image_cmodel --parent=islandora:sp_large_image_collection --parent_relationship_pred=isMemberOfCollection --type=zip --target=/home/user/001.zip
drush -v -u 1 --uri=http://smarch.to.cnr.it islandora_batch_ingest



Example CSV→DC CRUD

  • spreadsheet with DC elements in columns, multiple values into same cell separated by |
  • convert spreadsheet to CSV using § as field separator
  • run CSV2DC.sh script to convert data into files ready for CRUD replace DS
#!/bin/bash
INPUT=$1
OLDIFS=$IFS
IFS='§'
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read TITLE DATE COVERAGE DESCRIPTION SOURCE SUBJECT CONTRIBUTOR IDENTIFIER CREATOR PUBLISHER TYPE LANGUAGE
do
#	echo $TITLE $DATE $COVERAGE $DESCRIPTION $SOURCE $SUBJECT $CONTRIBUTOR $IDENTIFIER $CREATOR $PUBLISHER $TYPE $LANGUAGE
	FNAME=${IDENTIFIER//:/_}
	shopt -s extglob
	FNAME="${FNAME##*( )}"
	FNAME="${FNAME%%*( )}"
	shopt -u extglob
	FNAME=$FNAME'_DC.xml'
	touch $FNAME
 
	echo '<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" 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">' > $FNAME
 
#title
	echo '<dc:title>'$TITLE'</dc:title>' >> $FNAME	
 
#date
	echo '<dc:date>'$DATE'</dc:date>' >> $FNAME
 
#description
	IFS='|' read -ra ELEM <<< "$DESCRIPTION"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:description>'$i'</dc:description>' >> $FNAME
 
	done
	IFS='§'
 
#coverage
	IFS='|' read -ra ELEM <<< "$COVERAGE"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:coverage>'$i'</dc:coverage>' >> $FNAME
 
	done
	IFS='§'
 
#source
	IFS='|' read -ra ELEM <<< "$SOURCE"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:source>'$i'</dc:source>' >> $FNAME
 
	done
	IFS='§'
 
#subject
	IFS='|' read -ra ELEM <<< "$SUBJECT"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:subject>'$i'</dc:subject>' >> $FNAME
 
	done
	IFS='§'
 
#contributor
	IFS='|' read -ra ELEM <<< "$CONTRIBUTOR"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:contributor>'$i'</dc:contributor>' >> $FNAME
 
	done
	IFS='§'
 
#creator
	IFS='|' read -ra ELEM <<< "$CREATOR"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:creator>'$i'</dc:creator>' >> $FNAME
 
	done
	IFS='§'
 
#publisher
	IFS='|' read -ra ELEM <<< "$PUBLISHER"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:publisher>'$i'</dc:publisher>' >> $FNAME
 
	done
	IFS='§'
 
#type
	IFS='|' read -ra ELEM <<< "$TYPE"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:type>'$i'</dc:type>' >> $FNAME
 
	done
	IFS='§'
 
#language
	IFS='|' read -ra ELEM <<< "$LANGUAGE"
	for i in "${ELEM[@]}"; do
 
		echo '<dc:language>'$i'</dc:language>' >> $FNAME
 
	done
	IFS='§'
 
 
	echo '</oai_dc:dc>' >> $FNAME
 
done < $INPUT
IFS=$OLDIFS
  • Run CRUD replace DS
 
 
isla7x/batch.txt · Last modified: 2016/10/14 18:01 by giancarlo

Developers: CNR IRCrES IT Office and Library
Giancarlo Birello (giancarlo.birello _@_ ircres.cnr.it) and Anna Perin (anna.perin _@_ ircres.cnr.it)
FAbb@TO.CNR 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