Thanks, Rick...
I'm trying it out and don't appear to the have relationship_exists?
method. I placed the code in one of my models. Also, does the object
have to exist in Fedora? Not a big deal if it has to, it'll mean
deleting the relationship before deleting the object. So,
object = AfModel.load_instance("[pid]")
parent = AfModel.load_instance("[parent_pid"])
parent.remove_relationship(:has_memeber, object)
...adam
On Aug 4, 11:40 am, Rick Johnson <
richardpatrickjohn...@gmail.com>
wrote:
> Hi Adam and Matt,
>
> This is actually included in some code I am about to submit for update to
> ActiveFedora. I suggest putting the current code into a module for the time
> being and then including it in your model classes:
>
> def remove_relationship(predicate, object)
> unregister_triple(:self, predicate, object)
> end
>
> def unregister_triple(subject, predicate, object)
> if relationship_exists?(subject, predicate, object)
> r = ActiveFedora::Relationship.new(:subject=>subject,
> :predicate=>predicate, :object=>object)
> relationships[subject][predicate].delete_if {|curObj| curObj ==
> r.object}
> relationships[subject].delete(predicate) if
> relationships[subject][predicate].nil? ||
> relationships[subject][predicate].empty?
> rels_ext.dirty = true
> else
> return false
> end
> end
>
> On Wed, Aug 4, 2010 at 9:25 AM, adam wead <
amsterda...@gmail.com> wrote:
> > Hi Matt,
>
> > Is there the equivalent of a delete_relationship method for AF
> > objects? I'm trying to update the RELS-EXT datastream of a parent
> > object by removing a particular pid from the has_member
> > relationship.
>
> > thanks,
>
> > ...adam
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "ActiveFedora / Ruby + Fedora Commons" group.
> > To post to this group, send email to
active...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
active-fedor...@googlegroups.com<
active-fedora%2Bunsu...@googlegroups.com>
> > .