From 8d7b43731c13ced63ffc9a8d382508fecf1483c8 Mon Sep 17 00:00:00 2001 From: tokebe <43009413+tokebe@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:06:53 -0400 Subject: [PATCH] fix: CTD pair function batch support --- data/jq/pair/ctd.jq | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/data/jq/pair/ctd.jq b/data/jq/pair/ctd.jq index 017fba1..a912f1f 100644 --- a/data/jq/pair/ctd.jq +++ b/data/jq/pair/ctd.jq @@ -1,18 +1,23 @@ -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 - ))] +reduce .response[] as $item ( + {}; .[( + if ($edge.input | type) == "object" then + ($edge.input.queryInputs | toArray)[] + else + ($edge.input | toArray)[] + end + ) + | select(($item.Input | ascii_upcase | split(":") | last) == (. | ascii_upcase)) + | generateCurie($edge.association.input_id; .) + ] = [] + + .[( + if ($edge.input | type) == "object" then + ($edge.input.queryInputs | toArray)[] + else + ($edge.input | toArray)[] + end + ) + | select(($item.Input | ascii_upcase | split(":") | last) == (. | ascii_upcase)) + | generateCurie($edge.association.input_id; .) + ] + [$item] ) | map_values([.]) -# TODO: current setup doesn't error, but only grabs one item.