module ActiveFedora::SemanticNode::ClassMethods
def has_relationship(name, predicate, opts = {})
These symbols map to the uris of corresponding Fedora RDF predicates
Special Predicate Short Hand:
foo.parts
foo = Foo.new
end
relationship "container", :is_member_of
class Foo
ie.
A custom finder method will be appended based on the relationship name.
Custom Methods:
TODO:
predicate is registered under @relationships[:inbound][#{predicate}]
:self as the subject of the relationship unless :inbound => true, in which case the
Creates a key in the @relationships array for the predicate provided. Assumes
Anticipates usage of a relationship in classes that include this module
def has_relationship(name, predicate, opts = {}) opts = {:singular => nil, :inbound => false}.merge(opts) opts[:inbound] == true ? register_predicate(:inbound, predicate) : register_predicate(:self, predicate) if opts[:inbound] == true create_inbound_relationship_finders(name, predicate, opts) else create_outbound_relationship_finders(name, predicate, opts) end end