add_relationship on newly created objects

7 views
Skip to first unread message

LazyMonkey

unread,
Nov 17, 2009, 2:41:25 PM11/17/09
to ActiveFedora / Ruby + Fedora Commons
This is more of a feature request than a bug report. I'm testing a
batch script for ingesting groups of fedora objects and running into a
bit of an issue. If I have a pre-existing object for the collection,
I can add relationships to it, or to the new AF object. But if I'm
creating both objects (the item and its collection parent) in the same
run of the program, the AF add_relationship methods fail, as they're
making calls to Fedora for objects that haven't been created yet. My
workaround is to save the objects once, then add relationships, then
save again. But it would be nice if you could add_relationship to
objects, and the method's success didn't rely on reaching into Fedora
itself.

Matthew Zumwalt

unread,
Nov 17, 2009, 3:19:30 PM11/17/09
to active...@googlegroups.com
add_relationship is designed to allow you to add any string or URI as the object of a relationship.  You should currently be able to add relationships to your heart's delight without saving as long as you're feeding strings into the relationships.  However, if you pass an ActiveFedora object to the method it will use that object's pid as the "object" in the triple.  My guess is that what's happening is that you're attempting to use an unsaved object, which doesn't have a pid yet, so you won't have anything to point to until you save the object.

there also could be a bug that forces you to have a pid for object you're adding relationships to before you can add any relationships.  I'd have to double check.


Matt Zumwalt
MediaShelf, LLC




--

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.
For more options, visit this group at http://groups.google.com/group/active-fedora?hl=.



Reply all
Reply to author
Forward
0 new messages