From 541b4d8df75409dc11884d4f1d86f4f37e79d6db Mon Sep 17 00:00:00 2001 From: Jakob Voss Date: Fri, 26 Feb 2021 14:07:31 +0100 Subject: [PATCH] Add api-types jq script --- data/legacy/api-types.jq | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 data/legacy/api-types.jq diff --git a/data/legacy/api-types.jq b/data/legacy/api-types.jq new file mode 100644 index 0000000..d88f3ac --- /dev/null +++ b/data/legacy/api-types.jq @@ -0,0 +1,17 @@ +# Migrate API values from plain URL strings to typed values (#87) +# Usage: +# jq -c -f latest.ndjson > latest-with-api-types.ndjson + +def apitype: + if (.|test("bartoc|dante|bielefeld|coli-conc")) then + "http://bartoc.org/api-type/jskos" + elif (.|test("skosmos")) then + "http://bartoc.org/api-type/skosmos" + else + "http://bartoc.org/api-type/webservice" + end +; + +if .API then + .API=(.API|map({ url: ., type: (.|apitype) })) +else . end