You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2015/07/07 14:53:09 UTC

[10/18] jena git commit: Ensure data file paths are absolute (JENA-977)

Ensure data file paths are absolute (JENA-977)

This commit improves the tdbloader2 script to ensure that data file
paths are made absolute and any symbolic links are resolved.


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/f64dbdcb
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/f64dbdcb
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/f64dbdcb

Branch: refs/heads/master
Commit: f64dbdcb6ac77cfb6654916e43797fdca3d4fb5c
Parents: d4a0bc5
Author: Rob Vesse <rv...@apache.org>
Authored: Tue Jun 30 15:33:09 2015 +0100
Committer: Rob Vesse <rv...@apache.org>
Committed: Tue Jun 30 15:33:09 2015 +0100

----------------------------------------------------------------------
 apache-jena/bin/tdbloader2data | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/f64dbdcb/apache-jena/bin/tdbloader2data
----------------------------------------------------------------------
diff --git a/apache-jena/bin/tdbloader2data b/apache-jena/bin/tdbloader2data
index f942e20..ab0fe87 100755
--- a/apache-jena/bin/tdbloader2data
+++ b/apache-jena/bin/tdbloader2data
@@ -191,8 +191,6 @@ if [ ! -d "$LOC" ]; then
   abort 1 "Database location is not a directory: $LOC"
 fi
 
-FILES="$@"
-
 ## Prepare JVM Arguments
 JVM_ARGS=${JVM_ARGS:--Xmx1200M}
 debug "JVM Arguments are $JVM_ARGS"
@@ -205,6 +203,32 @@ fi
 # ---- Data loading phase
 info "Data Load Phase"
 
+# Prepare Files
+FILES=()
+F=0
+while [ $# -gt 0 ]; do
+  FILE=$1
+  shift
+
+  ABS_FILE=$(makeAbsolute "$FILE")
+  if [ "$FILE" != "$ABS_FILE" ]; then
+    # Relative path was resolved
+    FILES[$F]="$ABS_FILE"
+    debug "Relative data file $FILE was resolved to absolute data file $ABS_FILE"
+  else
+    # Already absolute
+    FILES[$F]="$FILE"
+  fi
+
+  F=$(($F + 1))
+done
+info "Got ${#FILES[@]} data files to load"
+F=1
+for file in ${FILES[@]}; do
+  info "Data file $F: $file"
+  F=$(($F + 1))
+done
+
 # Produce nodes file and triples/quads text file.
 DATA_TRIPLES="$LOC/data-triples.tmp"
 DATA_QUADS="$LOC/data-quads.tmp"
@@ -213,6 +237,6 @@ debug "Triples text files is $DATA_TRIPLES"
 debug "Quads text file is $DATA_QUADS"
 
 java $JVM_ARGS -cp "$JENA_CP" "$PKG".CmdNodeTableBuilder \
-    "--loc=$LOC" "--triples=$DATA_TRIPLES" "--quads=$DATA_QUADS" $FILES
+    "--loc=$LOC" "--triples=$DATA_TRIPLES" "--quads=$DATA_QUADS" "${FILES[@]}"
 
 info "Data Load Phase Completed"