Further tweak new tdbloader2 scripts (JENA-977) - Add proper usage to tdbloader2 - Check for temporary data files needed for index phase in tdbloader2index
Project: http://git-wip-us.apache.org/repos/asf/jena/repo Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/7b61a144 Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/7b61a144 Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/7b61a144 Branch: refs/heads/JENA-977 Commit: 7b61a144854d81acbd180b5debfd5c8638d2af57 Parents: d92e336 Author: Rob Vesse <[email protected]> Authored: Thu Jun 25 17:04:36 2015 +0100 Committer: Rob Vesse <[email protected]> Committed: Fri Jun 26 16:30:45 2015 +0100 ---------------------------------------------------------------------- apache-jena/bin/tdbloader2 | 35 ++++++++++++++++++++++++++++++++--- apache-jena/bin/tdbloader2index | 9 +++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jena/blob/7b61a144/apache-jena/bin/tdbloader2 ---------------------------------------------------------------------- diff --git a/apache-jena/bin/tdbloader2 b/apache-jena/bin/tdbloader2 index 37cc874..34ee029 100755 --- a/apache-jena/bin/tdbloader2 +++ b/apache-jena/bin/tdbloader2 @@ -15,6 +15,30 @@ ## See the License for the specific language governing permissions and ## limitations under the License. +function printUsage() { + cat << EOF +Usage: tdbloader2 <Options> <Data> + +Options are as follows: + + --help + Prints this help summary and exits + + --loc <DatabaseDirectory> + Sets the location in which the database should be created + + --phase <Phase> + Sets the phase of the build to run, supported values are: + + all Full bulk load + data Data phase only + index Index phase only, requires the data phase to previously have been run + + When not specified defaults to all + +EOF +} + # If JENA_HOME is empty if [ -z "$JENA_HOME" ] then @@ -48,7 +72,7 @@ case "$(uname)" in esac export JENA_CP -echo $JENA_CP +#echo $JENA_CP if [ -z "$SORT_ARGS" ] then SORT_ARGS="--buffer-size=50%" @@ -84,6 +108,11 @@ do PHASE="$1" shift ;; + --help) + # Help + printUsage + exit 0 + ;; *) # Once we see an unrecognized argument treat as start of files to process break @@ -95,8 +124,8 @@ if [ -z "$PHASE" ]; then PHASE="all" fi -echo "Location is '$LOC'" -echo "Phase is '$PHASE'" +#echo "Location is '$LOC'" +#echo "Phase is '$PHASE'" log() { echo " $(date $DATE)" "$@" ; } http://git-wip-us.apache.org/repos/asf/jena/blob/7b61a144/apache-jena/bin/tdbloader2index ---------------------------------------------------------------------- diff --git a/apache-jena/bin/tdbloader2index b/apache-jena/bin/tdbloader2index index 372aa5c..5624854 100755 --- a/apache-jena/bin/tdbloader2index +++ b/apache-jena/bin/tdbloader2index @@ -80,6 +80,15 @@ KEEPWORKFILES="${KEEPWORKFILES:-}" DATA_TRIPLES="$LOC/data-triples.tmp" DATA_QUADS="$LOC/data-quads.tmp" +if [ ! -e "$DATA_TRIPLES" ] ; then + echo "No triples data file found in location, please run the tdbloader2data script first" + exit 1 +fi +if [ ! -e "$DATA_QUADS" ]; then + echo "No quads data file found in location, please run the tdbloader2data script first" + exit 1 +fi + # ---- Index intermediates ## All files are writtern S P O / G S P O columns per row but in different sort orders. log "Index Building Phase"
