/
grindstone
executable file
·44 lines (36 loc) · 1.15 KB
/
grindstone
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
#
# usage:
usage="usage: `basename $0` [-con {raw,e1}] datasetIdentifier ...\n\
\n\
combine automatic/*.raw.ttl into publish/SSS-DDD-VVV.raw.nt for the requested datasets.\n\
\n\
-con: conversion identifier to publish (raw, e1, e2, ...) (default: raw)\n\
\n\
This is run from data.gov/ (where directories 9, 10, 32, ... reside)."
if [ $# -lt 1 ]; then
echo $usage
exit 1
fi
con=raw
if [ "$1" == "-con" ]; then
con="$2"
shift 2
fi
CSV2RDF4LOD_HOME=${CSV2RDF4LOD_HOME:?"must be set. source csv2rdf4lod/source-me.sh."}
formats=${formats:?"must be set. source csv2rdf4lod/source-me.sh"}
source=`basename \`pwd\` | sed 's/\./-/g'`
while [ $# -gt 0 ]; do
datasetIdentifier=$1
autoDir=`find $datasetIdentifier -type d -depth 3 -name automatic | head -1`
versionDir=`dirname $autoDir`
version=`basename \`dirname $autoDir\``
convertSH=`find $versionDir -name "convert*.sh"`
if [ ${#convertSH} ]; then
echo "$source $datasetIdentifier $version"
echo "pushd $versionDir; source `basename $convertSH`; popd;"
else
echo $datasetIdentifier: skipping b/c could not find directory 'automatic'
fi
shift
done