| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #!/bin/bash
- #fin=(ParkingGR.xlsx.json Greece Trnasportation)
- file_in="/Data/citadel.csv"
- file_out="/Data/citadel.xml"
- function element() {
- h3=${h7//\"/$h5}
- h3=${h3#*$1+:+}
- h3=${h3%%+*}
- echo "<$2>${h3}</$2>" >> $file_out
- }
- IFS="*"
- while read link country waze osm comment
- do
- echo $link
- file_name=../Temp/${link##*/}
- #echo $file_name
- echo $country
- echo $waze
- file_out="../Temp/temporary.xml"
- #file_out="../Temp/"${comment}'.xml'
- #echo $file_out
- #cd ../Temp/
- wget -P ../Temp/ --output-document=../Temp/temporary1.json ${link}
- sed -r 's/&+/&/g' ../Temp/temporary1.json > ../Temp/temporary.json
- #awk 'BEGIN { FS="&"; OFS="and" } {$1=$1; print}' ../Temp/temporary1.json > ../Temp/temporary.json
- echo '<?xml version="1.0"?>' > $file_out
- echo '<Root name="'${comment}'" country="'${country}'" waze="'${waze}'" osm="'${osm}'">' >> $file_out
- input=${file_name[0]}
- #read -r line < ${file_name[0]}
- read -r line < ../Temp/temporary.json
- h1="*"
- h5="+"
- line=${line//'},{'/$h1}
- line=${line//':[{'/$h1}
- IFS='*' read -r -a array <<< "$line"
- echo ${array[0]}
- h7=${array[0]//\"/$h5}
- idset=${h7%%,*}
- echo $id
- idset=${idset##*:}
- echo $id
- echo '<id>'${h3}'</id>' >> $file_out
- for ((i=1; i < ${#array[@]}; i++))
- do
- echo '<Item>' >> $file_out
- echo '<idset>'$idset'</idset>' >> $file_out
- h7=${array[i]//\"/$h5}
- element id id
- element title label
- element value addr_city
- element posList coord
- echo '</Item>' >> $file_out
- done
- echo '</Root>' >> $file_out
- java -Djava.io.tmpdir=../Temp -Xms2560m -Xmx24560m -jar saxon9he.jar -s:../Temp/temporary.xml -xsl:../XSLT/transform_citadel.xsl -o:../RDF_output/${comment}_Citadel.rdf -t
- done < $file_in
- cd
|