Notes‎ > ‎

PROD RDF

posted 9 Feb 2012, 01:54 by David Sherlock   [ updated 9 Feb 2012, 02:04 ]
I wrote a bash script to grab all the PROD projects and bung them into a TALIS/Kasbi store. Because I am constantly forgetting what I've done I'll leave it here (minus the log in details). Writing bashscripts makes me feel manly. Wilbert bungs some extra stuff into the store so it might be worth expanding to grab some of his other stuff too,

 #!/bin/bash

curl http://prod.cetis.ac.uk/models/projects.rdf > projects.xml
substr=http://prod.cetis.ac.uk

while IFS= read -r string; 
do 

case $string in
     *"$substr"*) id=$(echo "$string" |  awk -F\" '{print $(NF-1)}' | cut -c34-) 
     curl http://prod.cetis.ac.uk/projects/$id.rdf >  $id.rdf
esac
done < projects.xml

for f in *.rdf;

do echo "Processing $f file..";
curl -v --digest -u "username:password" -H "Content-type:application/rdf+xml" --data @$f http://api.talis.com/stores/jisc-prod-dev1/meta

done


Comments