ncbo / goo

Graph Oriented Objects (GOO) for Ruby. A RDF/SPARQL based ORM.
http://ncbo.github.io/goo/
Other
15 stars 6 forks source link

Preload some model attributes when listing instances #47

Closed msalvadores closed 5 years ago

msalvadores commented 11 years ago
Model.all :load_attrs => [:attr1, :attr2]
msalvadores commented 11 years ago

We need to have nested attributes ...

University.all :load_attrs => [:name => true, :location => [:country => true, :city => true ]]
palexander commented 11 years ago

Wouldn't this work?

University.all :load_attrs => [:name => true, :location => [:country, :city]]

Otherwise, I think you need this:

University.all :load_attrs => [:name => true, :location => {:country => true, :city => true}]
msalvadores commented 11 years ago

:+1:

msalvadores commented 11 years ago

And optionals :(

University.all :load_attrs => [:name => true, :location => {:optional => true, :country => true, :city => :optional}]
msalvadores commented 11 years ago

Preloading nested attributes will be implemented later. At the moment we prefer to keep the SPARQL queries simple and rely on highly successful caching to improve performance. If queries are simple the cache is likely to be have a higher successful ratio.

graybeal commented 5 years ago

It appears this has been sufficiently addressed. Closing.