Skip to content

Instantly share code, notes, and snippets.

@joewiz
Created September 5, 2013 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joewiz/6449964 to your computer and use it in GitHub Desktop.
Save joewiz/6449964 to your computer and use it in GitHub Desktop.
Show ambassadors in order of the most numbers of postings, using XQuery
xquery version "3.0";
for $ambassador in collection('/db/cms/apps/principals-chiefs/data')/person
let $postings := $ambassador/role
let $how-many-postings := count($postings)
group by $how-many-postings
order by $how-many-postings descending
return
<group postings="{$how-many-postings}" people-in-this-group="{count($ambassador)}">
{
for $a in $ambassador
return $a
}
</group>
<group postings="16" people-in-this-group="1">
<person id="jackson-john-brinkerhoff">
<persName>
<surname>Jackson</surname>
<forename>John Brinkerhoff</forename>
<altname>John B. Jackson</altname>
</persName>
<birth>1862</birth>
<death>1920</death>
<career>Non-career appointee</career>
<residence location="nj"/>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="cl">
<event type="appointed" when="1902-10-13"/>
<note>Declined appointment. Commissioned during a recess of the Senate.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="gr">
<event type="appointed" when="1902-10-13"/>
<event type="credentialed" when="1902-12-24"/>
<event type="missionterminated">Recommissioned to serve concurrently as Diplomatic Agent
in Bulgaria</event>
<note>Commissioned during a recess of the Senate; recommissioned as Envoy Extraordinary
and Minister Plenipotentiary to Greece, Romania, and Serbia after confirmation on
Dec 8, 1902; resident at Athens. Also accredited to Romania and Serbia; resident at
Athens.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="ro">
<event type="appointed" when="1902-10-13"/>
<event type="credentialed" when="1903-04-07"/>
<event type="missionterminated">Recommissioned to a different combination of countries</event>
<note>Commissioned during a recess of the Senate; recommissioned after confirmation on
Dec 8, 1902. Commissioned to Greece, Romania, and Serbia; resident at Athens.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="xi">
<event type="appointed" when="1902-10-13"/>
<note>Commissioned during a recess of the Senate; recommissioned after confirmation on
Dec 8, 1902. Commissioned Envoy Extraordinary and Minister Plenipotentiary to
Greece, Romania, and Serbia; took oath of office, but did not present credentials in
Serbia until 1904; resident at Athens. Commissioned Jul 5, 1903, as Envoy
Extraordinary and Minister Plenipotentiary to Greece, Romania, and Serbia and
Diplomatic Agent in Bulgaria; resident at Athens.</note>
</role>
<role class="chief" type="diplomatic-agent" location="bg">
<event type="appointed" when="1903-06-05"/>
<event type="credentialed" when="1903-09-19"/>
<event type="missionterminated">Recommissioned to a different combination of countries</event>
<note>Commissioned as Envoy Extraordinary and Minister Plenipotentiary to Greece,
Romania, and Serbia and Diplomatic Agent in Bulgaria; resident at Athens.
Commissioned during a recess of the Senate; recommissioned after confirmation on Nov
16, 1903.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="gr">
<event type="appointed" when="1903-06-05"/>
<event type="missionterminated">Recommissioned to a different combination of countries</event>
<note>Commissioned during a recess of the Senate; recommissioned as Envoy Extraordinary
and Minister Plenipotentiary to Greece, Romania, and Serbia, and Diplomatic Agent in
Bulgaria. Recommissioned after confirmation on Nov 16, 1903; resident at
Athens.</note>
</role>
<role class="chief" type="diplomatic-agent" location="ro">
<event type="appointed" when="1903-06-05"/>
<event type="missionterminated" when="1905-07-25">Presented recall</event>
<note>Commissioned as Envoy Extraordinary and Minister Plenipotentiary to Greece,
Romania, and Serbia and Diplomatic Agent to Bulgaria; resident at Athens.
Commissioned during a recess of the Senate; recommissioned after confirmation on Nov
16, 1903.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="xi">
<event type="appointed" when="1903-07-05"/>
<event type="credentialed" when="1904-05-09"/>
<event type="missionterminated" when="1905-07-13">Presented recall</event>
<note>Commissioned during a recess of the Senate as Envoy Extraordinary and Minister
Plenipotentiary to Greece, Romania, and Serbia and Diplomatic Agent in Bulgaria;
resident at Athens. Recommissioned on Nov 16, 1903. Commissioned to Romania and
Serbia; resident at Bucharest.</note>
</role>
<role class="chief" type="diplomatic-agent" location="bg">
<event type="appointed" when="1905-03-08"/>
<event type="missionterminated" when="1907-06-04">Presented recall</event>
<note>Commissioned as Envoy Extraordinary and Minister Plenipotentiary to Greece and
Montenegro and Diplomatic Agent in Bulgaria; resident at Athens.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="gr">
<event type="appointed" when="1905-03-08"/>
<event type="missionterminated" when="1907-10-19">Presented recall</event>
<note>Commissioned as Envoy Extraordinary and Minister Plenipotentiary to Greece and
Montenegro and Diplomatic Agent in Bulgaria; resident at Athens.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="me">
<event type="appointed" when="1905-03-08"/>
<event type="credentialed" when="1905-10-30"/>
<event type="missionterminated" when="1907-10-27">Presented recall</event>
<note>Accredited also to Greece and Bulgaria; resident at Athens.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="ir">
<event type="appointed" when="1907-07-01"/>
<event type="credentialed" when="1907-12-12"/>
<event type="missionterminated" when="1909-07-03">Left post</event>
<note>Commissioned during a recess of the Senate; recommissioned after confirmation on
Dec 12, 1907. Commissioned to Persia.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="cu">
<event type="appointed" when="1909-12-21"/>
<event type="credentialed" when="1910-03-22"/>
<event type="missionterminated" when="1911-10-27">Presented recall</event>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="bg">
<event type="appointed" when="1911-08-12"/>
<event type="credentialed" when="1912-02-01"/>
<event type="missionterminated" when="1913-10-18">Presented recall</event>
<note>Commissioned as Envoy Extraordinary and Minister Plenipotentiary to Romania,
Serbia, and Bulgaria; resident at Bucharest.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="ro">
<event type="appointed" when="1911-08-12"/>
<event type="credentialed" when="1911-12-24"/>
<event type="missionterminated" when="1913-10-28">Presented recall</event>
<note>Commissioned as Envoy Extraordinary and Minister Plenipotentiary to Romania,
Serbia, and Bulgaria; resident at Bucharest.</note>
</role>
<role class="chief" type="envoy-extraordinary-minister-plenipotentiary" location="xi">
<event type="appointed" when="1911-08-12"/>
<event type="credentialed" when="1912-01-16"/>
<event type="missionterminated" when="1913-10-15">Presented recall</event>
<note>Commissioned as Envoy Extraordinary and Minister Plenipotentiary to Romania,
Serbia, and Bulgaria; resident at Bucharest.</note>
</role>
</person>
</group>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment