-
Notifications
You must be signed in to change notification settings - Fork 0
Basic queries
shi edited this page Apr 30, 2021
·
1 revision
All possible column names can be found by querying a table and looking at the returned JSON.
By specifying the xpath of an element in root, you can filter results to within that element without displaying the entire xml.
This gets you data within the budget element from a random activity.
select *
from xson where root='/iati-activities/iati-activity/budget'
limit 1;Result
{
result: [
{
aid: "SE-0-SE-6-10451A0101-MLI-72012",
pid: "SE-0",
root: "/iati-activities/iati-activity/budget",
xson: {
/value: 189381.7616514557,
/value@currency: "USD",
/value@value-date: "2019-01-01",
/period-end@iso-date: "2019-12-28",
/period-start@iso-date: "2019-01-01"
}
}
],
duration: 0.014
}This gets you data within the total-expenditure element from a random organisation file.
select *
from xson where root='/iati-organisations/iati-organisation/total-expenditure'
limit 1;Result
{
result: [
{
aid: null,
pid: "XM-DAC-41123",
root: "/iati-organisations/iati-organisation/total-expenditure",
xson: {
/value: 1060488055.37,
/value@currency: "USD",
/value@value-date: "2013-01-01",
/period-end@iso-date: "2013-12-31",
/period-start@iso-date: "2013-01-01"
}
}
],
duration: 0.009
}
Documentation is ongoing - please bear with us. Any feedback is appreciated.
- Introduction
- Getting started
- Basic Queries
-
Recipes
- Display count of certain element in org file
- Look for similar
iati-identifierusing a wildcard% - Filtering on custom namespace elements
- Display iati-organisation id with curated elements within
total-budget - Group by publishers that use a particular
@ref - Display first
/narrativearray in multiple roots, count and grouped for a particular@ref - Display all publishers listing (GIZ) in
participating-org/narrative - Display all publishers with
conditions@attachedas YES - Display narratives and count, grouped by publishers with
condition@type - Display narratives grouped by publishers with
condition@type1 - Display an element attribute, grouped in descending order
- Display full activity data within an element for multiple identifiers
- Display identifiers sorted by the second column (narrative) in descending order
- Display number of items with full activity data for an element and vocab
- Subquery to get full activity data
- Display full activity data with attribute of certain value
- Display unique activity identifiers with attribute of certain value
- Get a table of most used values sorted by count
- Display all activities for a country_code within COVID-19