1
|
#!/bin/bash
|
2
|
# Matt Jones
|
3
|
# Metacat query using WGET to launch the query and an XSL document to
|
4
|
# transform it into a comma-separated text file
|
5
|
# 26 August 2005
|
6
|
# '$Id: run-query.sh 2821 2005-12-08 22:02:06Z jones $'
|
7
|
LIB=../../lib
|
8
|
PARSER=$LIB/xalan/xalan.jar:$LIB/xercesImpl.jar:$LIB/xalan/xml-apis.jar
|
9
|
TEMP=temp.xml
|
10
|
STYLE=wg-data-list.xsl
|
11
|
OUT=nceas-packages.txt
|
12
|
QUERY=http://knb.ecoinformatics.org/knb/metacat?action=query\&operator=INTERSECT\&organizationName=National%20Center%20for%20Ecological%20Analysis%20and%20Synthesis\&qformat=xml\&returndoctype=eml://ecoinformatics.org/eml-2.0.0\&returndoctype=eml://ecoinformatics.org/eml-2.0.1\&returndoctype=-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN\&returndoctype=-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN\&returnfield=originator/organizationName\&returnfield=creator/organizationName
|
13
|
wget -O $TEMP $QUERY
|
14
|
echo "Query finished. Transforming XML results to CSV format..."
|
15
|
java -cp $PARSER org.apache.xalan.xslt.Process -IN $TEMP -XSL $STYLE -OUT $OUT
|
16
|
rm $TEMP
|
17
|
echo "Done. Results are in file \"$OUT\"."
|