Accessing JuMP variables after reading model from file

I haven’t looked into this before now, but when I read an LP file into a JuMP model as e.g.

m = JuMP.read_from_file("model_test.lp")

then the docs tell me that the constraints or variable names in the LP file will not be registered or available for accessing as m[:SomeName]. Fair enough, but if I don’t really know how the original model is represented in the file, then how should I best work with the model after solving to access variable values?

I can get all the global information on constraint or variable names using

m.moi_backend.model_cache.model.name_to_con

or

m.moi_backend.model_cache.model.name_to_var

but this seems like too much relying on internals? Is there a functional way to pull out sets of variables or constraints (maybe after using some text pattern matching)?

Ok, so Discourse showed me this answer as soon as I posted: JuMP : how to read a lp problem from file (lp FORMAT) with variables names?

with Oscar’s nice solution:

solution = Dict(name(x) => value(x) for x in all_variables(model))

or use

all_constraints(model; include_variable_in_set_constraints=true)

I think this is just about ‘findability’ - possibly a good inclusion in the docs in Solutions section and/or Models.