relpipe-data/examples/xhtml-table-sql-statistics.sh
branchv_0
changeset 268 1b8576c9640c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/relpipe-data/examples/xhtml-table-sql-statistics.sh	Tue Aug 27 13:50:37 2019 +0200
@@ -0,0 +1,26 @@
+#!/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