(: OBSOLETED! date: 22-June-2010 author: Gary Lewis notes: 1. No longer necessary when eliminated the 25 files distinct_unitids_by_year.xml (1 file per year in the time series). 2. See count_distinct_unitids_all_years_v2.xq for more details. :) (: file: gen_xq_distinct_unitids.xq date: 17-May-2010 author: Gary Lewis purpose: Creates a shell script to run distinct_unitids_by_year.xq for each year of IPEDS data. usage: Program should be run from directory in which it is located. Use path locations relative to the program for the locations of the xml data file, ipedsFiles.xml, and the output file. example: zorba -e xml_ipedsFiles:="../xml/metadata/ipedsFiles.xml" -f -q gen_xq_distinct_unitids.xq -o distinct_unitids_by_year.sh -z method=text revision history: 19-May-2010 Gary Lewis Revised to: 1. Use the new directory attribute (dir_ind) in the metadata found in ipedsFiles.xml. See revision history in scrape_ipedsFiles_metadata.xq for details. :) declare variable $xml_ipedsFiles external; for $i in fn:doc($xml_ipedsFiles)/ipedsFiles/file[@dir_ind = "1"] let $csvName := $i/@csvName, $ipedsName := $i/@ipedsName, $year := $i/@year, $title := lower-case($i/@title) return text { concat("zorba -e xml_filename:=", """", "../", $year, "/", $ipedsName, "/", $csvName, ".xml", """", " -e xml_ipedsFiles:=", """", $xml_ipedsFiles, """", " -f -q distinct_unitids_by_year.xq", " -o ../", $year, "/", $ipedsName, "/", "distinct_unitids_by_year.xml", " -z indent=yes", " ") }