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.