You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
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 asrdf: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.
The text was updated successfully, but these errors were encountered: