Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions blazegraph-deb/src/deb/bin/loadRestAPI.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
#!/bin/bash

FILE_OR_DIR=$1

[ -f /etc/default/blazegraph ] && . /etc/default/blazegraph
if [ "$1" == "" -o "$1" == "-h" -o "$1" == "--help" ]; then
echo "Usage: $0 {file_or_directory} [{graph_namespace}]"
exit
else
FILE_OR_DIR=$1
fi

if [ ! -z "$2" ]; then
NAMESPACE=$2
else
NAMESPACE=kb
fi

[ -f /etc/default/blazegraph ] && source /etc/default/blazegraph
[ -z "$JETTY_PORT" ] && JETTY_PORT=9999

LOAD_PROP_FILE=/tmp/$$.properties
[ -z "${NSS_PROPERTIES}" ] && NSS_PROPERTIES=/etc/blazegraph/RWStore.properties

[ -z "${NSS_PROPERTIES}" ] && NSS_PROPERTIES=/etc/blazegraph
export NSS_DATALOAD_PROPERTIES=${NSS_PROPERTIES}

export NSS_DATALOAD_PROPERTIES="${NSS_PROPERTIES}/RWStore.properties"
BG_URL="http://localhost:${JETTY_PORT}/blazegraph/dataloader"

LOAD_PROP_FILE=/tmp/$$.properties

#Probably some unused properties below, but copied all to be safe.

cat <<EOT >> $LOAD_PROP_FILE
cat <<EOT > $LOAD_PROP_FILE
quiet=false
verbose=0
closure=false
Expand All @@ -24,18 +37,20 @@ com.bigdata.rdf.store.DataLoader.flush=false
com.bigdata.rdf.store.DataLoader.bufferCapacity=100000
com.bigdata.rdf.store.DataLoader.queueCapacity=10
#Namespace to load
namespace=kb
namespace=${NAMESPACE}
#Files to load
fileOrDirs=$1
fileOrDirs=${FILE_OR_DIR}
#Property file (if creating a new namespace)
propertyFile=$NSS_DATALOAD_PROPERTIES
EOT

echo "Loading with properties..."

cat $LOAD_PROP_FILE
echo "Submitting to loader at: ${BG_URL}"
echo "Submitting with properties..."
cat ${LOAD_PROP_FILE}
echo

curl -X POST --data-binary @${LOAD_PROP_FILE} --header 'Content-Type:text/plain' http://localhost:${JETTY_PORT}/blazegraph/dataloader
curl -X POST --data-binary @${LOAD_PROP_FILE} --header 'Content-Type:text/plain' ${BG_URL}
echo

#Let the output go to STDOUT/ERR to allow script redirection

Expand Down