How about, for a little more understandability:

```ruby
  alps_uri = Addressable::URI.parse(config.alps_base_uri)
  alps_uri.scheme = uri.scheme
  template = Addressable::Template.new("#{alps_uri}{/id*}")
  template.extract(uri)
end
```