81a6387a4ab56a24194ecbabd6609c6bcca568b7Tim Reddehase request.send(:env)["action_dispatch.request.path_parameters"]
c4f318dca9446ec8beb46dc5695d4435f1c12d5bTim Reddehase set_path_parameters(request, params(request).merge(add_params))
a847d9812b328c048773e705606b10875a929034Eugen Kuksa return false if Repository.find_by_path(request.params[:repository_id]).nil?
a847d9812b328c048773e705606b10875a929034Eugen Kuksa set_params_path_without_format(request) if result
a847d9812b328c048773e705606b10875a929034Eugen Kuksa @params = request.send(:env)["action_dispatch.request.path_parameters"]
a847d9812b328c048773e705606b10875a929034Eugen Kuksa @path += ".#{@params[:format]}" if @params[:format]
a847d9812b328c048773e705606b10875a929034Eugen Kuksa @params.merge!({ path: @path }).except!(:format)
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef @elements_cache_clear_at = Time.now + ELEMENTS_CACHE_CLEARING_INTERVAL
c4cb6bccad9d72c8b284075f716fc9095b3f3be2Tim Reddehase # retrieves the hierarchy and member portions of loc/id's
c4cb6bccad9d72c8b284075f716fc9095b3f3be2Tim Reddehase hierarchy_member = path.split('?', 2).first.split('///', 2).first
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef LocIdBaseModel.find_with_locid(hierarchy_member)
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef clear_elements_cache if elements_cache_clearing_scheduled?
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef if !elements_cache.key?(hierarchy_member) && element
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef self.class.instance_variable_get(:@elements_cache)
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef # To keep the memory footprint low in case of unproper removal of cached
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef # elements, we clear the cache periodically. This prevents memory leaks.
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef next_clearing = Time.now + ELEMENTS_CACHE_CLEARING_INTERVAL
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef self.class.instance_variable_set(:@elements_cache_clear_at, next_clearing)
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef self.class.instance_variable_set(:@elements_cache, {})
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef Time.now > self.class.instance_variable_get(:@elements_cache_clear_at)
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef ontology = element.is_a?(Ontology) ? element : element.ontology
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef proof_attempt = element.proof_attempt if @map[:proof_attempt]
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef path_params = {repository_id: ontology.repository.to_param}
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef %i(proof_attempt theorem ontology element).each do |p|
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef path_params[@map[p]] = binding.local_variable_get(p).id if @map[p]
81a6387a4ab56a24194ecbabd6609c6bcca568b7Tim Reddehaseclass RefLocIdRouterConstraint < LocIdRouterConstraint
10be32b36246121321399ec3ab26d4d723d550e3Tim Reddehase path = Journey::Router::Utils.unescape_uri(request.original_fullpath)
6f84d8dbc4edca35b7e69c8296a257ea17e3b74fTim Reddehase result && update_version_id!(request, path.dup)
6f84d8dbc4edca35b7e69c8296a257ea17e3b74fTim Reddehase ontology_id = version.try(:ontology).try(:to_param)
6f84d8dbc4edca35b7e69c8296a257ea17e3b74fTim Reddehase add_path_parameters(request, id: version_id, ontology_id: ontology_id)
4949048bda09e116ee3627383e831455954cbe41Tim Reddehaseclass MMTRouterConstraint < LocIdRouterConstraint
a847d9812b328c048773e705606b10875a929034Eugen Kuksa repository_id: ontology.repository.to_param, id: ontology.id)
419f986abb76f6fce54b71e17f52a1deaa06dbd6Tim Reddehaseclass RefIRIRouterConstraint < IRIRouterConstraint
419f986abb76f6fce54b71e17f52a1deaa06dbd6Tim Reddehase # remove the ref/:version_number portion from path
03ec1d0391beb40e0ae66a73cf99554e1ca6fa15Tim Reddehase path = Journey::Router::Utils.unescape_uri(request.original_fullpath).
d9a3935fa80ce492e782d17ec22825d1708dea97Tim Reddehase self.mime_types = mime_types.flatten.map { |m| Mime::Type.lookup(m) }
80021fb6bde14c39046950cdbaaadf767d173f94Tim Reddehase # In some cases request.accepts == [nil] (e.g. cucumber tests),
80021fb6bde14c39046950cdbaaadf767d173f94Tim Reddehase highest_mime ? mime_types.any? { |m| highest_mime == m } : true