The derivatives spec encourages some keywords to be used in either filenames or JSON sidecars, without necessarily mandating one or the other. For instance, I believe space is mandatory for many files, but the spec allows that the information can be contained in JSON rather than filenames. So, if someone does this:
files = layout.get(subject='01', space='MNI152', extensions='.nii.gz')
...then currently space will be treated as a filename entity and metadata will never be inspected for space. This means there's no way to specify a disjunction over filenames and metadata.
Unfortunately, allowing disjunctions would reduce the efficiency of the search/indexing process considerably, because we would need to pre-index metadata for all files up front, instead of using the current approach (only checking metadata for files that match the entity-level constraints, and caching any inspected file for future use). But that would at least make the implementation of the fix relatively simple.
See also #397 for a related discussion.