or, going in the other direction which you mention:
Code:
tell application id "OFOC"
tell default document
set oContext to first flattened context where name = "high"
set context of (flattened tasks where flagged = true) to oContext
end tell
end tell