LazyMonkey
unread,Sep 22, 2010, 5:10:05 PM9/22/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ActiveFedora / Ruby + Fedora Commons
Hi Matt,
I was using AF (1.0.7) not too long ago, and was adding some RDF about
content models in the RELS-EXT datastream. I ran into a namespace
error that flummoxed me at first, until I realized the
outbound_relationships method was assigning "info:fedora/fedora-
system:def/relations-external#" as the xmlns of the triple, when I
needed "info:fedora/fedora-system:def/model#"
My solution was to change the xmlns variable as required, like so:
self.outbound_relationships.each do |predicate, targets_array|
targets_array.each do |target|
xmlns=String.new
case predicate
when :hasModel
xmlns="info:fedora/fedora-system:def/model#"
when :has_model
xmlns="info:fedora/fedora-system:def/model#"
else
xmlns="info:fedora/fedora-system:def/relations-external#"
end
# puts ". #{predicate} #{target} #{xmlns}"
xml.root.elements["rdf:Description"].add_element(self.class.predicate_lookup(predicate),
{"xmlns" => "#{xmlns}", "rdf:resource"=>target})
end
end
xml.to_s
end
If I was barking up the wrong tree, please let me know.
(I'm glad to see you've added :has_model => "hasModel", to the
PREDICATE_MAPPINGS table, btw. That was the other missing piece.)
Thanks again for your module.
Matthew Stephens
UVA Library