Your query only returns a single object (/en/united_states
), which is why a cursor won't help you here. What you need to do is turn the query inside out so that the piece that is currently a subquery (office_holder) is at the outer level so you can iterate through it.
You can invert the query easily in the online query editor by pasting in your original query (click here), placing the cursor on the innermost subquery and clicking invert query
which will give you something like this:
[{
"id": null,
"name": null,
"type": "/government/politician",
"!/government/government_position_held/office_holder": [{
"!/government/governmental_jurisdiction/governing_officials": [{
"id": "/en/united_states",
"name": null
}]
}]
}]
which works, but is a little ugly and can be simplified to this:
[{
"id": null,
"name": null,
"type": "/government/politician",
"government_positions_held": [{
"jurisdiction_of_office": [{
"id": "/en/united_states"
}],
"basic_title": null
}]
}]
which is a query that you can iterate through using a cursor.
One thing you should check, though, is the coverage of the jurisdiction
property for offices to make sure it's well enough populated to provide you with useful data.