add_relationship() does not recognize object PIDs when provided as unicode strings
Closed this issue · 3 comments
Perhaps this is not a bug, and just how unicode and string objects are treated differently with Eulfedora, but it has caused us various bouts of confusion when creating relationships with add_relationship
, and thought it might be worth mentioning.
When using add_relationship()
, if you provide unicode objects instead of plain strings, they are not added as rdf:resource
to the triple, but instead, as string literals.
For example, object_handle.add_relationship(u'fedora-rels-ext:hasContentModel',u'info:fedora:CM:Collection')
would create the RELS-EXT triple, <hasContentModel xmlns="info:fedora/fedora-system:def/relations-external#">info:fedora/CM:Collection</hasContentModel>
Where, object_handle.add_relationship('fedora-rels-ext:hasContentModel','info:fedora:CM:Collection')
would create, <hasContentModel xmlns="info:fedora/fedora-system:def/relations-external#" rdf:resource="info:fedora/CM:Collection"></hasContentModel>
Now that we know to look out for that, it's relatively easy to manage for, but was not obvious at first.
Looks like a bug. Thanks for pointing it out.
That's great! Many thanks.