This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
let $results := | |
for $trip in collection('/db/cms/apps/travels/data/secretaries')/trips/trip[country/@id = 'israel'] | |
let $duration := days-from-duration(sum($trip ! (./xs:date(end-date) - ./xs:date(start-date) + xs:dayTimeDuration('P1D')))) | |
group by $secretary := $trip/name | |
return | |
<trips secretary="{$secretary}" trips="{count($trip)}" days="{$duration}">{ | |
$trip ! | |
<trip>{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
import module namespace functx="http://www.functx.com"; | |
(: Prepare XFDF data to use with PDFtk to populate a blank form SF702, | |
e.g., http://www.archives.gov/isoo/security-forms/sf702.pdf, | |
with data for each month of the year :) | |
let $data-collection := xmldb:create-collection('/db', 'sf702') | |
let $year := 2014 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml-model href="../../schemas/frus.rnc" type="application/relax-ng-compact-syntax"?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
declare function local:days-since-date($date as xs:date) { | |
let $duration := current-date() - $date | |
let $days := days-from-duration($duration) | |
return | |
$days | |
}; | |
local:days-since-date(xs:date('2012-10-12')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Displays a list of Principals & Chiefs hailing from Massachusetts. :) | |
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; | |
declare option output:method "html5"; | |
declare option output:media-type "text/html"; | |
let $all-people := collection('/db/cms/apps/principals-chiefs/data/')/person | |
let $state := 'ma' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Displays a list of Principals & Chiefs whose positions ended after a certain date. :) | |
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; | |
declare option output:method "html5"; | |
declare option output:media-type "text/html"; | |
let $all-people := collection('/db/cms/apps/principals-chiefs/data/')/person | |
let $cut-off := '2008-06-01' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Transform volumes from the FRUS series (TEI XML) into a zip file containing JSON and text files | |
formatted for Bookworm http://bookworm.culturomics.org/. The resulting data can be accessed at: | |
http://static.history.state.gov/temp/frus-all.zip (140 MB) | |
A link to the running demo of the resulting data awaits fixes to the bookworm server, | |
but @bmschmidt kindly posted one volume's worth of data at | |
http://benschmidt.org/joewiz/ | |
:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
This is a sample data file for capturing coterminous appointments | |
Store in the /db/cms/apps/principals-chiefs/data/coterminous-appointments collection. | |
The rule for deriving the file's <id> (and file basename) is to join the following elements with a hyphen: | |
YYYY: the year of the first appointment | |
ABCD: the first four letters of the appointee's last name (unless fewer than 4 letters | |
NN: usually 01, but increment to 02, 03, etc. to prevent id collisions | |
In this example: | |
2012: all appointments started in 2012 | |
palm: from Palmer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){window.location=loadTimeData.data_.summary.failedUrl.replace(/.*\?url=/,'');})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Examine query duration from JMX logs collected by monex :) | |
declare namespace jmx="http://exist-db.org/jmx"; | |
declare function local:milliseconds-to-time($timestamp as xs:long) as xs:dateTime { | |
let $days := xs:int($timestamp div 1000 div 24 div 60 div 60) | |
let $remainder := $timestamp - ($days * 24 * 60 * 60 * 1000) | |
let $hours := xs:int($remainder div 1000 div 60 div 60) |
OlderNewer