#!/bin/bash
URL="https://relational-pipes.globalcode.info/v_0/implementation.xhtml";
# or we can use wget, if curl is missing or we like wget more:
# curl() { wget -O - "$1"; }
curl "$URL" \
| relpipe-in-xmltable \
--namespace "h" "http://www.w3.org/1999/xhtml" \
--relation "implementation" \
--records "//h:table[1]/h:tbody/h:tr" \
--attribute "name" string "h:td[1]" \
--attribute "type" string "h:td[2]" \
--attribute "subtype" string "h:td[3]" \
| relpipe-tr-sql \
--relation \
"relpipe_commands" \
"SELECT
subtype AS type,
count(*) AS count
FROM implementation
WHERE type = 'executable'
GROUP BY type, subtype
ORDER BY count DESC" \
| relpipe-out-tabular