Chris@23: #!/bin/bash Chris@23: Chris@23: # Rebuild the RDF database of composers, works, etc. Chris@23: Chris@23: # Do not use this script. Once the database is built, we need to be Chris@23: # able to carry out manual editing, disambiguation etc without risking Chris@23: # losing our changes in a future rebuild. Following the initial build Chris@23: # and publication, we really need to ensure that updates can be made Chris@23: # without a complete rebuild. Chris@23: Chris@23: # Perhaps we will need to make partial rebuild scripts (importing some Chris@23: # new type of data that was not in the database at all before, for Chris@23: # example) based on this. Chris@23: Chris@23: # All that said, this script is provided anyway for purposes of review Chris@23: # and reproducability. Chris@23: Chris@23: echo "Running importer, log is written to importer.log" Chris@23: Chris@25: #./importer 2>importer.log || exit 1 Chris@23: Chris@23: echo "Assembling additional sources" Chris@23: Chris@23: rm -f ready.ntriples Chris@23: Chris@23: for ttl in \ Chris@23: imported.ttl \ Chris@23: extra/cmn.ttl \ Chris@23: extra/composer-mappings.ttl \ Chris@23: extra/conductors.ttl \ Chris@23: extra/new-names.ttl \ Chris@23: extra/pianists-dbpedia.ttl \ Chris@23: extra/styles.ttl ; do Chris@23: cat extra/prefixes.ttl "$ttl" | rapper -i turtle -o ntriples - http://dbtune.org/classical/resource/ >> ready.ntriples Chris@23: done Chris@23: Chris@25: sort ready.ntriples | uniq > ready.2.ntriples && mv ready.2.ntriples ready.ntriples Chris@24: Chris@23: grep composer ready.ntriples | fgrep -v .html | sed 's/^.*composer\///' | \ Chris@24: sed 's/>.*//' | grep -v http | sort | uniq > check/new-composer-uris Chris@23: Chris@23: diff -u check/composer-uris check/new-composer-uris | grep -v '^---' | grep -v '^+++' > /tmp/$$ Chris@23: Chris@23: added=`grep '^+' /tmp/$$ | wc -l | awk '{ print $1; }'` Chris@23: removed=`grep '^-' /tmp/$$ | wc -l | awk '{ print $1; }'` Chris@23: Chris@23: echo "Done, result is in ready.ntriples" Chris@23: echo Chris@23: echo "Composer URI comparison:" Chris@23: echo "Added: $added" Chris@23: echo "Removed: $removed" Chris@23: Chris@23: rm /tmp/$$