tripod icon indicating copy to clipboard operation
tripod copied to clipboard

criteria.resources ignores opts parameters

Open fonji opened this issue 11 years ago • 3 comments

Hello!

I found an error in lib/tripod/criteria/execution.rb:15. There's a closing parenthesis at the end of the line instead of an opening {. This ends the method call and so parameters are ignored. Third line here:

def resources(opts={})
  Tripod::ResourceCollection.new(
    self.resource_class._resources_from_sparql(self.as_query(opts)),
     # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph
    :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true),
    :criteria => self
  )
end

Should be

def resources(opts={})
  Tripod::ResourceCollection.new(
    self.resource_class._resources_from_sparql(self.as_query(opts),{
         # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph
        :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true),
        :criteria => self
      }
    )
  )
end

Sorry I can't create a commit right now, maybe tomorrow.

fonji avatar Nov 06 '13 17:11 fonji

Thanks - I'll take a look. By the way, not forgotten about the other issues; just been super-busy!

On 6 Nov 2013, at 17:42, Yannick Fonjallaz [email protected] wrote:

Hello!

I found an error in lib/tripod/criteria/execution.rb:15. There's a closing parenthesis at the end of the line instead of an opening {. This ends the method call and so parameters are ignored. Third line here:

def resources(opts={}) Tripod::ResourceCollection.new( self.resource_class._resources_from_sparql(self.as_query(opts)), # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true), :criteria => self ) end Should be

def resources(opts={}) Tripod::ResourceCollection.new( self.resource_class._resources_from_sparql(self.as_query(opts),{ # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true), :criteria => self } ) ) end Sorry I can't create a commit right now, maybe tomorrow.

— Reply to this email directly or view it on GitHub.

ricroberts avatar Nov 06 '13 17:11 ricroberts

Thanks for the answer, sorry for the flood! I'm super-busy as well, developping an app that uses tripod ;)

fonji avatar Nov 06 '13 17:11 fonji

Here's the commit. I also added some lines in .gitignore to fit my linux env.

Sorry for not creating a pull request, my patch to support Sesame (see #15) makes it ugly.

fonji avatar Nov 07 '13 12:11 fonji