Test htsworkflow under several different django & python versions
[htsworkflow.git] / encode_submission / biosample.sql
1 with recursive
2    biosample(uri, payload, parent_of, part_of, d) as (
3        select uri, payload,
4               jsonb_array_elements_text(payload->'parent_of') as parent_of,
5               payload->>'part_of' as part_of,
6               1
7        from item
8        where object_type = 'Biosample'
9    union all
10        select child.uri, child.payload,
11               jsonb_array_elements_text(child.payload->'parent_of') as parent_of,
12               child.payload->>'part_of' as part_of,
13               d + 1
14        from biosample, item child
15        where biosample.uri = child.payload->>'part_of'
16    )
17 select part_of, uri, parent_of, d
18 from biosample
19 where d > 1
20 order by uri