issues
search
rcsb
/
py-rcsb-api
Python interface for RCSB.org API services
https://rcsbapi.readthedocs.io
MIT License
8
stars
0
forks
source link
Recursive function to construct query
#20
Closed
habiba-m
closed
3 months ago
habiba-m
commented
3 months ago
recurse_fields()
: a recursive function that constructs a query using the necessary fields and subfields
For each field in the
fields
dictionary, the method:
retrieves the field's path in the graph using
field_map
checks if the field has subfields (i.e., if it's a complex type). If so, it recursively calls itself with the subfields and the updated indent level.
If the field is a scalar type, it simply adds the field name to the query string.
For each subfield, the method:
Recursively calls itself with the subfield's path and the updated indent level.
Adds the subfield's name and value to the query string, indented according to the indent level.
Base Case: when the
value
is a scalar type
More test cases added
recurse_fields()
: a recursive function that constructs a query using the necessary fields and subfieldsfields
dictionary, the method:field_map
value
is a scalar type