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

Provide lookup for range class of given attribute #34

Closed palexander closed 11 years ago

palexander commented 11 years ago

For a goo object, we should provide an option to retrieve the class for a given attribute when that attribute is associated to another object via the :instance_of option in the attribute DSL.

For example:

class Review < Goo::Base::Resource
  model :review
  attribute :creator, :instance_of => { :with => :user }, :cardinality => { :max => 1, :min => 1 }
end

> cls = Review.range_class(:creator)
> cls == User
=> true