From 7df862e79a2aa3a09a354e209bde18d6c8984a11 Mon Sep 17 00:00:00 2001 From: tokebe <43009413+tokebe@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:43:34 -0400 Subject: [PATCH] fix: ctd jq pair function --- data/jq/pair/ctd.jq | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/data/jq/pair/ctd.jq b/data/jq/pair/ctd.jq index 830c945..017fba1 100644 --- a/data/jq/pair/ctd.jq +++ b/data/jq/pair/ctd.jq @@ -1 +1,18 @@ -reduce (.response | .[]) as $item ({}; .[generateCurie($edge.association.input_id; $item.Input | ascii_upcase)] = [] + .[generateCurie($edge.association.input_id; $item.Input | ascii_upcase)] + [$item]) | map_values([.]) +reduce (.response | .[]) as $item ( + {}; .[generateCurie($edge.association.input_id; ( + if ($edge.input | type) == "object" then + ($edge.input.queryInputs | toArray)[] | select(($item.Input | ascii_upcase) | contains(. | ascii_upcase)) + else + ($edge.input | toArray) | select(($item.Input | ascii_upcase) | contains(. | ascii_upcase)) + end + ))] = [] + + .[generateCurie($edge.association.input_id; ( + if ($edge.input | type) == "object" then + ($edge.input.queryInputs | toArray)[] | select(($item.Input | ascii_upcase) | contains(. | ascii_upcase)) + else + ($edge.input | toArray) | select(($item.Input | ascii_upcase) | contains(. | ascii_upcase)) + end + ))] + + [$item] +) | map_values([.]) +# TODO: current setup doesn't error, but only grabs one item.