#!/bin/bash # Invoke the FISE stateless service and get RDF descriptions # POST files in folder {1} and saves output in folder {2} # Input files are intendeed to be text/plain and have .txt extension # For each .txt file, a related .uri file must exist, which contains the URI to be given the content-item # FISE instance can be set: $fise # Wait between two requests $slp seconds fise="http://localhost:8080/engines" slp=0.1 directory=${1} if [[ $directory = "" ]]; then directory="./" fi directory=`cd $directory; pwd;` outdir=${2} if [[ $outdir = "" ]]; then outdir="./" fi outdir=`cd $outdir; pwd;` echo Post files in dir: $directory echo Save rdf in dir: $outdir cd $directory ls|grep .txt |while read fname do rdfname=$(echo $fname|sed -e 's/\.txt/.rdf/') outname="$outdir/$rdfname" if [[ -f $outname ]] then echo Skipping $fname : out file exists! else sleep $slp furi=$(echo $fname|sed -e 's/\.txt/.uri/') uri=`cat $furi` echo Getting enhancements of $uri and saving it to $outname curl -X POST -H "Accept: application/rdf+xml" -H "Content-type: text/plain" -d @$fname "$fise?uri=$uri" > $outname fi done